You are not logged in.

#1 2017-02-18 04:22:59

WeeDram
Member
From: Vancouver, B.C., Canada
Registered: 2016-04-14
Posts: 91

grub-mkconfig caused Kernel Panic

I have an older Lenovo with two installations of Arch on the single hard drive. For the purpose of this post I will call the installations Archsda6 & Archsda2.
For Archsda6, sda6, sda7, sda5 are /, /home, /boot respectively.
The Archsda2 installation is on sda2.
Sda8 is swap.
I am using grub (not grub legacy) as my boot loader.

Both Archsda6 & Archsda2 had been working for over a month although every time I booted sda2, I got the message:

WARNING:
The root device is not configured read-write!
It may be fscked again later.

I ignored this message until yesterday but then I decided to try to fix it. Based on some old Arch forum threads and what I read in https://wiki.archlinux.org/index.php/Ke … eters#GRUB
I decided it might work to boot into Archsda2, edit /etc/default/grub as follows

GRUB_CMDLINE_LINUX_DEFAULT="rw quiet"

then  re-generate the grub.cfg file with

# grub-mkconfig -o /boot/grub/grub.cfg

I tried this several times but each time I rebooted Archsda2 I still got the same results as before: the error message came up but the boot was successful.
I then got the not-so-bright idea that perhaps I should issue

sudo grub-mkconfig -o /boot/grub/grub.cfg

while booted into Archsda6, as this is the first choice on the boot menu.

It took over 3 minutes to go to completion but seemed to finish successfully.
Upon rebooting and choosing the Archsda2 option, I got a kernel panic message.

I actually tried this twice with the same results both times.

I recently upgraded both installations ( -Syu) but this problem did not manifest itself in any post-upgrade boots on either Archsda6 or Archsda2 until after the attempt to do  grub-mkconfig while booted into Archsda6.

I mounted /dev/sda2 on /mnt. Arch-chrooted to /mnt. Then issued

grub-mkconfig -o /boot/grub/grub.cfg

This completed and gave no errors but did not alter the (faulty) functioning of the boot menu. Both options (Archsda6 and Archsda2) appeared but only Archsda6 worked. Choosing Archsda2 resulted in a kernel panic.
Os-prober was not installed on Archsda2  so I installed it there and then tried again. Aside from this error message:

WARNING: Failed to connect to lvmetad. Falling back to device scanning.

the process seemed to complete properly. Upon re-booting, the grub menu looked the same as previously and an attempt to boot Archsda2 failed with a kernel panic. Archsda6 worked fine.

Not sure what to do now. Any suggestions?

Offline

#2 2017-02-19 14:29:13

cirrus
Member
From: Glasgow Scotland
Registered: 2012-08-24
Posts: 340
Website

Re: grub-mkconfig caused Kernel Panic

Whist booted into the working Archsda6, use arch-chroot and chroot into Archsda2
when in chroot reinstall kernel, ensure intramfs goes well.

Last edited by cirrus (2017-02-19 14:37:49)

Offline

#3 2017-02-19 18:53:36

WeeDram
Member
From: Vancouver, B.C., Canada
Registered: 2016-04-14
Posts: 91

Re: grub-mkconfig caused Kernel Panic

Hi. Thanks for the reply. Last night I figured out the source of the problem. When I get to the boot menu, select the entry for the installation that has a problem and press 'e' to look at and edit it, I finally recognized that the following line:

initrd   /boot/intel-ucode.img

didn't look right or make sense. Changing it to

initrd   /boot/initramfs-linux.img

allowed me to successfully boot into the affected installation.

I can't say this is 'Solved' yet because I am still trying to figure out how it happened or, better still, to fix it.
Judging from my various searches, it seems to be a result of a problem with os-prober.

It took me a long time to get to this point (seeing what is wrong) so I imagine it will take me even longer to come up with fix.

Offline

#4 2017-02-19 19:36:58

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: grub-mkconfig caused Kernel Panic

WeeDram wrote:

I finally recognized that the following line:

initrd   /boot/intel-ucode.img

didn't look right or make sense.

That line is absolutely necessary if you have an Intel CPU, you need to load the microcode initramfs image before the Arch initramfs-linux.img

https://wiki.archlinux.org/index.php/Mi … de_updates

I am still trying to figure out how it happened

You should probably post the full output of:

# grub-mkconfig

Offline

#5 2017-02-19 21:25:15

WeeDram
Member
From: Vancouver, B.C., Canada
Registered: 2016-04-14
Posts: 91

Re: grub-mkconfig caused Kernel Panic

Since my previous response, I've done some more investigation. I looked carefully at the boot menus of three different Arch installations: the two I previously referenced in this thread, on the same HD and one on a USB.

On the 'working' installation on the HD the relevant line is:

initrd   /initramfs-linux.img

On the 'kernal panic' installation on the HD the line is:

