Sample Header Ad - 728x90

Adding a working boot option to get to my pacstrap/chroot install on a luks partition

1 vote
0 answers
195 views
I know there are are a lot of questions like this but the examples I have found differ enough to confuse me, I'm hoping someone can help clarify this for me. To briefly explain my setup. I have a windows 10 install and then on a different disk I have a garuda linux install. Both work fine but were set up for me by a the respective gui installers. I have now installed arch linux to separate partition (luks encrypted) from my garuda install (pacstrap) and would like to be able to boot into it. I can chroot into the install and have done bind mount for /dev /proc and /sys so I can see all devices and have successfully run an update and installed some bins. disk/partition setup is as follows: Windows disk and EFI:
Device             Start        End    Sectors   Size Type
/dev/nvme0n1p1      2048    1085439    1083392   529M Windows recovery environment
/dev/nvme0n1p2   1085440    1290239     204800   100M EFI System
/dev/nvme0n1p3   1290240    1323007      32768    16M Microsoft reserved
/dev/nvme0n1p4   1323008  519925759  518602752 247.3G Microsoft basic data
/dev/nvme0n1p5 519925760 1953523711 1433597952 683.6G Microsoft basic data
and then for linux:
/dev/sda1        2048  835028991  835026944 398.2G Linux filesystem (garuda)
/dev/sda2   835028992 1859028991 1024000000 488.3G Linux filesystem (arch -no boot)
sda1 & sda2 are both on btrfs partitions with luks encryption. However, I am not entirely clear how the garuda one was set up (gui installer). I am currently logged into garuda and have both drives unencrypted however I only see the dev/mapper for the device Im not booted into (dev/sda2) and that is the only one that show up with a luks map in lsblk:
✦  ╰─λ lsblk -o name,uuid,type
NAME                                          UUID                                 TYPE
sda                                                                                disk
├─sda1                                        c42114f3-adea-4625-8ec7-1d9ef08c00d5 part
├─sda2                                        35308676-366b-495a-afd3-9c65701ec867 part
│ └─luks-35308676-366b-495a-afd3-9c65701ec867 fb72ec72-1352-4e5c-849d-a44c69ba4b16 crypt
The unencrypted device is mounted to /run/media/dan/nix_e1 with the arch install visible. /boot (garuda ) I have grub dir, kernels and the efi partition mounted to /efi :
✦  ╰─λ ls /boot 
drwxr-xr-x   - root  1 Jan  1970  efi
drwxr-xr-x   - root 29 Mar 02:28  grub
drwxr-xr-x   - root  8 Mar 05:09  memtest86+
.rw-r--r-- 51k root 11 Mar 19:21  amd-ucode.img
.rw------- 68M root 26 Mar 16:27  initramfs-linux-zen-fallback.img
.rw------- 43M root 26 Mar 16:27  initramfs-linux-zen.img
.rw-r--r-- 11M root 23 Mar 16:37  vmlinuz-linux-zen
/etc/fstab (garuda):
UUID=c42114f3-adea-4625-8ec7-1d9ef08c00d5 /              btrfs   subvol=/@,defaults,noatime,autodefrag,compress=zstd,discard=async,ssd 0 0
UUID=c42114f3-adea-4625-8ec7-1d9ef08c00d5 /home          btrfs   subvol=/@home,defaults,noatime,autodefrag,compress=zstd,discard=async,ssd 0 0
UUID=c42114f3-adea-4625-8ec7-1d9ef08c00d5 /root          btrfs   subvol=/@root,defaults,noatime,autodefrag,compress=zstd,discard=async,ssd 0 0
UUID=c42114f3-adea-4625-8ec7-1d9ef08c00d5 /srv           btrfs   subvol=/@srv,defaults,noatime,autodefrag,compress=zstd,discard=async,ssd 0 0
UUID=c42114f3-adea-4625-8ec7-1d9ef08c00d5 /var/cache     btrfs   subvol=/@cache,defaults,noatime,autodefrag,compress=zstd,discard=async,ssd 0 0
UUID=c42114f3-adea-4625-8ec7-1d9ef08c00d5 /var/log       btrfs   subvol=/@log,defaults,noatime,autodefrag,compress=zstd,discard=async,ssd 0 0
UUID=c42114f3-adea-4625-8ec7-1d9ef08c00d5 /var/tmp       btrfs   subvol=/@tmp,defaults,noatime,autodefrag,compress=zstd,discard=async,ssd 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
UUID=C61E-FDE5  /boot/efi       vfat    defaults      0       1
I haven't mounted anything to /boot on the arch install yet, so it just has copies of the same kernels as garuda (also arch based) and I have created the efi directory ready for the mount. I have setup the fstab (though Im not entirely sure if I have used the correct uuid - will it see it with the crypt uuid or the part uuid?) /etc/fstab (arch):
#      
# /dev/mapper/luks-35308676-366b-495a-afd3-9c65701ec867 LABEL=nix_e1
UUID=fb72ec72-1352-4e5c-849d-a44c69ba4b16 /           btrfs      rw,nosuid,nodev,relatime,ssd,space_cache=v2,subvolid=5,subvol=/ 0 0
UUID=fb72ec72-1352-4e5c-849d-a44c69ba4b16 /home          btrfs   subvol=/@home,defaults,noatime,autodefrag,compress=zstd,discard=async,ssd 0 0
UUID=fb72ec72-1352-4e5c-849d-a44c69ba4b16 /root          btrfs   subvol=/@root,defaults,noatime,autodefrag,compress=zstd,discard=async,ssd 0 0
UUID=fb72ec72-1352-4e5c-849d-a44c69ba4b16 /srv           btrfs   subvol=/@srv,defaults,noatime,autodefrag,compress=zstd,discard=async,ssd 0 0
UUID=fb72ec72-1352-4e5c-849d-a44c69ba4b16 /var/cache     btrfs   subvol=/@cache,defaults,noatime,autodefrag,compress=zstd,discard=async,ssd 0 0
UUID=fb72ec72-1352-4e5c-849d-a44c69ba4b16 /var/log       btrfs   subvol=/@log,defaults,noatime,autodefrag,compress=zstd,discard=async,ssd 0 0
UUID=fb72ec72-1352-4e5c-849d-a44c69ba4b16 /var/tmp       btrfs   subvol=/@tmp,defaults,noatime,autodefrag,compress=zstd,discard=async,ssd 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0

