2

I tried to upgrade the Kernel using YUM and when I ran

[root@AFIBAMBOO bin]# grub2-mkconfig -o /boot/grub2/grub.cfg
No path or device is specified. 
Usage: grub2-probe [OPTION...] [OPTION]... [PATH|DEVICE] 
Try 'grub2-probe --help' or 'grub2-probe --usage' for more information.
No path or device is specified. Usage: grub2-probe [OPTION...] [OPTION]... [PATH|DEVICE] 
Try 'grub2-probe --help' or 'grub2-probe --usage' for more information. 
No path or device is specified. Usage: grub2-probe [OPTION...] [OPTION]... [PATH|DEVICE] 
Try 'grub2-probe --help' or 'grub2-probe --usage' for more information.
0

BTW

The problem has been solved in AskUbuntu S&E and it introduces grub2-probe because grub.cfg after kernel updating scripts being broken.

Review your grub.cfg for lost indent and repeat grub2-mkconfig.


Detailed description about updating kernel via yum:

CentOS distributes kernel via RPM packages and stores it in own repository.

When you work with repository you install/remove/reinstall ... RPM packages.

RPM packages that stores kernel has postinst and posttrans sections that do all necessary steps to adopt new kernel in CentOS. This steps include several important things like initramfs generation, set new entries in bootloader ...

Lets see in 3.10.0-957.el7.x86_64.rpm postinstall sections:

postinst:

/usr/sbin/new-kernel-pkg --package kernel --install 3.10.0-957.el7.x86_64 || exit $?

posttrans:

if [ -x /usr/sbin/weak-modules ]
then
    /usr/sbin/weak-modules --add-kernel 3.10.0-957.el7.x86_64 || exit $?
fi
/usr/sbin/new-kernel-pkg --package kernel --mkinitrd --dracut --depmod --update 3.10.0-957.el7.x86_64
rc=$?
if [ $rc != 0 ]; then
    /usr/sbin/new-kernel-pkg --remove 3.10.0-957.el7.x86_64
    ERROR_MSG="ERROR: installing kernel-3.10.0-957.el7.x86_64: no space left for creating initramfs. Clean up /boot partition and re-run '/usr/sbin/new-kernel-pkg --package kernel --mkinitrd --dracut --depmod --install 3.10.0-957.el7.x86_64'"
    if [ -e /usr/bin/logger ]; then
        /usr/bin/logger -p syslog.warn "$ERROR_MSG"
    elif [ -e /usr/bin/cat ]; then
        /usr/bin/cat "$ERROR_MSG" > /dev/kmsg
    fi
    echo "$ERROR_MSG"
    exit $rc
fi
/usr/sbin/new-kernel-pkg --package kernel --rpmposttrans 3.10.0-957.el7.x86_64 || exit $?

These postinstall scripts using new-kernel-pkg script which is the part of grubby project. man 8 new-kernel-prkg writes:

Description

new-kernel-pkg is a tool used in packaging to automate the installation of a new kernel, including the creation of an initial ram filesystem image, updating of bootloader configuration, and other associated tasks

new-kernel-pkg script calls grubby (it's program inside grubby project) to update bootloader configuration. From man 8 grubby:

Description

grubby is a command line tool for updating and displaying information about the configuration files for the grub, lilo, elilo (ia64), yaboot (powerpc) and zipl (s390) boot loaders. It is primarily designed to be used from scripts which install new kernels and need to find information about the current boot environment.

Fragment of calling grubby from new-kernel-pkg script:

ARGS="--grub2 -c $grub2Config --add-kernel=$kernelImage $INITRD \
                --copy-default --title \"$title\$debugtitle\" \
                ${mbkernel:+--add-multiboot=\"$mbkernel\"} \
                ${mbargs:+--mbargs=\"$mbargs\"} \
                --args=\"root=$rootdevice $kernargs \$debugargs\" \
                --remove-kernel=\"TITLE=$title\$debugtitle\""
        rungrubby ${ARGS} $makedefault

If you need to know more specific info about how bootloader configuration are being builded you can run new-kernel-pkg (involving neccessary kernel version and parameters) with verbose mode (-v option).


So, there is no necessary to call grub2-mkconfig manually after kernel updating.

  • 1
    Thanks for such a detailed answer. I now understand why it happened, but still not sure how to get out of GRUB shell now. Every time i boot, end up with GRUB console. – anwar ul hasan May 17 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.