You are not logged in.

#1 2019-09-17 17:47:55

krypt
Member
Registered: 2016-05-15
Posts: 26

[SOLVED] After kernel update system boots the old kernel and fails

I am using Arch linux on an old Sony Vaio laptop. It all started a few days ago when I accidentally hit the Vaio button when the laptop was shutdown, which takes you to a rescue menu. I chose "Boot Windows" option from the menu to go on with the boot process but it must have overwritten grub because I was greeted with an "Operating system not found" error. At this point I have used Arch live usb disk to install grub again. I've got the grub menu back except it booted and older kernel and failed to load modules (vfat particularly) and failed to mount /boot/efi. A simple pacman -S linux fixed it. Now after a new kernel update, I was faced with the same "Failed to mount /boot/efi" error. I had to boot the live disk again and copy the initrams images and vmlinux from /boot into /boot/efi manually to fix this. I have obviously messed something up during reinstalling grub. How can I fix this so I don't have to manually copy the initrams images after every kernel update?

I am using UEFI and below are fstab and grub.cfg files.

fstab

    # <file system> <dir> <type> <options> <dump> <pass>
    # /dev/sda2
    UUID=73327872-0e9e-4ab4-bbe7-ef83ee5b747f       /               ext4            rw,relatime     0 1
    
    # /dev/sda1
    UUID=B7F3-FCF5          /boot/efi       vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro       0 2
    
    # /dev/sda4
    UUID=12f8cdba-b213-4c02-9a7e-17812aecab86       /home           ext4            rw,relatime     0 2
    
    # /dev/sda3
    UUID=fc23095a-cee0-4abd-a7d4-f348af7a6d1c       none            swap            defaults,pri=-2 0 0

grub.cfg

    #
    # DO NOT EDIT THIS FILE
    #
    # It is automatically generated by grub-mkconfig using templates
    # from /etc/grub.d and settings from /etc/default/grub
    #
    
    ### BEGIN /etc/grub.d/00_header ###
    insmod part_gpt
    insmod part_msdos
    if [ -s $prefix/grubenv ]; then
      load_env
    fi
    if [ "${next_entry}" ] ; then
       set default="${next_entry}"
       set next_entry=
       save_env next_entry
       set boot_once=true
    else
       set default="0"
    fi
    
    if [ x"${feature_menuentry_id}" = xy ]; then
      menuentry_id_option="--id"
    else
      menuentry_id_option=""
    fi
    
    export menuentry_id_option
    
    if [ "${prev_saved_entry}" ]; then
      set saved_entry="${prev_saved_entry}"
      save_env saved_entry
      set prev_saved_entry=
      save_env prev_saved_entry
      set boot_once=true
    fi
    
    function savedefault {
      if [ -z "${boot_once}" ]; then
        saved_entry="${chosen}"
        save_env saved_entry
      fi
    }
    
    function load_video {
      if [ x$feature_all_video_module = xy ]; then
        insmod all_video
      else
        insmod efi_gop
        insmod efi_uga
        insmod ieee1275_fb
        insmod vbe
        insmod vga
        insmod video_bochs
        insmod video_cirrus
      fi
    }
    
    if [ x$feature_default_font_path = xy ] ; then
       font=unicode
    else
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos2'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  73327872-0e9e-4ab4-bbe7-ef83ee5b747f
    else
      search --no-floppy --fs-uuid --set=root 73327872-0e9e-4ab4-bbe7-ef83ee5b747f
    fi
        font="/usr/share/grub/unicode.pf2"
    fi
    
    if loadfont $font ; then
      set gfxmode=auto
      load_video
      insmod gfxterm
      set locale_dir=$prefix/locale
      set lang=en_US
      insmod gettext
    fi
    terminal_input console
    terminal_output gfxterm
    if [ x$feature_timeout_style = xy ] ; then
      set timeout_style=menu
      set timeout=5
    # Fallback normal timeout code in case the timeout_style feature is
    # unavailable.
    else
      set timeout=5
    fi
    ### END /etc/grub.d/00_header ###
    
    ### BEGIN /etc/grub.d/10_linux ###
    menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-73327872-0e9e-4ab4-bbe7-ef83ee5b747f' {
    	load_video
    	set gfxpayload=keep
    	insmod gzio
    	insmod part_msdos
    	insmod ext2
    	set root='hd0,msdos2'
    	if [ x$feature_platform_search_hint = xy ]; then
    	  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  73327872-0e9e-4ab4-bbe7-ef83ee5b747f
    	else
    	  search --no-floppy --fs-uuid --set=root 73327872-0e9e-4ab4-bbe7-ef83ee5b747f
    	fi
    	echo	'Loading Linux linux ...'
    	linux	/boot/vmlinuz-linux root=UUID=73327872-0e9e-4ab4-bbe7-ef83ee5b747f rw i8042.direct i8042.dumbkbd quiet acpi_backlight=vendor
    	echo	'Loading initial ramdisk ...'
    	initrd	/boot/intel-ucode.img /boot/initramfs-linux.img
    }
    submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-73327872-0e9e-4ab4-bbe7-ef83ee5b747f' {
    	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-73327872-0e9e-4ab4-bbe7-ef83ee5b747f' {
    		load_video
    		set gfxpayload=keep
    		insmod gzio
    		insmod part_msdos
    		insmod ext2
    		set root='hd0,msdos2'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  73327872-0e9e-4ab4-bbe7-ef83ee5b747f
    		else
    		  search --no-floppy --fs-uuid --set=root 73327872-0e9e-4ab4-bbe7-ef83ee5b747f
    		fi
    		echo	'Loading Linux linux ...'
    		linux	/boot/vmlinuz-linux root=UUID=73327872-0e9e-4ab4-bbe7-ef83ee5b747f rw i8042.direct i8042.dumbkbd quiet acpi_backlight=vendor
    		echo	'Loading initial ramdisk ...'
    		initrd	/boot/intel-ucode.img /boot/initramfs-linux.img
    	}
    	menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-73327872-0e9e-4ab4-bbe7-ef83ee5b747f' {
    		load_video
    		set gfxpayload=keep
    		insmod gzio
    		insmod part_msdos
    		insmod ext2
    		set root='hd0,msdos2'
    		if [ x$feature_platform_search_hint = xy ]; then
    		  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  73327872-0e9e-4ab4-bbe7-ef83ee5b747f
    		else
    		  search --no-floppy --fs-uuid --set=root 73327872-0e9e-4ab4-bbe7-ef83ee5b747f
    		fi
    		echo	'Loading Linux linux ...'
    		linux	/boot/vmlinuz-linux root=UUID=73327872-0e9e-4ab4-bbe7-ef83ee5b747f rw i8042.direct i8042.dumbkbd quiet acpi_backlight=vendor
    		echo	'Loading initial ramdisk ...'
    		initrd	/boot/initramfs-linux-fallback.img
    	}
    }
    
    ### END /etc/grub.d/10_linux ###
    
    ### BEGIN /etc/grub.d/20_linux_xen ###
    ### END /etc/grub.d/20_linux_xen ###
    
    ### BEGIN /etc/grub.d/30_os-prober ###
    ### END /etc/grub.d/30_os-prober ###
    
    ### BEGIN /etc/grub.d/40_custom ###
    # This file provides an easy way to add custom menu entries.  Simply type the
    # menu entries you want to add after this comment.  Be careful not to change
    # the 'exec tail' line above.
    ### END /etc/grub.d/40_custom ###
    
    ### BEGIN /etc/grub.d/41_custom ###
    if [ -f  ${config_directory}/custom.cfg ]; then
      source ${config_directory}/custom.cfg
    elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
      source $prefix/custom.cfg;
    fi
    ### END /etc/grub.d/41_custom ###

