LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-29-2007, 04:19 AM   #1
Thoddy
Member
 
Registered: Jul 2003
Location: Bremen, Germany
Distribution: Ubuntu 9.10
Posts: 106

Rep: Reputation: 15
Question new root partition - but "Grub loading, please wait... Error 22"


Hi all,

I had some problems with my root partition, some errors in the file system which caused the system to remount read-only... don't know exactly. But it is only this partition, not the others on the disk.

So, I started ubuntu from CD and used gparted to create a new partition (without overlap with the broken partition) and copy the content from my root into the new partition.

So far, so good - everything is there, I can mount and see it...

But after I erased the old (broken) root, the system does not start anymore!?

My old root partition was /dev/hda2, my new root partition is /dev/hda4. They both have the same UUID because one is a copy of the other, I checked with "vol_id -u /dev/hda4"... (I think gparted uses dd to copy)


What I've done:
  • grub: tried "grub-install /dev/hda" and start grub plus enter "root (hd0,3)" and "setup (hd0)"...
  • menu.lst: I tried to manipulate the grub conf file menu.lst manually and replace (hd0,1) with (hd0,3) - remember, the UUID is the same, didn't need to change...
  • fstab: Didn't need any change here either since /dev/hda2 (hda4) is not used anymore, the UUID is used and that's the same for the new partition...

Still: nothing!?

Any hints?

Maybe I have to cleanup the mbr and reinstall grub? How can I do that?

Last edited by Thoddy; 08-29-2007 at 04:47 AM.
 
Old 08-29-2007, 04:33 AM   #2
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by Thoddy View Post
  • fstab: Didn't need any change here either since /dev/hda2 (hda4) is not used anymore, the UUID is used and that's the same for the new partition...
If you don't have the root partition in your fstab grub will not be able to find it.... Also considering that your boot directory with your kernel is 90% within your root partition. Grub also told you with error num 22 which translates to error Partition not found.

So make an entry in your fstab stating the root partition as /dev/hda4 point grub to this partition and you should be set.

Reinstalling grub also is an option, but as far as me is to much hassle.

Greetings Zhjim
 
Old 08-29-2007, 04:39 AM   #3
Thoddy
Member
 
Registered: Jul 2003
Location: Bremen, Germany
Distribution: Ubuntu 9.10
Posts: 106

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by zhjim View Post
If you don't have the root partition in your fstab grub will not be able to find it.... Also considering that your boot directory with your kernel is 90% within your root partition. Grub also told you with error num 22 which translates to error Partition not found.

So make an entry in your fstab stating the root partition as /dev/hda4 point grub to this partition and you should be set.

Reinstalling grub also is an option, but as far as me is to much hassle.

Greetings Zhjim

First off: thanks for your reply!

No, there is an entry for the root partition in my fstab... it uses the UUID in the front, then mount point "/", then the options - not the "old" /dev/xxx pattern (why have these UUDI's been introduced anyway??). The UUID is the same for the new partition so I thought the fstab didn't need a change...

Do you think I can still write /dev/hda4 in the fstab instead of that UUID stuff? I'll try that later (when I'm home again ;-) ).

Last edited by Thoddy; 08-29-2007 at 04:40 AM.
 
Old 08-29-2007, 04:43 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by Thoddy View Post
They both have the same UUID because one is a copy of the other
I would find that extremely unlikely.
Re-gen the UUID, or use the old /dev/[sh]da? namespace.
 
Old 08-29-2007, 04:50 AM   #5
Thoddy
Member
 
Registered: Jul 2003
Location: Bremen, Germany
Distribution: Ubuntu 9.10
Posts: 106

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by syg00 View Post
I would find that extremely unlikely.
Re-gen the UUID, or use the old /dev/[sh]da? namespace.
How could I re-gen the UUID? "vol_id" is for reading only, isn't it?
 
Old 08-29-2007, 04:55 AM   #6
Thoddy
Member
 
