October 25, 2014
 
 
RSSRSS feed

Why Use GRUB2? Good Question! (part 3) - page 2

Translating Bizarre Error Messages, and Fixes

  • March 11, 2010
  • By Akkana Peck

Method 2: Move grub2 to /boot

If you want to keep the automated update-grub setup, you can move the grub files to your shared /boot so you can run them from any distro. But it's a bit more complicated than it sounds, because there are quite a few files that need to move.

First, you need to move the configuration files: everything in /etc/grub.d plus etc/default/grub. But since grub is still changing, your current configuration files may not work with a different version of update-grub. For instance, the syntax for specifying images changes from the version used in Ubuntu 9.10 and 10.04 alpha. So you also need to move update-grub and all the various helper programs it calls.

Safest is to copy the current files to appropriate places on /boot, move them to a save backup spot, then link the /boot files back to where the system expects to find them.

Here's a set of commands that does that for Ubuntu 9.10. First, on the 9.10 machine where you installed grub2, copy all the important files to /boot:

cp -a /etc/grub.d /boot/grub/grub.d
cp /etc/default/grub /boot/grub/grub-defaults

mkdir /boot/grub/sbin
cp -a /usr/lib/grub /boot/grub/lib
cp /usr/sbin/grub* /usr/sbin/update-grub* /boot/grub/sbin

Be sure to check and make sure everything got copied! Then, on each distro that uses grub2, back up the existing files then link from the ones on /boot back to the standard location:

mv /etc/grub.d /etc/grub.d-SAVE
ln -s /boot/grub/grub.d /etc/grub.d
mv /etc/default/grub /etc/default/grub-SAVE
ln -s /boot/grub/grub-defaults /etc/default/grub

mkdir /usr/sbin/grub-SAVE
mv /usr/sbin/grub* /usr/sbin/update-grub* /usr/sbin/grub-SAVE
ln -s /boot/grub/sbin/* /usr/sbin

mv /usr/lib/grub /usr/lib/grub-SAVE
ln -s /boot/grub/lib /usr/lib/grub
You may need to adjust link locations for non-Ubuntu distros.

Both these solutions are hacks. You may need to add entries for new kernels by hand, or make similar adjustments. But if you're running multiple distros, you may feel it's better than needing to reboot every time any distro adds a new kernel. We can only hope that some future version of grub2 will address this problem in a more portable way.

Akkana Peck is a freelance programmer and writer, and author of the book Beginning GIMP: From Novice to Professional. She also fiddles with way too many kernels and Linux distros.

Sitemap | Contact Us