egara / buttermanager

ButterManager is a BTRFS tool for managing snapshots, balancing filesystems and upgrading the system safetly.
GNU General Public License v3.0
129 stars 6 forks source link

Not working anymore after GRUB update #47

Closed haivala closed 2 years ago

haivala commented 2 years ago

I'm getting this message: You have booted into an alternative snapshot. Do you want to consolidate it as your default

I'm not actually totally sure how I ended up with this problem. I'll try to explain. first GRUB updated to new version and it did not work anymore (boot loop) so I booted up arch install usb and copied /boot/ from older snapshot to the active one. Then I was able to boot again. Then I loaded older snapshot to get everything like it was before the GRUB problem.

Next I had to run grub-install and grub-mkconfig to get the new version of GRUB working but now even if boot any snapshot or the active one buttermanager is always saying that message and consolidation does nothing.

Any tips how to fix this? I don't need my old snapshots.

egara commented 2 years ago

Hi @haivala

I think this issue is not related to ButterManager (there are some issues reported in Arch here and in EndeavourOS here) but maybe I can help you. Please, attach the output of these commands:

Thanks! :)

haivala commented 2 years ago

sudo btrfs subvolume list /

ID 256 gen 5804727 top level 5 path _active
ID 258 gen 5805855 top level 256 path _active/homevol
ID 259 gen 5805855 top level 256 path _active/tmp
ID 260 gen 5804550 top level 5 path _snapshots
ID 3740 gen 5782235 top level 260 path _snapshots/root-20220804-0
ID 3741 gen 5782235 top level 260 path _snapshots/home-20220804-0
ID 3752 gen 5804727 top level 260 path _snapshots/root-20220814-0
ID 3753 gen 5782235 top level 260 path _snapshots/home-20220814-0
ID 3756 gen 5805855 top level 260 path _snapshots/root-20220818-0
ID 3757 gen 5782235 top level 260 path _snapshots/home-20220818-0
ID 3759 gen 5804615 top level 260 path _snapshots/root-20220822-0
ID 3760 gen 5782235 top level 260 path _snapshots/home-20220822-0
ID 3761 gen 5804542 top level 260 path _snapshots/root-20220822-1
ID 3762 gen 5782235 top level 260 path _snapshots/home-20220822-1
ID 3790 gen 5804727 top level 260 path _snapshots/root-20220828-0
ID 3791 gen 5800170 top level 260 path _snapshots/home-20220828-0
ID 3794 gen 5804727 top level 260 path _snapshots/root-20220829-0
ID 3795 gen 5800455 top level 260 path _snapshots/home-20220829-0
ID 3803 gen 5804727 top level 260 path _snapshots/root-20220831-0
ID 3804 gen 5804547 top level 260 path _snapshots/home-20220831-0
ID 3814 gen 5804727 top level 256 path _active/rootvol
~  sudo cat /etc/fstab                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               08/31/22 11:05:47
# /dev/nvme0n1p2 LABEL=arch
UUID=fa609ace-ea3a-4052-88cb-1c9669b70e2c   /           btrfs       rw,relatime,compress=lzo,ssd,discard,autodefrag,space_cache,subvolid=257,subvol=/_snapshots/root-20220818-0,subvol=_snapshots/root-20220818-0   0 0

# /dev/nvme0n1p1
UUID=CA8C-A32C          /boot/efi   vfat        rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro   0 2

# /dev/nvme0n1p2 LABEL=arch
UUID=fa609ace-ea3a-4052-88cb-1c9669b70e2c   /tmp        btrfs       rw,relatime,compress=lzo,ssd,discard,autodefrag,space_cache,subvolid=259,subvol=/_active/tmp,subvol=_active/tmp 0 0

# /dev/nvme0n1p2 LABEL=arch
UUID=fa609ace-ea3a-4052-88cb-1c9669b70e2c   /home       btrfs       rw,relatime,compress=lzo,ssd,discard,autodefrag,space_cache,subvolid=258,subvol=/_active/homevol,subvol=_active/homevol 0 0

# /dev/nvme0n1p2 LABEL=arch
UUID=fa609ace-ea3a-4052-88cb-1c9669b70e2c   /mnt/defvol btrfs       rw,relatime,compress=lzo,ssd,discard,autodefrag,space_cache,subvolid=5,subvol=/ 0 0

~  sudo mount                                                                                                                                                            08/31/22 11:06:04
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=32872224k,nr_inodes=8218056,mode=755,inode64)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755,inode64)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
/dev/nvme0n1p2 on / type btrfs (rw,relatime,compress=lzo,ssd,discard,space_cache,autodefrag,subvolid=3756,subvol=/_snapshots/root-20220818-0)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=31334)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
/dev/nvme0n1p2 on /mnt/defvol type btrfs (rw,relatime,compress=lzo,ssd,discard,space_cache,autodefrag,subvolid=5,subvol=/)
/dev/nvme0n1p2 on /home type btrfs (rw,relatime,compress=lzo,ssd,discard,space_cache,autodefrag,subvolid=258,subvol=/_active/homevol)
/dev/nvme0n1p2 on /tmp type btrfs (rw,relatime,compress=lzo,ssd,discard,space_cache,autodefrag,subvolid=259,subvol=/_active/tmp)
/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)

 ~  cat ~/.buttermanager/buttermanager.yaml                                                                                                                               08/31/22 11:06:32
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: ~/.buttermanager/buttermanager.yaml
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ aur_repository: 1
   2   │ check_at_startup: 0
   3   │ grub_btrfs: 1
   4   │ path_to_consolidate_root_snapshot: _active/rootvol
   5   │ save_log: 1
   6   │ snap_packages: 0
   7   │ subvolumes_dest: /mnt/defvol/_snapshots/|/mnt/defvol/_snapshots/
   8   │ subvolumes_orig: /mnt/defvol/_active/rootvol/|/mnt/defvol/_active/homevol/
   9   │ subvolumes_prefix: root|home
  10   │ subvolumes_snapshots_to_keep: 8|8
egara commented 2 years ago

Ok, I'm going to detail the consolidation process in order to execute it by hand instead of using ButterManager. Doing this process the last active rootvol will be removed and instead, you will consolidate /_snapshots/root-20220818-0 snapshot, which is the snapshot in wich the system is booting by default right now. This process won't be reversible.

1- Delete the active rootvol:

    sudo btrfs subvolume delete /mnt/defvol/_active/rootvol

2- Create a new active rootvol based on the snapshot in which the system has booted up:

    sudo btrfs subvolume snapshot /mnt/defvol/_snapshots/root-20220818-0 /mnt/defvol/_active/rootvol

3- Edit /mnt/defvol/_active/rootvol and substitute UUID=fa609ace-ea3a-4052-88cb-1c9669b70e2c / line with:

    UUID=fa609ace-ea3a-4052-88cb-1c9669b70e2c   /           btrfs       subvol=/_active/rootvol,rw,relatime,compress=lzo,ssd,discard,autodefrag,space_cache 0 0

4- Regenerate grub

    sudo -S grub-mkconfig -o /boot/grub/grub.cfg

5- Restart the system. Now, if you execute sudo mount you should see this line:

    /dev/nvme0n1p2 on / type btrfs (rw,relatime,compress=lzo,ssd,discard,space_cache,autodefrag,subvolid=3756,subvol=/_active/rootvol)

And the execution of ButterManager should be normal again because it will detect that the system has booted into the active rootvol.

I hope this helps!

haivala commented 2 years ago

Thank you for this help! I'm sorry to say it did not work but it got me in the right track.

Thing was that I had run the grub-install when I had booted the snapshot and (probably not) activated it. That modified the first grub.cfg entry to use the snapshot. What I needed to do was load the "active" snapshot and then I ran the grub-install again to modify the grub.cfg and then use it with grub-mkconfig.

Now everything is working like it should. Lesson learnt: When you have loaded snapshot don't run grub-install and fstab entries did nothing.

Thank you again!

egara commented 2 years ago

Hi @haivala

And thank you for sharing the solution. You are totally right. I was assuming that you were selecting /_snapshots/root-20220818-0 in GRUB menu, so the "default" subvolume for GRUB would be still _active/rootvol.

I'm very happy that you could solve this problem. I close the issue then :)