For many years now, one linux fedora server I maintain had issues with every dnf upgrade that involved a new kernel. It would not place configuration information into boot/grub2/grub.cfg and would not boot into the new kernel. One had to run this command to make it work:
root@S888:/n # grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file …
Found linux image: /boot/vmlinuz-4.19.9-300.fc29.i686
Found linux image: /boot/vmlinuz-4.19.8-300.fc29.i686
Found linux image: /boot/vmlinuz-4.19.6-300.fc29.i686
Found linux image: /boot/vmlinuz-4.19.5-300.fc29.i686
Found linux image: /boot/vmlinuz-4.19.4-300.fc29.i686
Found linux image: /boot/vmlinuz-0-rescue-25947e2761f2405084e99e0c2a4ea14f
Found initrd image: /boot/initramfs-0-rescue-25947e2761f2405084e99e0c2a4ea14f.img
device-mapper: reload ioctl on osprober-linux-sda3 failed: Device or resource busy
Command failed.
Even though the command failed, it did work and would reboot on command into the new kernel. The issue seemed to be with /dev/sda3 which is the root directory.
[root@S888 etc]$ cat fstab
# device-spec mount-point fs-type options dump pass
#dump seldom used=0 pass 0=donotcheck 1=1st 2=2nd
/dev/sda1 /boot ext4 defaults 0 1
/dev/sda2 swap swap defaults 0 0
/dev/sda3 / ext4 defaults 0 1
#sda4 is extended partition
/dev/sda5 /home ext4 defaults 0 2
/dev/sda6 /web ext4 defaults 0 2
#
/dev/sdb1 /mnt/backup ext4 defaults 0 2
I think today we may have fixed this.
root@S888:/etc # os-prober
device-mapper: reload ioctl on osprober-linux-sda3 failed: Device or resource busy
Command failed.
vi /etc/default/grub and add line
GRUB_DISABLE_OS_PROBER=true
root@S888:/etc/default # grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file …
Found linux image: /boot/vmlinuz-4.19.9-300.fc29.i686
Found linux image: /boot/vmlinuz-4.19.8-300.fc29.i686
Found linux image: /boot/vmlinuz-4.19.6-300.fc29.i686
Found linux image: /boot/vmlinuz-4.19.5-300.fc29.i686
Found linux image: /boot/vmlinuz-4.19.4-300.fc29.i686
Found linux image: /boot/vmlinuz-0-rescue-25947e2761f2405084e99e0c2a4ea14f
Found initrd image: /boot/initramfs-0-rescue-25947e2761f2405084e99e0c2a4ea14f.img
done
No errors! Should be fixed!
reboot
It rebooted correctly. The true test will be the next kernel update…
In the meantime we can manually remove some of the older kernels:
root@S888:/boot # dnf remove kernel-core-4.19.4
root@S888:/boot # dnf remove kernel-core-4.19.5
After this, an inspection of grub.cfg shows that these two entries have indeed been removed!