I have two hard drives, with two corresponding Grubs. One is from Arch Linux, and the other is from Ubuntu. Using Arch's grub, I can boot into either distribution. However, using Ubuntu's grub, I can see both Arch and Ubuntu, but cannot boot into Arch. I get the error:

Kernel offset
End kernel panic. Not syncing: VFS.
Unable to mount root fs on unknown-block.

I compared grub.cfg for both distributions. In Ubuntu's grub, I can see an entry for Arch, with the following line.

initrd /boot/intel-ucode.img

I changed it to follow Arch's grub.cfg:

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

Now I can boot into Arch from Ubuntu's grub. It appears that Ubuntu is not appending this required option by default. How can I make Ubuntu automatically create the correct entry?

Edit

I'm updating Arch's grub with grub-mkconfig -o /boot/grub/grub.cfg. In Ubuntu, I've tried both update-grub and the raw command above (which it is aliased to).

Edit 2

The uncommented lines of /etc/default/grub

GRUB_DEFAULT="saved"
GRUB_SAVEDEFAULT="true"
GRUB_HIDDEN_TIMEOUT_QUIET="true"
GRUB_TIMEOUT="3"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
  • Did you tried with "update-grub" and "grub-mkconfig" commands? – MasterPiece May 26 '15 at 0:00
  • @MasterPiece Yes, sorry, I've clarified in an edit. – Sparhawk May 26 '15 at 0:27
  • update-grub2? It's a bit different. I believe the latest ubuntu uses that. Can you also drop in your grub.cfg. Odds are you just need an entry for ArchLinux in your config. I'm surprised it wasn't auto detected. – csgeek May 26 '15 at 0:39
  • update-grub2 is aliased to update-grub. I actually do see an Arch entry, and it is detected; it just has the wrong settings. I'll clarify in an edit. – Sparhawk May 26 '15 at 0:44
  • 1
    There's a bug report on bugs.launchpad.net/ubuntu/+source/os-prober/+bug/1635781 – Bohr Feb 10 '17 at 8:22

EDITED: I have tested it on my system running Ubuntu 15.04, but I have in Intel Processor on this one. But what I did, for the 30_os-prober file, which is the configuration file for grub detecting linux operating systems, in the /etc/grub.d folder, I added some lines to it. What it does is checks the CPU type and configures initrd line appropriately.

Here is the newest patch below:

First, back up your /etc/grub.d/30_os-prober file to another location.

mkdir ~/backup_init
sudo cp /etc/grub.d/30_os-prober ~/backup_init

then copy and paste the following here-script to a terminal window to create the patch file.

TAB=$'\t'
cat > ~/backup_init/patch30.do << EOM
*** backup_init/30_os-prober${TAB}2015-05-27 10:52:18.237381123 -0700$
--- /etc/grub.d/30_os-prober${TAB}2015-05-27 11:29:45.149420380 -0700$
***************
*** 22,27 ****
--- 22,29 ----
  datarootdir="/usr/share"
  quick_boot="1"

+ CPU=\`cat /proc/cpuinfo | grep -i vendor_id | head -1 | awk '{print $3}'\`
+ 
  export TEXTDOMAIN=grub
  export TEXTDOMAINDIR="\${datarootdir}/locale"

***************
*** 276,281 ****
--- 278,286 ----
  ${TAB}linux \${LKERNEL} \${LPARAMS}
  EOF
              if [ -n "\${LINITRD}" ] ; then
+             if [ "\${OS}" = "Arch" ] ; then
+ ${TAB}${TAB}LINITRD="/boot/intel-ucode.img \${LINITRD}"
+             fi
            cat << EOF
  ${TAB}initrd \${LINITRD}
  EOF
EOM

then patch the files together

sudo patch /etc/grub.d/30_os-prober ~/backup_init/patch30.do

then you should be able to update the grub as normal

sudo update-grub

Hope this helps.

  • +1 although I'm not sure how well this approach will withstand future upgrades. Having said that, I'm unsure if there is a better solution. However, the patch failed for me. I'm not sure if my original file differs. I've copied it here. – Sparhawk May 26 '15 at 6:25
  • I tried to run the patch, but it failed again. Instead, I used your pastebin file (which btw misses a few closing quotes on line 29 and 367, if you diff with my file). In any case, sudo update-grub produces the same /boot/grub/grub.cfg, i.e. without the initramfs parameter. – Sparhawk May 27 '15 at 23:08
  • I'm not sure what you mean by "on the same system". They are both on the same computer, but installed in separate partitions and hard drives (as per the question. – Sparhawk May 27 '15 at 23:24
  • Yes, it's Ubuntu 15.04 and the latest Arch. I suspect it is a bug. I think I saw something on the web about a similar OpenSuse bug report, but I can't find it any more. – Sparhawk May 28 '15 at 0:54
  • @Sparhawk OK, this will work for your configuration that you have. It will only test for the Arch Linux, then create the line with the intel-ucode.img. This will only work if the image file is there. If not, when the host reboots, you will get that kernel panic as I have tested, but the boot line is correct. I am trying to find out from Arch linux why they have that img file at all. It actually says that it is needed on Intel processors, but it did boot fine on my AMD. But anyway, this does work now. – Terrance May 28 '15 at 5:30

Actually, there are two files that need to be modified to solve this problem. I've tested this on my Lubuntu 16.04.1 and Manjaro Linux.

In Ubuntu:

1) File /usr/lib/linux-boot-probes/mounted/40grub2 there is a function parse_grub_menu that doesn't handle all initrd parameters. You need to modify 'case "$1" in ... initrd)':

a) remove assignment

initrd="$(echo "$2" ...)"

b) add two lines in place of the removed one:

shift 1
initrd="$(echo "$@" | sed 's/(.*)//')"

2) File /etc/grub.d/30_os-prober within a for loop fix the assignment of LINITRD:

for LINUX in ${LINUXPROBED}; do
...
    LINITRD="`echo ${LINUX} | cut -d ':' -f 5 | tr '^' ' '`"

The first fix takes all available initrd info for Manjaro into account. The second fix cleans up the generated initrd line by changing some '^' characters to spaces.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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