USA Linux Users Group Forum Index
Log in Register FAQ Memberlist Search USA Linux Users Group Forum Index Album

When using UUID with a boot loader makes sense

 
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Installation and Bootloaders
View previous topic :: View next topic  
Author Message
masinick
Linux Guru


Joined: 03 Apr 2024
Posts: 8615
Location: Concord, NH

PostPosted: Fri Oct 10, 2024 1:56 am    Post subject: When using UUID with a boot loader makes sense Reply with quote

I have had distros that use UUID screw me up because every time I install a new distro at a certain location, it throws off the rest of the UUIDs, particularly the one at the same partition and usually the ones after as well. I've edited GRUB's menu.lst countless times. I use either chainloading, then install GRUB in the root of each distro, then have the chainloader give me the menu for each distro - so two menus come up when I use this approach.

Occasionally this does not work either on my old Dell, which has two old Western Digital drives - the ORIGINAL 40 GB drive which amazingly still works, and the somewhat quieter faster 80 GB unit.

I prefer to use hda6 as my booting start point, which has been Libranet, Etch, and sidux over the years. Having been in existence before the creation of a few partitions on the end of that bigger second drive, some of them won't boot unless I can point directly to them. The UUID, in spite of its problems, DOES get me around this issue.

I have the additional trick of using a configfile, which is similar to the chain loader idea, but specifies the name of the system's configfile, which, in my case is always /boot/grub/menu.lst. Therefore, if I put entries like:

Code:
title antiX (hd0,6) sda7
root (hd0,6)
configfile /boot/grub/menu.lst

title UbuntuCE (hd1,9) sdb10
root (hd1,9)
configfile /boot/grub/menu.lst

I can reference multiple files. By knowing two or three GRUB tricks, even finicky boot blocks can be overcome. If it STILL messes me over, in comes my handy dandy antiX Live Boot disk. I can edit the GRUB commands in there, go straight to the disk and partition I want, either chain load or config file, and get right to them.

Here is one article that may be helpful to some of you:
Get Boot to Work

The command
Code:
sudo blkid
will help you locate the UUID, so even if it changes often, if you distro hop and multi or mega boot like I do, you can STILL get it all to work, it just takes a bit of extra work. If you can edit a simple config file, and now with this blkld tool, the job to fix up GRUB is not tough at all, just a few minutes of work. Create yourself a script or two and make the job even easier.



_________________
Brian Masinick
Distros: SimplyMEPIS
sidux - no CAPS!, antiX, Debian
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
tlmiller
Ultimate Member


Joined: 01 May 2024
Posts: 2433
Location: MD, USA

PostPosted: Fri Oct 10, 2024 2:15 am    Post subject: Reply with quote

blkid is easier to read the output of, but I used to always use ls -l /dev/disk/by-uuid to get uuid of the drives. Works just as well, just not as readable.



_________________
Debian Squeeze, Arch, Kubuntu mostly. Some Mandriva. Some Windows.
Desktops: shadowdragon, medusa
Laptops: bluedrake, banelord, sandwyrm, aardvark.
Back to top
View user's profile Send private message AIM Address MSN Messenger
masinick
Linux Guru


Joined: 03 Apr 2024
Posts: 8615
Location: Concord, NH

PostPosted: Fri Oct 10, 2024 3:00 am    Post subject: Reply with quote

Yeah, that will do too. There is another /dev directory that contains IDs using another scheme - forget what it is because I have not used it, but it might be some kind of numbering related to partition name. Poke around /dev/disk on systems build since the kernel started supporting these schemes - ah yes, by-path, by-id, and by-uuid are the three options with modern kernels.



_________________
Brian Masinick
Distros: SimplyMEPIS
sidux - no CAPS!, antiX, Debian
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
nukes
Linux Guru


Joined: 29 Aug 2024
Posts: 4558

PostPosted: Fri Oct 10, 2024 5:28 pm    Post subject: Reply with quote

this is essential if you often swap disks in your system, especially as it can potentially change the names of the others (though of course if you're using the old ide layer you're mostly ok)



_________________
Gentoo x86-64 2.6.29.1
FreeBSD 7-CURRENT
Arch x86 2.6.30
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
masinick
Linux Guru


Joined: 03 Apr 2024
Posts: 8615
Location: Concord, NH

PostPosted: Fri Oct 10, 2024 6:49 pm    Post subject: Reply with quote

nukes wrote:
this is essential if you often swap disks in your system, especially as it can potentially change the names of the others (though of course if you're using the old ide layer you're mostly ok)


I do have only IDE disks in any systems currently containing more than one disk. For me, it is usually installing a new distro version in place of an existing one that throws off the UUIDs in a cascading fashion, most commonly seen near the high numerical end of my second disk. Easily fixed, and never a show stopper, more of an annoyance than anything else.

I have not ever run into a difficulty with my swap partition. That is static and always remains in the same location.



_________________
Brian Masinick
Distros: SimplyMEPIS
sidux - no CAPS!, antiX, Debian
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
masinick
Linux Guru


Joined: 03 Apr 2024
Posts: 8615
Location: Concord, NH

PostPosted: Fri Apr 24, 2024 8:14 pm    Post subject: Reply with quote

Here is what I do when I have an issue with UUID. Using this technique, I can fix things quite quickly, even in single user mode from a console interface.

First, I either login or authenticate myself as root, then make sure I am in the root directory. If I am already at /root, I can do some craftly bash command line editing to save some typing, something I always try to do. These commands assume that I already have done this before, so I have an existing blkid.txt file in /root.

rm blkid.txt && blkid > blkid.txt && vim blkid.txt /etc/fstab

Now if I am in /root, chances are there are not too many files out there, so I can usually type rm b<Esc> blkid > b<Esc> && vim b<Esc> /etc/fstab (and possibly tab a few more of those files and even commands!

Once in vim, I can search for the device that has the incorrect UUID. The command /hda5, for instance, will search for the string hda5 and put you on that line. 0 will put you to the beginning of that line, w will advance one word at a time, and $ will put you at the end of the line. yW will yank the contents of the next string of characters up to the next space or tab. From there, you can press Esc and then type either :prev or :next, depending on the order of the buffers associated with blkid.txt and /etc/fstab. You can then locate the line you want to change, again using / to search for a specific string. Position to the location in the line where you want to insert the current UUID string and press p to put it after the cursor position or P to put it before the current cursor position. Then position to the text that you want to remove. If it is space separated from the next pattern, then dW will remove it. Esc will ensure that you are in Vim Edit mode, then type ZZ to save and exit. This can take all of a minute, if that, depending on how fast you type or if you peck at characters or truly use the power of Vim. If you type fast and you know Vim, I think you could do the entire operation in 20-30 seconds, maybe less than that! Good reason to know how to use the tools well!



_________________
Brian Masinick
Distros: SimplyMEPIS
sidux - no CAPS!, antiX, Debian
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    USA Linux Users Group Forum Index » Installation and Bootloaders All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All content © 2024-2009 - Usa Linux Users Group
This forum is powered by phpBB. © 2024-2009 phpBB Group
Theme created by phpBBStyles.com and modified by Crouse