initrd   /boot/intel-ucode.img

However on the USB the line is:

initrd   /boot/intel-ucode.img /boot/initramfs-linux.img

I then remembered that while I had installed intel-ucode on the 'kernal panic' installation and on the USB installation, I had not installed it on 'working' HD installation. I did that installation quite a while ago and only subsequently learned about the necessity of intel-ucode.
I'm probably wrong, but I think that os-prober somehow messed up when I did that grub-mkconfig that resulted in the problem.

Just to check, I edited the 'kernal panic' menu item to look like the USB one and it booted properly without any issue.

Perhaps the best approach would be for me to install the intel code and then once again do a grub-mkconfig.
Does this sound reasonable?

Offline

#6 2017-02-20 07:00:44

WeeDram
Member
From: Vancouver, B.C., Canada
Registered: 2016-04-14
Posts: 91

Re: grub-mkconfig caused Kernel Panic

Well, that sucks. I installed the intel-ucode and did another mkconfig and there is still no mention of initramfs-linux.img in the 30_os-prober section of grub.cfg. Maybe I'll just manually add it in all places right after /boot/intel-ucode.img.

Offline

#7 2017-02-20 07:53:03

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: grub-mkconfig caused Kernel Panic

Head_on_a_Stick wrote:

You should probably post the full output of:

# grub-mkconfig

Offline

#8 2017-02-20 17:28:37

WeeDram
Member
From: Vancouver, B.C., Canada
Registered: 2016-04-14
Posts: 91

Re: grub-mkconfig caused Kernel Panic

Here is the output. I used "time" in front and then copy/ pasted the output from the terminal. I've left the time output.

 time sudo grub-mkconfig
Generating grub configuration file ...
#
# 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,msdos6'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6  b74b9f1a-eb62-4fae-a1f9-354d4fbe4fec
else
  search --no-floppy --fs-uuid --set=root b74b9f1a-eb62-4fae-a1f9-354d4fbe4fec
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_CA
  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 ###
Found linux image: /boot/vmlinuz-linux
Found initrd image(s) in /boot: intel-ucode.img initramfs-linux.img
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-b74b9f1a-eb62-4fae-a1f9-354d4fbe4fec' {
	load_video
	set gfxpayload=keep
	insmod gzio
	insmod part_msdos
	insmod ext2
	set root='hd0,msdos5'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  ffb9538e-17a2-454a-a6cf-673fdfc39284
	else
	  search --no-floppy --fs-uuid --set=root ffb9538e-17a2-454a-a6cf-673fdfc39284
	fi
	echo	'Loading Linux linux ...'
	linux	/vmlinuz-linux root=UUID=b74b9f1a-eb62-4fae-a1f9-354d4fbe4fec rw  quiet
	echo	'Loading initial ramdisk ...'
	initrd  /intel-ucode.img /initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-b74b9f1a-eb62-4fae-a1f9-354d4fbe4fec' {
	menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-b74b9f1a-eb62-4fae-a1f9-354d4fbe4fec' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_msdos
		insmod ext2
		set root='hd0,msdos5'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  ffb9538e-17a2-454a-a6cf-673fdfc39284
		else
		  search --no-floppy --fs-uuid --set=root ffb9538e-17a2-454a-a6cf-673fdfc39284
		fi
		echo	'Loading Linux linux ...'
		linux	/vmlinuz-linux root=UUID=b74b9f1a-eb62-4fae-a1f9-354d4fbe4fec rw  quiet
		echo	'Loading initial ramdisk ...'
		initrd  /intel-ucode.img /initramfs-linux.img
	}
Found fallback initrd image(s) in /boot: intel-ucode.img initramfs-linux-fallback.img
	menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-b74b9f1a-eb62-4fae-a1f9-354d4fbe4fec' {
		load_video
		set gfxpayload=keep
		insmod gzio
		insmod part_msdos
		insmod ext2
		set root='hd0,msdos5'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  ffb9538e-17a2-454a-a6cf-673fdfc39284
		else
		  search --no-floppy --fs-uuid --set=root ffb9538e-17a2-454a-a6cf-673fdfc39284
		fi
		echo	'Loading Linux linux ...'
		linux	/vmlinuz-linux root=UUID=b74b9f1a-eb62-4fae-a1f9-354d4fbe4fec rw  quiet
		echo	'Loading initial ramdisk ...'
		initrd  /intel-ucode.img /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 ###