Registered: Jul 2003
Location: Bremen, Germany
Distribution: Ubuntu 9.10
Posts: 106

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Thoddy View Post
How could I re-gen the UUID? "vol_id" is for reading only, isn't it?
OK, I found this one here:
http://paulgoscicki.com/archives/200...schizophrenia/

So, using dd for cloning partitions DOES also copy the UUID... very UNIQUE... ;-)


The following command creates a new UUID:
tune2fs -U random /dev/hda4


Hopefully I can generate a new UUID, enter that in both the fstab and grub/menu.lst and be fine... :-)
 
Old 08-29-2007, 04:55 AM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
"man uuidgen" would be a good start.
As you noted above it needs to be amended in both menu.lst and fstab.
 
Old 08-29-2007, 10:42 AM   #8
Thoddy
Member
 
Registered: Jul 2003
Location: Bremen, Germany
Distribution: Ubuntu 9.10
Posts: 106

Original Poster
Rep: Reputation: 15
Smile

Quote:
Originally Posted by syg00 View Post
"man uuidgen" would be a good start.
As you noted above it needs to be amended in both menu.lst and fstab.

YES!!

It turns out the UUID really was copied and need not be changed after all. I simply cloned the defect partition to a new one, that new partition was assigned the same UUID (by using gparted - or dd in general). After that the old (erroneous) partition could be deleted...

Only thing I did wrong all the time is re-installing grub: it was no wonder installing didn't work out - booting ubuntu from CD means that the partition is mounted somewhere but not "/", so when installing grub the

grub-install --root-directory=bla "(hd0)"

is needed!!

plus: the partition entry with correct UUID is need in both /boot/grub/menu.lst and /etc/fstab, AND an entry for the hard disk device (for me (hd0) ) is needed in /boot/grub/devices.map!

Now it works just as I wanted it to! But thanks anyway: I learned a lot about UUIDs... :-)
 
Old 08-29-2007, 03:38 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,125

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by Thoddy View Post
I learned a lot about UUIDs...
As did we all I suspect.
Personally I don't like using UUID, as I use a lot of different distros, and wind up reformatting (and moving) a lot of partitions.
Just causes grief IMHO.
 
Old 08-29-2007, 04:01 PM   #10
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
UUID has its place in Linux and I thought the OP has handled it rather well.

Ubuntu is among the early distros switching to by-UUID method to identify a hard disk partition. This scheme works OK in SCSI/Pata/Sata/USB disks because a withdrawal of an old disk and insertion of a new disk can upset the disk names making it nearly impossible to pin down which one is sda, sdb, sdc etc.

For example one can run happily a Sata as sda but an insertion of a Pata can make the same Sata to become hdb because certain mobo scan the Pata controller first before scanning the Sata controller. ALthough SCSI disks are not common in the home computer market but an eSata disk may run as a SCSI variant and will grab the sda status if inserted, making the original Sata sda to become sdc. A lot of unknowns have yet to come out and so the by-uuid method should not be dismissed out of hand yet.
 
Old 08-30-2007, 02:48 AM   #11
Thoddy
Member
 
Registered: Jul 2003
Location: Bremen, Germany
Distribution: Ubuntu 9.10
Posts: 106

Original Poster
Rep: Reputation: 15
Question

Quote:
Originally Posted by saikee View Post
For example one can run happily a Sata as sda but an insertion of a Pata can make the same Sata to become hdb because certain mobo scan the Pata controller first before scanning the Sata controller. ALthough SCSI disks are not common in the home computer market but an eSata disk may run as a SCSI variant and will grab the sda status if inserted, making the original Sata sda to become sdc. A lot of unknowns have yet to come out and so the by-uuid method should not be dismissed out of hand yet.
OK, I see there are advantages! Just came very surprising and it is also surprising that cloning a partition causes the same UUID... ;-)


I have another (or follow-up) problem: the new partition has errors, that's what ubuntu tells me when booting - but there are none: I checked using the Live-CD!

Does cloning a partition also clone file system errors!?

Please have a look at http://www.linuxquestions.org/questi...87#post2875387
 
Old 08-30-2007, 04:13 AM   #12
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
Yes.

