Chainloading Ubuntu with GRUB 2 from Archlinux with SYSLINUX
I’m running a dual boot system on my Notebook with one OS being my private one and the other being the one for my employer. This week my company operating system died and I had to re-install it. For my private operating system I use Arch Linux with a SYSLINUX bootloader and for the company I use Ubuntu (which by default uses GRUB 2 as bootloader). Both of my installations use root volume encryption.
Combining these two is quite simple if you know what you have to do, but since the default Ubuntu installation doesn’t do the right thing I will write down my notes here.
I followed the Ubuntu installation process and used custom formatting of my hard disk (to keep the existing partitions for my private operating system). To my knowledge GRUB (or Ubuntu?) performs a search for other existing operating systems to boot from and will auto-populate the boot menu entries. However, in my case this failed - probably due to the root volume encryption of my Arch Linux installation.
After installing Ubuntu I ended up with an overwritten MBR that only contained one entry and had to be fixed. I didn’t like the idea of Ubuntu and GRUB managing my boot menu, so adjusting GRUB 2 from Ubuntu wasn’t the solution I wanted to take. I wanted to have SYSLINUX back.
With SYSLINUX on the other hand it doesn’t seem to be so simple to load operating
systems from other partitions. And I certainly did not want Ubuntu to interfer
with my existing Arch Linux /boot
partition. I neither felt like bypassing
the Ubuntu bootloader, just in case they set special options they need (in my
opinion Ubuntu often has the habit of doing things differently from most other
Linux distributions). Thus, I decided to use chainloading.
For chainloading we want the Ubuntu bootloader (GRUB 2) to be written to the partition boot record (PBR) instead of the master boot record (MBR). If you know this in advance, format your hard drive as ext3 or ext4. I used ext2 by habit and GRUB 2 discourages writing a PBR on ext2. It can be forced though. So here we go. From the Ubuntu installation execute:
# X is the hard disk letter
# N is the partition number
# --force was needed, because I have an ext2 /boot partition
grub-install --force /dev/sdXN
From quick research I have the feeling that somewhere in the installation process of Ubuntu you might be able to select to install GRUB into a PBR instead of MBR. So if you’re install in the process of installing Ubuntu keep some attention to that as it might save you some time re-installing SYSLINUX.
However, in my case Ubuntu had overwritten the MBR already. So I booted a live
Arch Linux, mounted my /boot
partition, edited the
syslinux.cfg
and wrote the bootloader to the MBR again.
The required entry in syslinux.cfg
should look similar to this:
LABEL business
MENU LABEL Business
COM32 chain.c32
# Ubuntu /boot is on hda4 on my PC
APPEND hd0 4
And it can be re-written to MBR with the following Arch-Linux-specific command:
syslinux-install_update -i -a -m
When you now select Business in the bootloader menu it should forward you to the Ubuntu GRUB bootloader and successfully boot Ubuntu.
I do not maintain a comments section. If you have any questions or comments regarding my posts, please do not hesitate to send me an e-mail to blog@stefan-koch.name.