How do I stop PC booting the wrong partition ?[SOLVED]

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help

Re: How do I stop PC booting the wrong partition ?

Postby ron_h on Sun Jun 15, 2014 12:39 am

I didn't realise I could use Gparted when I went looking for partition clone/copy software, I assume it would need to be Gparted from a Live medium ? Since Clonezilla website made very clear you can only clone to a partition of equal (or greater) size, it seemed like a good idea to make the partitions of identical size.

Ron
ron_h
Level 3
Level 3
 
Posts: 180
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Linux Mint is funded by ads and donations.
 

Re: How do I stop PC booting the wrong partition ?

Postby ron_h on Sun Jun 15, 2014 12:44 am

OK, done that, it's still wrong.

Code: Select all
grep vmlin /boot//grub/grub.cfg
   linux   /boot/vmlinuz-3.11-2-amd64 root=UUID=c456e7bd-e79e-496c-93a1-5c522359fdaa ro  quiet splash
   linux   /boot/vmlinuz-3.11-2-amd64 root=UUID=c456e7bd-e79e-496c-93a1-5c522359fdaa ro single
   linux /boot/vmlinuz-3.11-2-amd64 root=UUID=c456e7bd-e79e-496c-93a1-5c522359fdaa ro quiet splash
   linux /boot/vmlinuz-3.11-2-amd64 root=UUID=c456e7bd-e79e-496c-93a1-5c522359fdaa ro single


Ron
ron_h
Level 3
Level 3
 
Posts: 180
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: How do I stop PC booting the wrong partition ?

Postby Spearmint2 on Sun Jun 15, 2014 1:13 am

Code: Select all
cat /boot/grub/grub.cfg |grep UUID; sudo blkid & sudo fdisk -l & sudo parted -l


copy and paste into terminal and run. Post results. It's past 1am so I may not be back till tomorrow to see it.

for a bit of twist on yours, try this instead;

Code: Select all
grep generic /boot//grub/grub.cfg
All things go better with Mint. Mint julep, mint jelly, mint gum, candy mints, pillow mints, peppermint, chocolate mints, spearmint,....
User avatar
Spearmint2
Level 10
Level 10
 
Posts: 3360
Joined: Sat May 04, 2013 1:41 pm
Location: Maryland, USA

Re: How do I stop PC booting the wrong partition ?

Postby WharfRat on Sun Jun 15, 2014 1:22 am

From the same place

Code: Select all
sudo -i

Code: Select all
mount /dev/sda8 /mnt

Code: Select all
egrep '^UUID|^/dev' /mnt/etc/fstab

Code: Select all
umount -l /dev/sda8

Code: Select all
exit


Just paste back the grep results.
Image
User avatar
WharfRat
Level 12
Level 12
 
Posts: 4452
Joined: Thu Apr 07, 2011 8:15 pm

Re: How do I stop PC booting the wrong partition ?

Postby ron_h on Sun Jun 15, 2014 1:32 am

Looks like I stuffed up the other day ....

Code: Select all
sudo -i
[sudo] password for ron:
baby-2 ~ # mount /dev/sda8 /mnt
baby-2 ~ # egrep '^UUID|^/dev' /mnt/etc/fstab
UUID=newuuidhere   /   ext4   rw,errors=remount-ro   0   1
UUID=afc6dcda-65ea-446d-9c95-4d355a03debc   swap   swap   sw   0   0
baby-2 ~ # umount -l /dev/sda8
baby-2 ~ # exit
logout


That 'newuuidhere' shouldn't be there ... i remember I got that command wrong when I first tried it

Code: Select all
sed -i.bak 's/c456e7bd-e79e-496c-93a1-5c522359fdaa/newuuidhere/1' /etc/fstab


So I reran it ... and it looks like that wasn't good enough :-(

Ron
ron_h
Level 3
Level 3
 
Posts: 180
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: How do I stop PC booting the wrong partition ?

Postby WharfRat on Sun Jun 15, 2014 8:23 am

ron_h wrote:Looks like I stuffed up the other day ....

Yup :D

I was always under the impression that grub used blkid or tune2fs to retrieve the UUID for the partition, but now I see it doesn't.

ron_h wrote:So I reran it ... and it looks like that wasn't good enough


It's a good thing nothing happened given the substitution string wasn't there otherwise you would have messed up the sda6 system.

Get back to where you were before, meaning boot and open the terminal

Code: Select all
sudo -i

Code: Select all
mount /dev/sda8 /mnt

Code: Select all
sed -i.bak 's/newuuidhere/015fac40-f127-11e3-ad5a-2b2b889acdff/1' /mnt/etc/fstab

