- https://github.com/Benjamin-Loison
- Joined on
2022-10-16
Block a user
How to enable full disk encryption after install?
update-initramfs -k all -c
Output:
update-initramfs: Generating /boot/initrd.img-6.1.0-29-amd64
update-initramfs: Generating /boot/initrd.img-6…
How to enable full disk encryption after install?
/boot/grub/grub.cfg
:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and…
How to enable full disk encryption after install?
update-grub
Output:
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found…
How to enable full disk encryption after install?
In another shell:
ls /boot/efi/
ls: cannot access '/boot/efi/': No such file or directory
[ -d /sys/firmware/efi ] && echo UEFI
How to enable full disk encryption after install?
grub-install
Output:
Installing for x86_64-efi platform.
grub-install: warning: EFI variables are not supported on this system..
Installation…
How to enable full disk encryption after install?
Initial
Initial /etc/default/grub
:
...
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null
How to enable full disk encryption after install?
In /etc/default/grub, remove the existing reference to the root partition from GRUB_CMDLINE_LINUX
there was no such reference.
How to enable full disk encryption after install?
/etc/fstab
:
...
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/vda2 during installation
UUID=8eb1534f-3…
How to enable full disk encryption after install?
/etc/crypttab
:
# ...
rootfs UUID=8eb1534f-39c0-4ded-907e-aee490cb2f3f /etc/luks/boot_os.keyfile luks,discard
should…
How to enable full disk encryption after install?
cryptsetup luksAddKey /dev/vda2 /etc/luks/boot_os.keyfile
Enter any existing passphrase:
How to enable full disk encryption after install?
mkdir /etc/luks
dd if=/dev/urandom of=/etc/luks/boot_os.keyfile bs=4096 count=1
Output:
1+0 records in
1+0 records out
4096 bytes (4.1 kB,…
How to enable full disk encryption after install?
With the current setup, the system would ask the encryption passphrase twice: once to access the second-stage GRUB boot loader and once again for the Linux kernel to access the encrypted root…
How to enable full disk encryption after install?
Bash script:
sudo mount /dev/mapper/rootfs /mnt
sudo mount /dev/vda1 /mnt/boot/efi
sudo mount --bind /dev /mnt/dev
sudo mount --bind /dev/pts…
How to enable full disk encryption after install?
mount /dev/mapper/rootfs /mnt
Output:
mount: /mnt: must be superuser to use mount.
dmesg(1) may have more information after failed…
How to enable full disk encryption after install?
sudo resize2fs /dev/mapper/rootfs
Output:
resize2fs 1.47.0 (5-Feb-2023)
Resizing the filesystem on /dev/mapper/rootfs to 4857344 (4k)…
How to enable full disk encryption after install?
sudo cryptsetup open /dev/vda2 rootfs
Enter passphrase for /dev/vda2:
How to enable full disk encryption after install?
sudo cryptsetup reencrypt /dev/vda2 --new --reduce-device-size 16M --type=luks1
Output:
Enter new passphrase:
Verify passphrase:
Finished,…
How to enable full disk encryption after install?
cryptsetup reencrypt /dev/vda2 --new --reduce-device-size 16M --type=luks1
bash: cryptsetup: command not found
Should try without --type
if it works fine.