DNF Upgrade empties GRUB menu

[moksh@resolve ~]$ sudo efibootmgr -v
EFI variables are not supported on this system.

Therefore, your system loads in legacy mode.
You should have

  • Nothing in /boot/efi/EFI/rocky
  • Actual GUB config as file /boot/grub2/grub.cfg
  • The /etc/grub2.cfg as symlink that points to /boot/grub2/grub.cfg

Thank you for the clarification. Unfortunately that just brings me back to where I was before, with a dangling link.

[moksh@resolve ~]$ sudo ln -sfv /boot/grub2/grub.cfg /etc/grub2.cfg
'/etc/grub2.cfg' -> '/boot/grub2/grub.cfg'
[moksh@resolve ~]$ symlinks -v /etc | grep grub
dangling: /etc/grub2.cfg -> /boot/grub2/grub.cfg

I’ll be sure to get the contents of /boot/loader/entries when there is another kernel upgrade.

sudo ls -ltr /boot/loader/entries/
total 16
-rw-r--r--. 1 root root 421 Apr 17 23:07 82a24f939aa14e6da0b496ef749bc8bd-0-rescue.conf
-rw-r--r--. 1 root root 402 Apr 17 23:12 82a24f939aa14e6da0b496ef749bc8bd-4.18.0-553.47.1.el8_10.x86_64.conf
-rw-r--r--. 1 root root 402 May  6 14:46 82a24f939aa14e6da0b496ef749bc8bd-4.18.0-553.50.1.el8_10.x86_64.conf
-rw-r--r--. 1 root root 374 May  6 14:51 82a24f939aa14e6da0b496ef749bc8bd-4.18.0-553.51.1.el8_10.x86_64.conf

Which does say that there is no such file (/boot/grub2/grub.cfg).

There definitely should be files in /boot/grub2/, since you boot with legacy mode.
Is there?

There are

[moksh@resolve ~]$ sudo ls /boot/grub2/
device.map  fonts  grub.cfg  grub.cfg.rpmsave  grubenv	i386-pc

So since /boot/grub2/grub.cfg exists, the symlink cannot be dangling.

Does this mean symlinks -v /etc | grep grub is giving me a false result? It still says dangling: /etc/grub2.cfg -> /boot/grub2/grub.cfg

Mine reports this:

root@rocky9:~# symlinks -v /etc | grep grub
relative: /etc/grub2.cfg -> ../boot/grub2/grub.cfg
relative: /etc/grub2-efi.cfg -> ../boot/grub2/grub.cfg

To be honest we have no idea what you did to your system. You tried so many things, changing so many things, it’s no longer standard.

You would probably be better reinstallig your system and then just leave it. I’ve no idea how you managed to get it in this state.

1 Like

Maybe this is the reason:

In your original message where you reported the dangling symlink, you did NOT ran this as root (no sudo).
Therfore it could not find the link target and reported dangling (misleading)

If I run ls /boot/grub2/ as non root, I get
ls: cannot open directory '/boot/grub2/': Permission denied

Remark: This is just a wild guess. I am on Fedora and there, symlinks behaves differently.

Yes, but:

[me]$ symlinks /etc/grub2.cfg 
/boot/grub2/grub.cfg: Permission denied
other_fs: /etc/grub2.cfg -> ../boot/grub2/grub.cfg

[root]# symlinks /etc/grub2.cfg
other_fs: /etc/grub2.cfg -> ../boot/grub2/grub.cfg

The symlinks does not say “dangling”. It says “Permission denied”?

Here is the result with sudo incase it is helpful

[moksh@resolve ~]$ sudo symlinks -v /etc | grep grub
other_fs: /etc/grub2.cfg -> /boot/grub2/grub.cfg

[moksh@resolve ~]$ sudo ls /boot/grub2/
device.map  fonts  grub.cfg  grub.cfg.rpmsave  grubenv	i386-pc

So today the file exists (and symlink does not dangle). Good.

Next:

sudo ls -ltr /boot/grub2/

Why?
There is file grub.cfg.rpmsave. When was it created and when was the grub.cfg created/modified?
The ls long format, sorted by time (reverse) for convenience, shows date and size of the files.


When package update would replace a modified config file “X”, there are three options:

  • Just replace the X. The modifications are lost
  • Rename old X → X.rpmsave and add new X. New config got into use, but we have copy of the old
  • Keep X and add new version as X.rpmnew. Use of old, modified continues, but we can see the new defaults from the X.rpmnew

In principle, the grub.cfg is always created with grub2-mkconfig so package update ought to not touch it – I don’t know what creates the grub.cfg.rpmsave nor whether that matters.

On rocky 9 maybe, but on rocky8 it says dangling. I just fired up a rocky8 VM and here is the proof:

[root@oscpu1 ~]# symlinks /etc | grep grub
other_fs: /etc/grub2.cfg -> ../boot/grub2/grub.cfg
[root@oscpu1 ~]# su -s /bin/bash  postfix
bash-4.4$ symlinks /etc | grep grub
dangling: /etc/grub2.cfg -> ../boot/grub2/grub.cfg

… and as a reference:


[root@oscpu1 ~]# rpm -q symlinks 
symlinks-1.4-19.el8.x86_64
[root@oscpu1 ~]# symlinks --version
symlinks: scan/change symbolic links - v1.3 - by Mark Lord

Usage:  symlinks [-cdorstv] dirlist

Flags:  -c == change absolute/messy links to relative
        -d == delete dangling links
        -o == warn about links across file systems
        -r == recurse into subdirs
        -s == shorten lengthy links (displayed in output only when -c not specified)
        -t == show what would be done by -c
        -v == verbose (show all symlinks)
[moksh@resolve ~]$ sudo ls -ltr /boot/grub2/
total 44
-rw-r--r--. 1 root root   68 Mar  4 11:46 device.map
drwxr-xr-x. 2 root root   25 Mar  4 11:46 fonts
drwxr-xr-x. 2 root root 8192 Mar  4 11:46 i386-pc
-rw-------. 1 root root 8962 Apr  7 21:23 grub.cfg.rpmsave
-rw-------. 1 root root 8833 May 11 13:49 grub.cfg
-rw-------. 1 root root 1024 May 20 21:51 grubenv