In using dd the program reads the "1" and "0" of the source disk/partition in the number of sectors defined by the bs parameter and duplicates them on the specified target.

You get exactly 100% of the mirror image of the original, including the filing system, boot sector, errors, virus etc etc.

I think the by-uuid is a product whenever a filing system is created and may be part of the filing indexing or accounting system in the boot sector. I have no idea how Linux would tackle two identical uuid names in the same disk. My guess would be the name is supposed to be unique and the kernel may load the first one it encounts. I did clone a few disks before but the same uuid was on different disk and nothing unusal was reported.
 
Old 08-30-2007, 04:19 AM   #13
Thoddy
Member
 
Registered: Jul 2003
Location: Bremen, Germany
Distribution: Ubuntu 9.10
Posts: 106

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by saikee View Post
Yes.

In using dd the program reads the "1" and "0" of the source disk/partition in the number of sectors defined by the bs parameter and duplicates them on the specified target.

You get exactly 100% of the mirror image of the original, including the filing system, boot sector, errors, virus etc etc.
OK, so that is not what I wanted - I cloned the erroneous partition to get rid of the errors. It seems I still need to do a full new install!? :-(

Or is there a way to do a "cp -r" that includes keeping ownership and rights of the files being copied? Then I may get around a fresh install which I do not want since it usually takes ages until all software is installed as previously was...


Quote:
I think the by-uuid is a product whenever a filing system is created and may be part of the filing indexing or accounting system in the boot sector. I have no idea how Linux would tackle two identical uuid names in the same disk. My guess would be the name is supposed to be unique and the kernel may load the first one it encounts. I did clone a few disks before but the same uuid was on different disk and nothing unusal was reported.
That's also my impression. But actually, I didn't test it. What's handy here is that after cloning the UUID entries in fstab need no change! Only thing that has to be dine is setting root to the new partition (hd0,3) or what in the grub/menu.lst ...
 
Old 08-30-2007, 07:57 AM   #14
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
Got the feeling you may be barking to the wrong tree.

The /boot partition contains nothing but the Grub directory, the kernel and the initrd files. If your root filing system has a problem then it has nothing to do with /boot. Therefore your /boot may be working perfectly.

The sequence of the event is Grub loads the kernel from /boot. Kernel does the hardware detection and loads the rest of the Linux from the / partition. You may need to do something about the partition that mounts /. This command should tell you something about the integrity of the partition
Code:
fdisk -l
 
Old 08-31-2007, 02:13 AM   #15
Thoddy
Member
 
Registered: Jul 2003
Location: Bremen, Germany
Distribution: Ubuntu 9.10
Posts: 106

Original Poster
Rep: Reputation: 15
Smile

Quote:
Originally Posted by saikee View Post
Got the feeling you may be barking to the wrong tree.
It was in deed two problems at the same time:
  1. file system error The "old" partition had an error. Cloning it to a new partition also clones this error. I got around this problem by copying everything using "cp -r -p ...". Then I only needed to re-install grub and was all set.
  2. last mount time in the future This is some strange issue that a lot of Debian / ubuntu users seem to have noticed. Some program (I am still unsure which one - maybe esfsprogs) writes to the partition with UTC and not using the timezone offset. So when booting the last mount time and last write time were in the future which is interpreted as an error - basically this is an endless process of booting, checking the file system and re-booting and checking and ... I live in the Berlin timezone (+2 hours), so all I had to do is shut down the PC and wait for 2 hours. After that it all went smoothly... ;-)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
dual booting fedora with vista - boot error - "GRUB loading stage 2" ans Fedora 2 08-20-2007 06:12 AM
Installing fedora 7 "error loading grub lanucher" bailey239 Fedora 1 07-20-2007 09:32 AM
Startup error "loading GRUB" error 17 Translucent Ubuntu 2 09-02-2006 12:17 AM
FC4: "GRUB Loading Stage2... read error" at startup Kropotkin Fedora 2 12-01-2005 05:29 PM
Boot problem: "GRUB Loading stage2read Error" after installing PCI Ethernet card nsyng Fedora - Installation 1 06-06-2005 06:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration