Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] BTRFS subvolume setup not booting correctly
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
imieinazwisko
n00b
n00b


Joined: 13 Feb 2020
Posts: 54

PostPosted: Tue Jan 09, 2024 11:42 pm    Post subject: [SOLVED] BTRFS subvolume setup not booting correctly Reply with quote

I have a currently working install of Gentoo, I'm working to transfer that installation to a new nvme drive that I setup with BTRFS subvolumes. I'm using a combination of the Handbook for partitioning and openSUSE style subvolumes. I used rsync to transfer everything from the old drive to the new drive. My partition setup is here and my subvolume setup is here. My old nvme is labled
Code:
nvme1n1
and has three partitions: boot (vfat), swap, and everything else. My new nvme is
Code:
nvme0n1
and two partitions boot (vfat) and everything else (I'll use a swap file).

My problem is my root folder is still being mounted from
Code:
nvme1n1p3
instead of
Code:
nvme0n1p2
. All the other folders though are being mounted from
Code:
nvme0n1p2
like they should. My fstab has all the old paritions commented out with the new ones at the top. I've re-run
Code:
grub-mkconfig -o /boot/grub/grub.cfg
several times but somehow it keeps finding the old root folder link. I verified this by running
Code:
df
in a few different folders with the output below:
Code:

$ df /
Filesystem     1K-blocks      Used Available Use% Mounted on
/dev/nvme1n1p3 997582148 634799620 358295804  64% /

$ df /boot
Filesystem     1K-blocks  Used Available Use% Mounted on
/dev/nvme0n1p1   1046512 15868   1030644   2% /boot

$ df /home
Filesystem      1K-blocks      Used  Available Use% Mounted on
/dev/nvme0n1p2 1952464896 686993256 1263209880  36% /home


I'm hoping soeone can help me spot my error and get everything mounted and running from the new drive.


Last edited by imieinazwisko on Sun Jan 14, 2024 7:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 374

PostPosted: Wed Jan 10, 2024 9:20 am    Post subject: Reply with quote

Chroot into the new "location" and do grub-install and grub-mkconfig from inside the chroot.
Back to top
View user's profile Send private message
imieinazwisko
n00b
n00b


Joined: 13 Feb 2020
Posts: 54

PostPosted: Sat Jan 13, 2024 6:20 pm    Post subject: Reply with quote

I ran it from chroot and it changed things, but I'm still not getting a boot.

Code:
error: file `/@/.snapshots/1/snapshot/boot/grub/x86_64-efi/normal.mod` not found
Entering rescue mode. . .
grub rescue>


When I mount the boot partition to /boot normal.mod is in the expected location.

Here's my current fstab:
Code:

UUID=79b141d6-4d0a-4993-8df2-cf648c27ac66          /               btrfs           defaults     0 0
UUID=79b141d6-4d0a-4993-8df2-cf648c27ac66          /tmp            btrfs           rw,relatime,ssd,space_cache=v2,subvolid=272,subvol=/@/tmp       0 0
UUID=79b141d6-4d0a-4993-8df2-cf648c27ac66          /boot/grub/x86_64-efi   btrfs           rw,relatime,ssd,space_cache=v2,subvolid=266,subvol=/@/boot/grub/x86_64-efi      0 0
UUID=6741-10B1          /boot            vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro        0 2
UUID=79b141d6-4d0a-4993-8df2-cf648c27ac66          /home           btrfs           rw,relatime,ssd,space_cache=v2,subvolid=267,subvol=/@/home      0 0
UUID=79b141d6-4d0a-4993-8df2-cf648c27ac66          /home/steve/SIOSTRA     btrfs           rw,relatime,ssd,space_cache=v2,subvolid=277,subvol=/@/home/steve/SIOSTRA        0 0
UUID=79b141d6-4d0a-4993-8df2-cf648c27ac66          /opt            btrfs           rw,relatime,ssd,space_cache=v2,subvolid=269,subvol=/@/opt       0 0
UUID=79b141d6-4d0a-4993-8df2-cf648c27ac66          /root           btrfs           rw,relatime,ssd,space_cache=v2,subvolid=270,subvol=/@/root      0 0
UUID=79b141d6-4d0a-4993-8df2-cf648c27ac66          /srv            btrfs           rw,relatime,ssd,space_cache=v2,subvolid=271,subvol=/@/srv       0 0
UUID=79b141d6-4d0a-4993-8df2-cf648c27ac66          /usr/local      btrfs           rw,relatime,ssd,space_cache=v2,subvolid=273,subvol=/@/usr/local 0 0
UUID=79b141d6-4d0a-4993-8df2-cf648c27ac66          /var            btrfs           rw,relatime,ssd,space_cache=v2,subvolid=274,subvol=/@/var       0 0
UUID=79b141d6-4d0a-4993-8df2-cf648c27ac66          /mnt            btrfs           rw,relatime,ssd,space_cache=v2,subvolid=275,subvol=/@/mnt       0 0
UUID=79b141d6-4d0a-4993-8df2-cf648c27ac66          /media          btrfs           rw,relatime,ssd,space_cache=v2,subvolid=276,subvol=/@/media     0 0
UUID=79b141d6-4d0a-4993-8df2-cf648c27ac66          /.snapshots     btrfs           rw,relatime,ssd,space_cache=v2,subvolid=264,subvol=/@/.snapshots        0 0
UUID=6788235f-2c63-426f-bf3f-03d64d66f47a /mnt/SLON     auto   users,rw,noatime                                                        0 0
UUID=085E75885E756F76                     /mnt/WIELORYB auto   users,rw,noatime                                                        0 0
tmpfs                                    /var/tmp/portage      tmpfs   size=24G,uid=portage,gid=portage,mode=775,noatime              0 0
proc                                      /proc     proc     nosuid,nodev,noexec,hidepid=2,gid=wheel                                   0 0
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 374

PostPosted: Sun Jan 14, 2024 12:00 pm    Post subject: Reply with quote

Your boot fails at the bootloader stage and your fstab is not relevant (fstab will be loaded later). And your fstab looks horrible with nested mounts (that is an opinion). I am not sure, if this will work as expected because I do not know, whether /boot is mounted before or after /boot/grub/x86_64-efi.

It is also questionable, why you are using the ESP as /boot and for nearly every other directory in / you have created a subvolume. Why not using either a separate /boot or a /boot subvolume and mount the ESP to /efi (to avoid nested mounting)?

Your Grub error message indicates also, that the chroot environment was setup incorrectly.
Back to top
View user's profile Send private message
imieinazwisko
n00b
n00b


Joined: 13 Feb 2020
Posts: 54

PostPosted: Sun Jan 14, 2024 3:36 pm    Post subject: Reply with quote

sMueggli wrote:
Your boot fails at the bootloader stage and your fstab is not relevant (fstab will be loaded later). And your fstab looks horrible with nested mounts (that is an opinion). I am not sure, if this will work as expected because I do not know, whether /boot is mounted before or after /boot/grub/x86_64-efi.

It is also questionable, why you are using the ESP as /boot and for nearly every other directory in / you have created a subvolume. Why not using either a separate /boot or a /boot subvolume and mount the ESP to /efi (to avoid nested mounting)?

Your Grub error message indicates also, that the chroot environment was setup incorrectly.


I agree the fstab looks bad, I've been using Gentoo for a while and have always written my own in the past. I decided to learn BTRFS and snapshots. I feel completely over my head with it though and started using genfstab. I think the nested mounts though are what is causing the problem, like you're suggesting. My lack of understanding of snapshots and BTRFS in general is what led to it. I'm trying to use subvolumes to keep directories out of snapshots but what I failed to realize is if a drive isn't even formatted as BTRFS (/boot for example) then a snapshot can't be created anyways, so no subvolume needed.

What about the Grub error suggests chroot was setup incorrectly? I just mount my / partition to /mnt/gentoo from the live USB and then run arch-chroot. It looks like arch-chroot is a somewhat new capability. In the past I would manually mount all the necessary file systems before chrooting.

Thanks for chiming in!
Back to top
View user's profile Send private message
imieinazwisko
n00b
n00b


Joined: 13 Feb 2020
Posts: 54

PostPosted: Sun Jan 14, 2024 7:55 pm    Post subject: Reply with quote

Solved! The problem was the nested mounts. Boot partitions and sub-volumes make a lot more sense now. Thanks for the help!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum