Bug 1185490

Summary: No snapshots in GRUB boot menu
Product: [openSUSE] openSUSE Distribution Reporter: Ulrich Windl <Ulrich.Windl>
Component: BootloaderAssignee: YaST Team <yast-internal>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: aschnell, Ulrich.Windl
Version: Leap 15.2   
Target Milestone: ---   
Hardware: x86-64   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Trace output of /usr/lib/snapper/plugins/grub --refresh

Description Ulrich Windl 2021-04-30 07:47:40 UTC
I don't know what causes it, but after having made a configuration error, I realized that GRUB's boot menu does not offer the boot from any snapshots.

Maybe one of these cause it:
* Using secure boot
* Encrypting the PV of the system VG
* Using an NVME device

A /.snapshots/grub-snapshot.cfg exists, but the only entry basically is:
submenu "Not found" { true; }
Comment 1 Michael Chang 2021-05-13 03:54:53 UTC
Hi Ulrich,

Sorry for the late reply. Would you please attach the trace output of /usr/lib/snapper/plugins/grub --refresh ?

 bash -x /usr/lib/snapper/plugins/grub --refresh > grub-snapper-refresh.log 2>&1

Maybe the error caused some files not in place, like the /.snapshot is not mounted properly or snapshot's meta info is missing.

Thanks.
Comment 2 Michael Chang 2021-05-13 04:00:01 UTC
(In reply to Ulrich Windl from comment #0)

> Maybe one of these cause it:
> * Using secure boot

The snapshot booting works with secure boot.

> * Encrypting the PV of the system VG

It should work. unless you configure separate /boot for less password typing.

> * Using an NVME device

It works with NVME device.
Thanks.
Comment 3 Ulrich Windl 2021-05-17 06:23:31 UTC
Created attachment 849382 [details]
Trace output of /usr/lib/snapper/plugins/grub --refresh

(In reply to Michael Chang from comment #1)
> Sorry for the late reply. Would you please attach the trace output of
> /usr/lib/snapper/plugins/grub --refresh ?

The snapshots are definitely found:
e.g.:
+ snapshot=/.snapshots/101/snapshot
But still there are no snapshots in the boot menu.
Comment 4 Michael Chang 2021-05-17 07:27:13 UTC
From the log some files appear to be missing.

> '[' -r /.snapshots/124/info.xml -a -r /.snapshots/124/snapshot/boot/grub2/grub.cfg ']'

Would you please help to check if the files exist ? FWIW you can use the command to list them.  

> find /.snapshots/*/info.xml /.snapshots/*/snapshot/boot/grub2/grub.cfg

Thanks.
Comment 5 Ulrich Windl 2021-05-17 10:25:09 UTC
(In reply to Michael Chang from comment #4)
# find /.snapshots/*/info.xml /.snapshots/*/snapshot/boot/grub2/grub.cfg
/.snapshots/101/info.xml
/.snapshots/102/info.xml
/.snapshots/106/info.xml
/.snapshots/107/info.xml
/.snapshots/111/info.xml
/.snapshots/112/info.xml
/.snapshots/122/info.xml
/.snapshots/123/info.xml
/.snapshots/124/info.xml
/.snapshots/125/info.xml
/.snapshots/126/info.xml
/.snapshots/127/info.xml
/.snapshots/128/info.xml
/.snapshots/129/info.xml
/.snapshots/130/info.xml
/.snapshots/131/info.xml
/.snapshots/1/info.xml
/.snapshots/55/info.xml
/.snapshots/56/info.xml
/.snapshots/68/info.xml
/.snapshots/69/info.xml
find: ‘/.snapshots/*/snapshot/boot/grub2/grub.cfg’: No such file or directory
Comment 6 Michael Chang 2021-05-17 11:38:27 UTC
(In reply to Ulrich Windl from comment #5)
> (In reply to Michael Chang from comment #4)

> find: ‘/.snapshots/*/snapshot/boot/grub2/grub.cfg’: No such file or directory

The grub.cfg is missing in all snapshots so none is bootable, then it is understandable why no snapshot listed in boot menu.

What is the content of your /.snapshots/*/snapshot/ ? Does it contain /.snapshots/*/snapshot/boot ? Do you use separate boot partition ? It would be great if you could help to provide more info about the error you ran into and your system in general ...

Thanks.
Comment 7 Ulrich Windl 2021-05-17 12:38:46 UTC
(In reply to Michael Chang from comment #6)

> What is the content of your /.snapshots/*/snapshot/ ? Does it contain
> /.snapshots/*/snapshot/boot ? Do you use separate boot partition ? It would
> be great if you could help to provide more info about the error you ran into
> and your system in general ...

The snapshots contain a directory boot, but that is empty.
I have a separate /boot LV (in addition to the root LV.
Comment 8 Michael Chang 2021-05-17 12:56:05 UTC
(In reply to Ulrich Windl from comment #7)
> (In reply to Michael Chang from comment #6)

[snip]

> The snapshots contain a directory boot, but that is empty.
> I have a separate /boot LV (in addition to the root LV.

The /boot has to be the same btrfs subvolume as the root (/) so the boot related files like kernel/initrd and grub.cfg can be snapshotted. If you use separate /boot then you lost these boot related data in snapshots and certainly no bootable snapshot listed in grub boot menu.
Comment 9 Ulrich Windl 2021-05-18 05:41:49 UTC
AFAIR Yast insisted on having a separate /boot partition when installing. Despite of that having a /boot partition that is somewhat tradition.
Comment 10 Michael Chang 2021-05-18 08:39:00 UTC
(In reply to Ulrich Windl from comment #9)
> AFAIR Yast insisted on having a separate /boot partition when installing.
> Despite of that having a /boot partition that is somewhat tradition.

I think the purpose is to achieve one time password typing. Currently there's no solution to accomplish booting encrypted /boot with password typing less than two (once in bootloader, the other in initrd).

Sorry I have set this as feature, if you don't like the default then you could go for the custom steps.

Thanks.
Comment 11 Ulrich Windl 2021-05-20 06:40:56 UTC
I wonder (considering that /boot typically has a very low change rate) whether a separate snapshot of /boot couldn't be done to be used to boot an older version.
In many cases the old /boot is even more important than the old root.
Despite of that I'm wondering about "/boot/efi type vfat": That's also a separate filesystem that isn't snapshot-ted.
Comment 12 Ulrich Windl 2021-05-23 15:35:56 UTC
I'd wish thinks were as simple as: Configure snapshots for /boot, too in snapper, and everything else works automagically:
# snapper -c boot create-config /boot
# snapper list-configs
Config | Subvolume
-------+----------
boot   | /boot    
root   | /