Last edited by krypt (2019-10-05 02:55:37)

Offline

#2 2019-09-17 19:10:40

Swiggles
Member
Registered: 2014-08-02
Posts: 266

Re: [SOLVED] After kernel update system boots the old kernel and fails

I assume /boot is on root, because I cannot find it in your fstab. I would propose to reinstall grub after a cleanup:

efibootmgr
# Find the old grub entry and do some cleanup (you need the 4 digits after "Boot" which will be XXXX in the next command)
efibootmgr -Bb XXXX
# Repeat for any entries you would like to remove, cleanup while you are at it :-)
grub-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

Now check if it everything looks alright and reboot. I suspect the issue is either some weirdly configured entry or the grub.cfg was not recreated properly.
I hope this helps and gets your system back up and running!

Offline

#3 2019-10-04 22:39:42

krypt
Member
Registered: 2016-05-15
Posts: 26

Re: [SOLVED] After kernel update system boots the old kernel and fails

Swiggles wrote:

I assume /boot is on root, because I cannot find it in your fstab. I would propose to reinstall grub after a cleanup:

efibootmgr
# Find the old grub entry and do some cleanup (you need the 4 digits after "Boot" which will be XXXX in the next command)
efibootmgr -Bb XXXX
# Repeat for any entries you would like to remove, cleanup while you are at it :-)
grub-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

Now check if it everything looks alright and reboot. I suspect the issue is either some weirdly configured entry or the grub.cfg was not recreated properly.
I hope this helps and gets your system back up and running!

Sorry, I got caught up in things and completely forgot about this thread.

Anyway, thank you very much! This solved my problem.  I did actually install grub again but I must have messed up the arguments. I am not very familiar with it.

Offline

Board footer

Powered by FluxBB