Modifying GRUB2 for LABEL= syntax
Greetings all,
After a recent hard drive replacement, I find that I can no longer boot my Ubuntu partition. It seems that Ubuntu set up GRUB to boot using the disk id, which is no longer valid. I've been using the old GRUB for a number of years, and have always used the LABEL= syntax to assure that the correct partition is booted. There is a dire warning in the /boot/grub/grub.cfg file NOT to edit it. With the old grub, it was just a simple matter to change the menu.lst file. What file DOES get edited to make the change for the new drive? Is there an easy way to get GRUB2 to use the LABEL= form that I know and love? Or is it easier just to reinstall Ubuntu when a drive gets changed? Thanx in advance. Rich |
Grub2 and LABELd partitions.
Check out these threads:
http://www.linuxquestions.org/questi...b2-how-819474/ Remember, google is your friend! |
I have just finished jumping through the hoops required to understand grub2. I installed it in one of my Slackware partitions & used it for quite a while by editing /boot/grub/grub.cfg. I know that isn't recommended, but if you realise that it will be overwritten when "update-grub" is run & keep a backup, you can do that.
In order to use it as designed, you can start by editing "/etc/default/grub". There are a number of settings in there that can be changed & it is fairly well annotated. There is even a setting to turn off passing "root=UUID=whatever", but if you do, it passes "root=/dev/sdXY". There is nothing to have it pass "root=LABEL=whatever", unfortunately. The actual menu entries are read from the files in "/etc/grub.d". The files in that directory that are executable are added to /boot/grub/grub.cfg when "update-grub" is run. On my system, I have 00_header, 05_debian_theme, 10_linux & 40_custom executable, so it does not probe for other OSes, via 30_os-prober. I have one ubuntu & two Slackware partitions on this harddrive & full backups on a USB harddrive. If I ran 30_os-prober, it would add all my backups to my grub.cfg; I didn't want that, so I edited 40_custom to add my Slackware partitions like this: Code:
#!/bin/sh Code:
# DO NOT EDIT THIS FILE Regards, Bill Edit: Well, I didn't search well enough, did I? I've spent part of my afternoon following the instructions in post #2 & they work perfectly. Follow them & pay very little attention to what I have posted. I still have to use 40_custom for my other partitions, but maybe, with the stuff I read this afternoon, I can modify 30_os-prober to do what I want. Regards again, Bill |
Quote:
Code:
sudo update-grub To find the UUIDs of all your partitions, simply run: Code:
sudo blkid Here is a good tutorial on grub2: https://help.ubuntu.com/community/Grub2 Quote:
Custom boot entries can be created in the /etc/grub.d/ directory. You must run: "sudo update-grub" after making any changes to grub2, so the updates can be written to: /boot/grub/grub.cfg. Write back if you need more help. And welcome to the LQ forums! |
All times are GMT -5. The time now is 12:35 AM. |