Found Arch on /dev/sda2
menuentry 'Arch (on /dev/sda2)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-8b73758f-f5e6-4747-8fe9-ab7e47f81682' {
	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-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  8b73758f-f5e6-4747-8fe9-ab7e47f81682
	else
	  search --no-floppy --fs-uuid --set=root 8b73758f-f5e6-4747-8fe9-ab7e47f81682
	fi
	linux /boot/vmlinuz-linux root=UUID=8b73758f-f5e6-4747-8fe9-ab7e47f81682 rw quiet
	initrd /boot/intel-ucode.img
}
submenu 'Advanced options for Arch (on /dev/sda2)' $menuentry_id_option 'osprober-gnulinux-advanced-8b73758f-f5e6-4747-8fe9-ab7e47f81682' {
	menuentry 'Arch Linux (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--8b73758f-f5e6-4747-8fe9-ab7e47f81682' {
		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-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  8b73758f-f5e6-4747-8fe9-ab7e47f81682
		else
		  search --no-floppy --fs-uuid --set=root 8b73758f-f5e6-4747-8fe9-ab7e47f81682
		fi
		linux /boot/vmlinuz-linux root=UUID=8b73758f-f5e6-4747-8fe9-ab7e47f81682 rw quiet
		initrd /boot/intel-ucode.img
	}
	menuentry 'Arch Linux, with Linux linux (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--8b73758f-f5e6-4747-8fe9-ab7e47f81682' {
		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-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  8b73758f-f5e6-4747-8fe9-ab7e47f81682
		else
		  search --no-floppy --fs-uuid --set=root 8b73758f-f5e6-4747-8fe9-ab7e47f81682
		fi
		linux /boot/vmlinuz-linux root=UUID=8b73758f-f5e6-4747-8fe9-ab7e47f81682 rw quiet
		initrd /boot/intel-ucode.img
	}
	menuentry 'Arch Linux, with Linux linux (fallback initramfs) (on /dev/sda2)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-linux--8b73758f-f5e6-4747-8fe9-ab7e47f81682' {
		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-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  8b73758f-f5e6-4747-8fe9-ab7e47f81682
		else
		  search --no-floppy --fs-uuid --set=root 8b73758f-f5e6-4747-8fe9-ab7e47f81682
		fi
		linux /boot/vmlinuz-linux root=UUID=8b73758f-f5e6-4747-8fe9-ab7e47f81682 rw quiet
		initrd /boot/intel-ucode.img
	}
}

### 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 ###
done

real	3m28.765s
user	0m1.507s
sys	0m0.587s

When I direct the output to a file I get this progress report at the terminal

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image(s) in /boot: intel-ucode.img initramfs-linux.img
Found fallback initrd image(s) in /boot: intel-ucode.img initramfs-linux-fallback.img
Found Arch on /dev/sda2
done

Looking forward to your observations.

Offline

#9 2017-02-23 20:38:20

WeeDram
Member
From: Vancouver, B.C., Canada
Registered: 2016-04-14
Posts: 91

Re: grub-mkconfig caused Kernel Panic

I manually edited the grub.conf file in the section

### BEGIN /etc/grub.d/30_os-prober ###

so that the first menuentry became:

initrd /boot/intel-ucode.img /boot/initramfs-linux.img

I can now boot that second installation directly from the boot menu. I'll edit the various

submenu 'Advanced options for Arch (on /dev/sda2)'

items soon.

Still not going to mark this "Solved" as I want to understand WHY os-prober seems to be causing this problem with intel-ucode. I had hoped to establish THAT it was os-prober causing the problem by setting up dual Arch boot on an old HP laptop that I had but during the process, the hard-drive failed.

Offline

#10 2017-03-12 23:23:44

WeeDram
Member
From: Vancouver, B.C., Canada
Registered: 2016-04-14
Posts: 91

Re: grub-mkconfig caused Kernel Panic

Ok, I think I can say that there is a problem with os-prober, but possibly only when:
a) there are two installations of Arch on 2 partitions on (probably) the same drive
b) intel-ucode has been installed for both
c) grub-mkconfig is used to create the grub.cfg.

To test this idea, I wiped the hard drive on an old 32-bit Toshiba NB200 and then created two partitions on it. I installed a minimal Arch on one of these partitions (sda1) using a USB on which I had set up the install software. When it was working properly, I used an rsync command to copy the entire installation to the second partition (sda2). I then edited all the appropriate files on sda2 so that partition could become bootable. The main edit was copying a section (the menu entry) of the sda1 grub.cfg, changing all the sda1 UUIDs to sda2 UUIDs and then pasting the result into the /etc/grub.d/40_custom on sda1. Then I ran grub-mkconfig. The result was a working grub menu that allowed booting into Ardch on either sda1 or sda2.

After checking a couple of times that things booted properly, I installed os-prober, cut out the chunk of text I had put into the /etc/grub.d/40_custom on sda1 and then ran grub-mkconfig. Sure enough, as above, the Arch on sda1 booted fine but the arch on sda2 caused a kernal panic. On sda2, initrd /boot/intel-ucode.img was not followed by /boot/initramfs-linux.img. Os-prober had not included it on that line.

Not sure if this is of any value to anyone but I thought I should share it.

Offline

Board footer

Powered by FluxBB