LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Ubuntu on external drive boots only on one computer, GRUB gives error on others (https://www.linuxquestions.org/questions/ubuntu-63/ubuntu-on-external-drive-boots-only-on-one-computer-grub-gives-error-on-others-941920/)

Basilios 04-26-2012 02:10 PM

Ubuntu on external drive boots only on one computer, GRUB gives error on others
 
I have a USB hard drive with an Ubuntu 11.10 installation I created using my desktop machine. My reason for doing this was to to have the same Linux environment on other computers as well, as often I have to work away from home.

Well, today I tried to use that drive with my laptop while I was on the road, but I got a GRUB error message: "Out of disk". When I got home, I tried the same USB drive on my wife's laptop, and got a different GRUB error message: "File not found".

I then tried the drive on my usual desktop machine - and it worked. No problem at all. I am in fact typing this in the Linux environment installed on that very hard drive.

Having different error messages originally made me think it could be a problem with the installation, or even the hard drive itself, but that installation works reliably on my desktop machine.

What can I check? Any suggestions?

yancek 04-26-2012 05:09 PM

When you installed Ubuntu to the external usb hard drive, did you intall its' Grub2 bootloader to the master boot record of that (the external) drive?

When you connected the external to the laptop, did you go into the BIOS of the laptop and select the external hard drive to boot from?
Without knowing how you boot your Desktop (which bootloader, where it is) and the drive/partition configuration of your laptops, it will just be guessing. You could go to the site below and download and run the bootinfoscript after reading the instructions and post the results.txt file here to get some help. Have your external attached to your Desktop when you do it.

http://sourceforge.net/projects/bootinfoscript/

Basilios 04-26-2012 05:59 PM

1 Attachment(s)
Quote:

Originally Posted by yancek (Post 4663929)
When you installed Ubuntu to the external usb hard drive, did you intall its' Grub2 bootloader to the master boot record of that (the external) drive?

Yes, the external drive has Grub2 installed in its MBR. All the computer involved do not have Grub, being primarily Windows machines.

Quote:

Originally Posted by yancek (Post 4663929)
When you connected the external to the laptop, did you go into the BIOS of the laptop and select the external hard drive to boot from?

Yes. Also tried going through the boot menu, where you explicitly pick the specific drive you want to boot from, and picking the USB drive - same results.

Quote:

Originally Posted by yancek (Post 4663929)
Without knowing how you boot your Desktop (which bootloader, where it is) and the drive/partition configuration of your laptops, it will just be guessing. You could go to the site below and download and run the bootinfoscript after reading the instructions and post the results.txt file here to get some help. Have your external attached to your Desktop when you do it.

The output of bootinfoscript, the file RESULTS.txt, is attached. From what I know of the disk sizes, the external drive should be sdd.

yancek 04-26-2012 08:06 PM

The interesting thing about your results.txt output is the fact that your Ubuntu is on sdd1 yet your grub.cfg file shows the following entry:

Quote:

set root='(hd1,msdos1)'
The grub.cfg entry above is pointing to the second hard drive, first partition. Grub2 counts hard drives from zero and partitions from one. If you had all four drives attached when you installed Ubuntu, I would expect the Ubuntu grub.cfg entry to look like:

Quote:

set root='(hd3,msdos1'
Sorry, but I don't have any solution. The only thing I would try is changing the (hd1...) to (hd0...) in the menuentry and test it on the desktop and laptop. Do this by manually editing, do not run update-grub. If it fails, just edit back to the original. Just a guess?

syg00 04-26-2012 08:49 PM

Two different machines.
In future, before you attempt an install on an external drive, ensure the BIOS has been changed to have the DVD/CD first, the external next, then the normal (internal) boot disk. Then just install to the MBR of the first (i.e. external) disk.
Then change the BIOS back if you want.
On other machines you will just need to change the BIOS to boot the external, as you had planned I guess.
If you can just re-install after doing that, good, else it gets a little messier.
Lets us know which way you want to jump.

Basilios 04-27-2012 10:42 AM

I am... confused. I really can't understand why this cannot be fixed without reinstalling. Even if I did, there's no guarantee that GRUB would be installed in a way useful to boot elsewhere if the default behaviour is to hard-code, so to speak, the configuration of the local machine in the grub configuration.

Really, I don't know.

widget 04-27-2012 03:28 PM

I think it would help if you were to give a bit of info on your wifes laptop so we could see the difference in set up.

I assume that the results.text is from the box you installed your Ubuntu from.

It does appear that you only had one other drive detected when you installed grub.

This does not mean you have to reinstall Ubuntu.

What would be nice is if you would, with everything running as in the results you sent, go to your terminal and run;
Code:

sudo update-grub
and then rerun the boot info script and post the results. This should tell us if there is a problem with your grub install.

When you plug in your drive to another box and boot it will be numbered in relation to the drives in that box. So, if you plug it to a box with one drive internally and no other drives it should boot fine.

It should not boot fine, with that menuentry, plugged into a box with 3 internal drives.

However you also have that menuentry calling for set root at a particular uuid. This is why it is booting on your computer.

There is no entry for your 3 MS installs under /etc/grub.d/30_os-prober. Why is this? Did you remove those from the results.text? If not there is a problem there. The script 30_os-prober is enabled to run. If it were not it would not be listed in the results.text.

If you installed Ubuntu with all internals shut down in bios that would be fine. All entries would be generated by 10_linux. That should also have given you a menuentry calling for hd0 not hd1.

What I am saying here is that I don't understand either. Your results.text does not match reality in that the grub.cfg file does not at all match the hardware described in the results.text.

This needs checked on.

One thing that would help is the out put of;
Code:

cat /boot/grub/device.map
I have a dual drive external enclosure that I can use by itself or boot from to my internals. I do understand what you want to do. I don't believe this is an OS problem, just a grub problem.

Basilios 04-27-2012 05:46 PM

1 Attachment(s)
Quote:

Originally Posted by widget (Post 4664819)
I think it would help if you were to give a bit of info on your wifes laptop so we could see the difference in set up.

My wife's laptop is an Asus X5DIJ with one hard drive and one DVD drive, with Windows 7 installed.

My laptop is an Asus EEE 901 with two hard drives, with a Windows XP installation on the first.

Quote:

Originally Posted by widget (Post 4664819)
I assume that the results.text is from the box you installed your Ubuntu from.

It does appear that you only had one other drive detected when you installed grub.

This does not mean you have to reinstall Ubuntu.

Ah, this is where it gets complex. I installed Linux on the troublesome hard drive quite some time ago, and it might have been done on the EEE 901 laptop (the one with two drives) - possibly. I do not remember. I used yet another external drive with Live Ubuntu I intended to use to install Linux wherever needed.

Quote:

Originally Posted by widget (Post 4664819)
What would be nice is if you would, with everything running as in the results you sent, go to your terminal and run;
Code:

sudo update-grub
and then rerun the boot info script and post the results. This should tell us if there is a problem with your grub install.

Done, and I attached the results to this post.

Quote:

Originally Posted by widget (Post 4664819)
However you also have that menuentry calling for set root at a particular uuid. This is why it is booting on your computer.

If that was the case, and since the UUID of the external drive is correct (I checked), why does it not work elsewhere? So complex.

Quote:

Originally Posted by widget (Post 4664819)
There is no entry for your 3 MS installs under /etc/grub.d/30_os-prober. Why is this? Did you remove those from the results.text? If not there is a problem there. The script 30_os-prober is enabled to run. If it were not it would not be listed in the results.text.

I did not edit the results file. I guess that was a result of my messing with /etc/default/grub, where I disabled auto probing not long ago, because I noticed Grub was "picking up" OS entries from various computers. So I disabled it, because I wanted this external drive to only boot the Linux installed there and be independent of whatever was installed or plugged in in any other computer. Not sure if I messed things further.


Quote:

Originally Posted by widget (Post 4664819)
One thing that would help is the out put of;
Code:

cat /boot/grub/device.map

I get an error message: "No such file or directory".

Quote:

Originally Posted by widget (Post 4664819)
I have a dual drive external enclosure that I can use by itself or boot from to my internals. I do understand what you want to do. I don't believe this is an OS problem, just a grub problem.

Good to hear. If I wanted an OS where the only way to solve relatively minor issues is to reinstall the lot, I would just use Windows!

syg00 04-27-2012 07:10 PM

Quote:

Originally Posted by Basilios (Post 4663814)
I then tried the drive on my usual desktop machine - and it worked. No problem at all. I am in fact typing this in the Linux environment installed on that very hard drive.

How old is that "usual desktop" machine - or more pertinent maybe, how old is the BIOS in it ?. Seems to have an interesting implication in the way it (the BIOS) is enumerating the disks.
If I am reading all this correctly you can boot from the external o.k. (on that machine).

Try now after that latest update-grub.

Basilios 04-27-2012 07:21 PM

Quote:

Originally Posted by syg00 (Post 4664974)
How old is that "usual desktop" machine - or more pertinent maybe, how old is the BIOS in it ?. Seems to have an interesting implication in the way it (the BIOS) is enumerating the disks.
If I am reading all this correctly you can boot from the external o.k. (on that machine).

Well, I could always boot that external drive on that machine.

Basilios 04-27-2012 07:29 PM

I just had a more careful look at the RESULTS.txt file, and look what I found and the very end:

Code:

=============================== StdErr Messages: ===============================

xz: (stdin): Compressed data is corrupt

What is that? Is it something I should worry about?

widget 04-27-2012 09:20 PM

The compressed data is a concern. There are only so many things that the boot info script looks at and they all directly concern booting.

You really should have a device.map. Run;
Code:

sudo grub-mkdevicemap
From my file of notes on such things;
Quote:

Writes a new /boot/grub/devicemap. This map
must be correct to boot multiple drives. Always a
good thing to try when having trouble doing so.
My device.map looks like this;
Quote:

root@debian:/home/tom# cat /boot/grub/device.map
(hd0) /dev/disk/by-id/usb-WDC_WD32_00AAJS-00VWA0_DCA270249388-0:0
(hd1) /dev/disk/by-id/usb-WDC_WD32_00AAJS-00VWA0_DCA270249388-0:1
Run the command given to generate the thing. This will be another assurance that grub is working as it should.

That said, the generated file is not really needed and the id and uuid of the drives not completely needed. In your case not even a good idea as they will not match different boxes. What you do need is for grub to know how many drives there are. Just add some more (hd?) to the file. This may help, will not hurt. Leaving all the info in there on the drive(s) in the external is a good idea.

The better way to disable os-prober is to change the permissions on /etc/grub.d/30_os-prober. It is currently enabled as executable. I would change that and then enable it in /etc/default/grub. Probably does not make much difference but that enabled script being over ridden is not going to help your speed anytime update-grub is run. Just an added complexity that is not needed at all.

It would be good to run update-grub with that enabled so that you know it works too. We need to KNOW that grub is all working as it should be.

Basilios 04-28-2012 07:03 AM

2 Attachment(s)
I followed your suggestions, and ran the suggested commands. The device.map file is attached, as well as the new output of the boot info script. Once again I get the message about Compressed data being corrupt. For the life of me I don't really know what happened here.

schneidz 04-28-2012 07:11 AM

Quote:

Originally Posted by Basilios (Post 4664619)
I am... confused. I really can't understand why this cannot be fixed without reinstalling. Even if I did, there's no guarantee that GRUB would be installed in a way useful to boot elsewhere if the default behaviour is to hard-code, so to speak, the configuration of the local machine in the grub configuration.

Really, I don't know.

does grub make use of uuid's ?
my limited knowledge of uuid's is that it is a globally unique identifier for devices so you would be telling grub to find the files it needs to boot from a globally unique location rather than from /dev/sda1 or /dev/sda2 ... or /dev/sdz9 which can change based on which usb port it is plugged into on every pc.

fyi:
Code:

[schneidz@hyper ~]$ cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Wed Mar 17 11:37:06 2010
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or vol_id(8) for more info
#
UUID=b127e33d-78d8-43d6-bfe7-fe404b6823a5 /boot                  ext3    defaults        1 2
/dev/mapper/vg_hyper-lv_root /                      ext4    defaults        1 1
/dev/mapper/vg_hyper-lv_swap swap                    swap    defaults        0 0
tmpfs                  /dev/shm                tmpfs  defaults        0 0
devpts                  /dev/pts                devpts  defaults        0 0
sysfs                  /sys                    sysfs  defaults        0 0
proc                    /proc                  proc    defaults        0 0
/dev/sda2                /media/win                ntfs        defaults        0 0
/dev/sdb1                /media/win/stuff/ide-34        ext2        rw,nosuid,nodev,uhelper=udisks        0 0


Basilios 04-28-2012 07:16 AM

It does, or at least it should make use of UUIDs - the config file for Grub allows their use, and UUIDs do pop up in the RESULTS file, as you can see.


All times are GMT -5. The time now is 10:06 PM.