[SOLVED] Grub, post clone, problem (but it still boots and works OK).
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Grub, post clone, problem (but it still boots and works OK).
For backup I alternate two 1TB drives (I plan on adding an additional backup disk some day).
Every few weeks I clone my working drive to the other one.
I then use the newly written drive as the working drive and keep the other on a shelf.
This worked OK until the 2nd of August 2013 when an update to the OS (Mythbuntu 12.04) could not find grub.
It expected to find grub on the drive that was the source for the last clone (I assume).
Help screens got me through this, so everything works just fine now.
My question: How do I avoid a repeat of this ?
Post clone is there a file I can edit (or restore) so that updates do not go looking for grub where it can't be found ?
Any suggestion ?
I have a screen grab "Configuring grub-pc" but as this is my first post under this user name attachments are not permitted.
Running: sudo find / -name '*grub-pc*' brings up several candidates. Where is the grub-pc referred to located ?
I'm trying this forum before an "Ask Ubuntu" forum as the answer may be non distribution specific.
Did you have a kernel upgrade? Did you run sudo update-grub after? I don't regularly use Ubuntu but I would think with a kernel upgrade it should run update-grub??
I'm not really sure how you are doing this. When you switch to the cloned drive from the first, do you change the boot drive in the BIOS each time?
@yancek
I did not scroll down to see all the updates I was loading but I'm fairly sure the kernel was not updated (last kernel update was about a week previous). I did not run sudo update-grub (but it could have been run by the auto updater). Some of the updates can be seen in the attached screen shot. I make no bios changes. Both drives are identical (well nearly identical, they have slightly different model numbers and of course different serial numbers). This computer has two sata trays that makes things easy (no need to take off any covers to change hard drives). I put the target drive in the unused sata tray and use clonezilla to clone the current drive to it. I just pull the source drive out and leave the other drive in (with the power off of course). I power up on the newly cloned drive (which will be sda as that is the only drive in the computer then). I've been doing this for a few months and this is my first problem. Note: the computer has never refused to boot, the only problem showed up while doing one of the regular updates that Cannonical provides.
@jailbait.
I can post attachments now so I'll post my screen grab (not the first error screen, unfortunately I did not have the presence of mind to grab that one, this was a subsequent (maybe the subsequent) screen that came up after I clicked on "Help".
Anyway the help advice I adopted was "If you are unsure which drive ... install grub on all of them" so I ticked both /dev/sda and /dev/sda1 (see attachment). That screen shows that the model number was given for the disk sda. That is the disk that was plugged in and working. The source disk that this disk was cloned from has a different model number (it was not plugged in). I wonder if the update was looking for the model number of the disk that this disk was cloned from (which of course was not available since it was waiting on a shelf for the next clone cycle).
Best regards dogphlap.
Last edited by dogphlap; 08-03-2013 at 10:53 PM.
Reason: removed duplicated line.
Are you suggesting:
Prior to cloning a drive:-
Copy the file /etc/fstab from the target drive to a thumb drive.
Clone the working drive to the target drive.
mv /etc/fstab on the freshly written drive to /etc/fstab.old
copy the saved fstab from the thumb drive to the freshly written drive as /etc/fstab
sudo chmod 644 /etc/fstab
sudo chown root:root /etc/fstab
If you meant something else could you expand on your comment please.
I left out the question mark in the first paragraph because I wasn't sure where to put it.
Sorry I'm dumb.
I now think you meant you wanted to see the result of cat /etc/fstab.
Here it is:
dogphlap@dogphlap-P5Q-PRO:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=981eaf24-6300-4b45-8b83-2defe6562175 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=cc51ebe4-b786-40a4-b1e6-417c23c8edb8 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
dogphlap@dogphlap-P5Q-PRO:~$
If you would like to see the same only from the current back up disk I can post that also (just let me know).
OK, so I need to ensure fstab is reflecting reality as to the UUID of the hard disk.
man update-grub tells me that update-grub generates a grub2 config file by using grub-mkconfig.
Does that use the UUID info in fstab (i.e. fstab should be correct before running update-grub) or does it get the information it needs by directly interrogating the hard drive(s) or some other file ?
I think you have solved my problem. I'm just trying to clarify some details. I've always been a bit scared of grub, even more so of grub2 which seems so convoluted.
I have just re-read your last but one post and I see you have already answered my question as to where grub gets the boot disk UUID from, it get it from fstab when update-grub is run to create a grub config file.
I think I can mark this thread as solved. I'll just wait a few hours to see if you or others add anything further. If you think I have this wrong please correct me.
Best regards to all who have contributed and everyone else.
I have just re-read your last but one post and I see you have already answered my question as to where grub gets the boot disk UUID from, it get it from fstab when update-grub is run to create a grub config file.
I think I can mark this thread as solved. I'll just wait a few hours to see if you or others add anything further. If you think I have this wrong please correct me.
Best regards to all who have contributed and everyone else.
I would just run
Code:
blkid
then open another terminal
Code:
nano /etc/fstab
& change the UUID to reflect the present drive by erasing only the UUid & copying & pasting the 1 from blkid.
Then update-grub
dogphlap@dogphlap-P5Q-PRO:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda1 during installation
UUID=981eaf24-6300-4b45-8b83-2defe6562175 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=cc51ebe4-b786-40a4-b1e6-417c23c8edb8 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
dogphlap@dogphlap-P5Q-PRO:~$
I repeated cat /etc/fstab after the sudo blkid for ease of comparison.
The UUIDs are the same (I did not mention it but I actually checked this earlier, prompted by the output of cat fstab).
I'm 17 hours ahead of you (it is 1:00pm in Oakland and 6:00am the next day in Eastern Australia) so if it seems I have been tardy in replying it might just be I was asleep.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.