Double check that the substitution worked and if so update grub
Code: Select all
grep 2b2b889acdff /mnt/etc/fstab

Code: Select all
/usr/sbin/update-grub

Then check the grub.cfg file
Code: Select all
grep vmlin /boot//grub/grub.cfg


That should do it.
Image
User avatar
WharfRat
Level 12
Level 12
 
Posts: 4452
Joined: Thu Apr 07, 2011 8:15 pm

Re: How do I stop PC booting the wrong partition ?

Postby ron_h on Sun Jun 15, 2014 6:30 pm

Sadly, no

Code: Select all
ron@baby-2 ~ $ sudo -i
[sudo] password for ron:
baby-2 ~ # mount /dev/sda8 /mnt
baby-2 ~ # sed -i.bak 's/newuuidhere/015fac40-f127-11e3-ad5a-2b2b889acdff/1' /mnt/etc/fstab
baby-2 ~ # grep 2b2b889acdff /mnt/etc/fstab
UUID=015fac40-f127-11e3-ad5a-2b2b889acdff   /   ext4   rw,errors=remount-ro   0   1
baby-2 ~ # /usr/sbin/update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.11-2-amd64
Found initrd image: /boot/initrd.img-3.11-2-amd64
  No volume groups found
Found Windows Recovery Environment (loader) on /dev/sda1
Found Windows 7 (loader) on /dev/sda3
Found LMDE Cinnamon Edition (1) on /dev/sda8
done

[127]baby-2 ~ # grep vmlin /boot//grub/grub.cfg
   linux   /boot/vmlinuz-3.11-2-amd64 root=UUID=c456e7bd-e79e-496c-93a1-5c522359fdaa ro  quiet splash
   linux   /boot/vmlinuz-3.11-2-amd64 root=UUID=c456e7bd-e79e-496c-93a1-5c522359fdaa ro single
   linux /boot/vmlinuz-3.11-2-amd64 root=UUID=c456e7bd-e79e-496c-93a1-5c522359fdaa ro quiet splash
   linux /boot/vmlinuz-3.11-2-amd64 root=UUID=c456e7bd-e79e-496c-93a1-5c522359fdaa ro single


Ron
ron_h
Level 3
Level 3
 
Posts: 180
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: How do I stop PC booting the wrong partition ?

Postby ron_h on Sun Jun 15, 2014 7:18 pm

It seems to me that using Clonezilla to create a clone on a partition on the same hard drive was not a good decision on my part. Even if this thread ends up SOLVED, I won't be doing things the same way ever again. So I'm starting a new thread to detemine how I should have done it :-)

Ron
ron_h
Level 3
Level 3
 
Posts: 180
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: How do I stop PC booting the wrong partition ?

Postby WharfRat on Sun Jun 15, 2014 7:21 pm

ron_h wrote:It seems to me that using Clonexzilla to create a clone on a partition on the same hard drive was not a good decision on my part. Even if this thread ends up SOLVED, I won't be doing things the same way ever again. So I'm starting a new thread to detemine how I should have done it :-)

Ron


Mount the partition or make sure it's mounted and

Code: Select all
cat /mnt/boot/grub/i386-pc/load.cfg
Image
User avatar
WharfRat
Level 12
Level 12
 
Posts: 4452
Joined: Thu Apr 07, 2011 8:15 pm

Re: How do I stop PC booting the wrong partition ?

Postby ron_h on Mon Jun 16, 2014 12:46 am

sda6 is mounted, it's the running system. I also mounted sda8

Code: Select all
ron@baby-2 ~ $     cat /mnt/boot/grub/i386-pc/load.cfg
cat: /mnt/boot/grub/i386-pc/load.cfg: No such file or directory


The only subdirectory in /mnt/boot/grub is /locale, and there is no load.cfg file in /mnt/boot/grub or in /mnt/boot/grub/locale

Ron
ron_h
Level 3
Level 3
 
Posts: 180
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: How do I stop PC booting the wrong partition ?

Postby ron_h on Mon Jun 16, 2014 1:49 am

I can't find load.cfg at all

Ron
ron_h
Level 3
Level 3
 
Posts: 180
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: How do I stop PC booting the wrong partition ?

Postby WharfRat on Mon Jun 16, 2014 8:38 am

ron_h wrote:I can't find load.cfg at all

Ron

Well, that's strange. If this is a clone of sda6 then it should be there. I've never touched that file, even when I rsync clone my running system to a flash and the flash to another computer.

