Why Use GRUB2? Good Question! (part 3) - page 2
Translating Bizarre Error Messages, and Fixes
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.
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/grubYou 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.
- 1Linux Top 3: Fedora 24, Peppermint 7 and Solus 1.2
- 2Linux Top 3: Alpine Linux 3.4, deepin 15.2 and Linux Lite 3.0
- 3Linux 4.7 Set to Boost Live Patching, Security and Power Management
- 4Linux 4.6 Charred Weasel adds USB 3.1 Support
- 5Linux Top 3: OpenIndiana 2016.04, Ubuntu 16.04 and Debian's New Leader