# /dev/zram0
/dev/zram0            none        swap        defaults,pri=100  0 0
Now this is the point where I get a little lost: From reading I understand I need an initcpio hook, now I am guessing this is already in place for my garuda install. I can see grub-btrfs-overlayfs has been added to the hooks and it seems to have the crypt hook is part of the install... I'm assuming I dont need to do this on the arch partition as well unless I want to update grub from there too (saw some advice not to update grub from two installs). I think next I need to run sudo mkinitcpio -p linux-zen (not sure if I have missed some configuration step). However I have added this device to /etc/crypttab and now it gets auto-mounted and unlocked when I enter the password once (which is the same for both partitions) - so at login to garuda both drives are unlocked... I think this suggests it is set up correctly. Now some seem to suggest that a grub update should pick up the install at this point but it doesn't add a menu entry on update So I have added a menu entry manually to grub: /etc/grub.d/40_custom:
menuentry "Arch" {
search --set=root --fs-uuid luks-35308676-366b-495a-afd3-9c65701ec867
linux /boot/vmlinuz-linux-zen root=UUID=35308676-366b-495a-afd3-9c65701ec867 rw  quiet
}
Now I get an entry in my grub boot menu but on booting it says device 35308676-366b-495a-afd3-9c65701ec867 cannot be found, I have also tried with the uuid fb72ec72-1352-4e5c-849d-a44c69ba4b16 and got the same error. I would appreciate if somebody could confirm what I have done so far is correct and point me in the right direction to get this working. Thank you in advance.
Asked by SwiftD (191 rep)
Mar 29, 2022, 08:26 PM
Last activity: Mar 30, 2022, 09:57 PM