Lets just manually adjust grub and see if it boots. Use your text editor to change the UUID entry in grub.cfg. Just make a copy first.

Code: Select all
sudo cp -a /boot/grub/grub.cfg /boot/grub/grub.cfg.bak


I forget if mentioned your desktop or not, but your editor is either pluma, gedit or kate/ So

Code: Select all
sudo youreditor /boot/grub/grub.cfg&


Change the UUID's for the last two vmlinuz lines with sda8's to read:

linux /boot/vmlinuz-3.11-2-amd64 root=UUID=015fac40-f127-11e3-ad5a-2b2b889acdff ro quiet splash
linux /boot/vmlinuz-3.11-2-amd64 root=UUID=015fac40-f127-11e3-ad5a-2b2b889acdff ro single

Save the file and reboot.
Image
User avatar
WharfRat
Level 12
Level 12
 
Posts: 4452
Joined: Thu Apr 07, 2011 8:15 pm

Re: How do I stop PC booting the wrong partition ?

Postby ron_h on Mon Jun 16, 2014 9:47 pm

I made the backup then started gedit (I'm using Cinnamon) for grub.cfg. In your example code, do I have to specify the & that is at the end of the file ID ?

I have NOT yet made the changes. This is what I see for entries 5 and 6 in the grub menu, which do indeed boot the wrong partition !

Code: Select all
menuentry "LMDE Cinnamon 64-bit, 3.11-2-amd64 (/dev/sda6) (on /dev/sda8)" --class gnu-linux --class gnu --class os {
   insmod part_msdos
   insmod ext2
   set root='(hd0,msdos8)'
   search --no-floppy --fs-uuid --set=root 015fac40-f127-11e3-ad5a-2b2b889acdff
   linux /boot/vmlinuz-3.11-2-amd64 root=UUID=c456e7bd-e79e-496c-93a1-5c522359fdaa ro quiet splash
   initrd /boot/initrd.img-3.11-2-amd64
}
menuentry "LMDE Cinnamon 64-bit, 3.11-2-amd64 (/dev/sda6) -- (recovery mode) (on /dev/sda8)" --class gnu-linux --class gnu --class os {
   insmod part_msdos
   insmod ext2
   set root='(hd0,msdos8)'
   search --no-floppy --fs-uuid --set=root 015fac40-f127-11e3-ad5a-2b2b889acdff
   linux /boot/vmlinuz-3.11-2-amd64 root=UUID=c456e7bd-e79e-496c-93a1-5c522359fdaa ro single
   initrd /boot/initrd.img-3.11-2-amd64

For the entries 1 & 2 in the menu, all UUID references are to the sda6 UUID
ron_h
Level 3
Level 3
 
Posts: 180
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: How do I stop PC booting the wrong partition ?

Postby WharfRat on Mon Jun 16, 2014 10:29 pm

do I have to specify the & that is at the end of the file ID ?

No, but if you do it will put the editor in the background freeing-up the terminal in case you need to get into it.

You can change the menu options to

Code: Select all
menuentry "LMDE Cinnamon 64-bit, 3.11-2-amd64 on /dev/sda8)" --class gnu-linux --class gnu --class os {

menuentry "LMDE Cinnamon 64-bit, 3.11-2-amd64 recovery mode (on /dev/sda8)" --class gnu-linux --class gnu --class os {

and the kernel lines to

Code: Select all
linux /boot/vmlinuz-3.11-2-amd64 root=UUID=015fac40-f127-11e3-ad5a-2b2b889acdff ro quiet splash

linux /boot/vmlinuz-3.11-2-amd64 root=UUID=015fac40-f127-11e3-ad5a-2b2b889acdff ro single


You can just copy and paste the lines.
Image
User avatar
WharfRat
Level 12
Level 12
 
Posts: 4452
Joined: Thu Apr 07, 2011 8:15 pm

Re: How do I stop PC booting the wrong partition ?

Postby ron_h on Tue Jun 17, 2014 3:42 am

Many thanks again. I did copy/paste the lines, although I changed LMDE to LMDETEST which looks better (to my eyes) in the GRUB menu.

I confirm that I can now boot to the LMDE system or the LMDETEST system, which is what I started this thread for.

As long as I don't run update-grub or grub-mkconfig, or install another system in a different partition, I assume grub.cfg will remain unchanged. However, if I do any of those things, would I be right to assume that grub.cfg will become incorrect again with respect to sda8 ? If so, then I think I need to reinstall LMDETEST but not by a cloning method, rather by a filesystem copy method such as fsarchiver. That however is a whole different exercise, beyond the scope of this thread.

Ron
ron_h
Level 3
Level 3
 
Posts: 180
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: How do I stop PC booting the wrong partition ?

Postby WharfRat on Tue Jun 17, 2014 8:53 am

ron_h wrote:As long as I don't run update-grub or grub-mkconfig, or install another system in a different partition, I assume grub.cfg will remain unchanged. However, if I do any of those things, would I be right to assume that grub.cfg will become incorrect again with respect to sda8 ? If so, then I think I need to reinstall LMDETEST but not by a cloning method, rather by a filesystem copy method such as fsarchiver. That however is a whole different exercise, beyond the scope of this thread.

Ron

It appears likely that an update to the kernel or initrd will mess up the grub file again. You can check with

Code: Select all
sudo /usr/sbin/grub-mkconfig


It will dump the new menu to the screen so you can take a look at it.

You can always save the grub file and just copy it back with changes to the kernel and initrd versions to reflect the new entries. I use symlink references in grub so I don't have to modify the grub file, just adjust the symlinks in /boot.

Also since this is LMDE and not the main edition, you might want to try posting your experience to the LMDE forum. Maybe there's a grub bug with this edition.

I've cloned my running system to a flash drive using rsync several times, chrooted and made the same modifications I had you do without any problems.

Whatever you decide to do good luck with it :wink:
Image
User avatar
WharfRat
Level 12
Level 12
 
Posts: 4452
Joined: Thu Apr 07, 2011 8:15 pm

Re: How do I stop PC booting the wrong partition ?

Postby austin.texas on Tue Jun 17, 2014 10:39 am

Boot into Mint on sda6 and edit the /etc/fstab file on sda8.
Change from:
UUID=c456e7bd-e79e-496c-93a1-5c522359fdaa / ext4 rw,errors=remount-ro 0 1
to:
UUID=015fac40-f127-11e3-ad5a-2b2b889acdff / ext4 rw,errors=remount-ro 0 1
Then run: sudo /usr/sbin/update-grub putting the new Mint on the GRUB menu.
When you boot into Mint on sda8, run sudo /usr/sbin/update-grub again there.
Mint 17 v2 Cinnamon (64 bit), Quad core AMD A8-3870 with Radeon HD Graphics 6550D, 8GB DDR3, Ralink RT2561/RT61 802.11g PCI
Microsoft-free environment since 1996

To help Linux Mint with a donation, please visit http://www.linuxmint.com/donors.php
User avatar
austin.texas
Level 11
Level 11
 
Posts: 3786
Joined: Tue Nov 17, 2009 3:57 pm
Location: at /home

Re: How do I stop PC booting the wrong partition ?

Postby Spearmint2 on Tue Jun 17, 2014 10:48 am

and this is why some like to use boot partitions where multiple systems may reside.
All things go better with Mint. Mint julep, mint jelly, mint gum, candy mints, pillow mints, peppermint, chocolate mints, spearmint,....
User avatar
Spearmint2
Level 10
Level 10
 
Posts: 3360
Joined: Sat May 04, 2013 1:41 pm
Location: Maryland, USA

Re: How do I stop PC booting the wrong partition ?

Postby ron_h on Tue Jun 17, 2014 6:08 pm

I am sure it is as a result of the fact that sda8 started life as a clone of sda6 but when I looked at fstab on sda8, it showed the right UUID for sda8 but pointed to sda6 rather than sda8. It would appear that the referenced partition is then what ends up being booted in spite of the fact that the UUID does not match the one in the fstab. I have corrected the fstab on sda8 to point to sda8. Hopefully everything is now kosher and I have 2 boot partitions where everything internally cross references correctly. I will run an update-grub but (I'm chicken) not now. Later today maybe.

I started this thread in Newbie Questions in Main Edition, it is now in LMDE Newbie Questions as someone has moved it.

Many thanks to all who've helped me get to this stage.

Ron
ron_h
Level 3
Level 3
 
Posts: 180
Joined: Tue Apr 15, 2014 7:03 am
Location: Sydney, NSW, AU

Re: How do I stop PC booting the wrong partition ?

Postby WharfRat on Tue Jun 17, 2014 7:42 pm

Ron,

This will not write to the grub.cfg file, it will just dump to the terminal so you can see if that problem will persist.

Code: Select all
sudo /usr/sbin/grub-mkconfig
Image
User avatar
WharfRat
Level 12
Level 12
 
Posts: 4452
Joined: Thu Apr 07, 2011 8:15 pm

Linux Mint is funded by ads and donations.
 
PreviousNext

Return to Newbie Questions

Who is online

Users browsing this forum: No registered users and 5 guests