ericwoud / buildR64arch

Build script for image for BananaPi R64 / R3 (R4) running Arch Linux
21 stars 5 forks source link

Script fails to find rootdev if the root fs is on a btrfs subvolume #2

Closed attilabody closed 1 year ago

attilabody commented 1 year ago

I have a fairly complex setup with multiple subvolumes mounted to different points of the tree. lsblk output:

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0 596.2G  0 disk 
└─sda1        8:1    0 596.2G  0 part /mnt/userdata_hdd
                                      /mnt/buffer_root
sdb           8:16   0   1.8T  0 disk 
└─sdb1        8:17   0   1.8T  0 part /mnt/data_root
sdc           8:32   0 931.5G  0 disk 
├─sdc1        8:33   0   512M  0 part /boot/efi
├─sdc2        8:34   0    16M  0 part 
├─sdc3        8:35   0 116.7G  0 part 
├─sdc4        8:36   0   515M  0 part 
└─sdc5        8:37   0 813.8G  0 part /var/lib/docker/btrfs
                                      /var/lib/containers
                                      /var/log
                                      /var/lib/docker
                                      /var/lib/bluetooth
                                      /var/cache
                                      /mnt/userdata_ssd
                                      /opt/shared
                                      /mnt/virt
                                      /home
                                      /swap
                                      /mnt/fs_root
                                      /
sdd           8:48   0 111.8G  0 disk 
├─sdd1        8:49   0     1G  0 part 
└─sdd2        8:50   0 110.8G  0 part 
sde           8:64   1   7.5G  0 disk 
├─sde1        8:65   1    32M  0 part 
└─sde2        8:66   1   318M  0 part 
sr0          11:0    1  45.1G  0 rom  
sr1          11:1    1  1024M  0 rom  
nvme0n1     259:0    0   1.8T  0 disk 
├─nvme0n1p1 259:1    0   512M  0 part 
└─nvme0n1p2 259:2    0   1.8T  0 part 

lsblk -pilno name,type,mountpoint output:

/dev/sda       disk 
/dev/sda1      part /mnt/buffer_root
/dev/sdb       disk 
/dev/sdb1      part /mnt/data_root
/dev/sdc       disk 
/dev/sdc1      part /boot/efi
/dev/sdc2      part 
/dev/sdc3      part 
/dev/sdc4      part 
/dev/sdc5      part /mnt/fs_root
/dev/sdd       disk 
/dev/sdd1      part 
/dev/sdd2      part 
/dev/sde       disk 
/dev/sde1      part 
/dev/sde2      part 
/dev/sr0       rom  
/dev/sr1       rom  
/dev/nvme0n1   disk 
/dev/nvme0n1p1 part 
/dev/nvme0n1p2 part 

There is no line that ends with "/", so the script does not find the rootdev.

Hint: Dockerize?

ericwoud commented 1 year ago

Any suggestions how to find the root with lsblk on your system, that is compatible with simple setups?

So what could the replacement of following be:

rootdev=$(lsblk -pilno name,type,mountpoint | grep -G 'part /$')
rootdev=${rootdev%% *}
ericwoud commented 1 year ago

From the build script rootdev and pkroot is only used to prevent the user from formatting their own root.

You could just edit the script and remove the parts with rootdev and pkroot.

ericwoud commented 1 year ago

Closed with merging pull request