Link to home
Start Free TrialLog in
Avatar of JulienVan
JulienVanFlag for France

asked on

How to boot on Ubuntu installed on external USB drive?

Hello,

I've installed Ubuntu on a SATA hard disk that I've put in an USB device to transform it in a USB drive.

My internal drive has Windows XP installed on it.

How can I boot in Ubuntu when I connect my USB drive?

Enclosed are screenshots of my attempt to boot on USB drive:
 User generated image User generated image
Thanks
Avatar of Mavrickk
Mavrickk

jbjkgbgiufufvlfvligikkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkh
Avatar of rockiroads
from the second screenshot you seem to have got into the bootloader
looks like you need to do more, have a read of this grub bootloader tutorial http://www.linuxjournal.com/article/4622
I haven't got your setup but check out the ubuntu forums https://help.ubuntu.com/community/GrubHowto
Enter the following command, when you get the screen as shown in your second screenshot.
grub> root (hd1,0)
grub> kernel /vmlinuz
grub> initrd /initrd.img
grub> boot
Have you installed Ubuntu on your usb drive? or are you working with a bootable usb drive with a live version of ubuntu on it?  Also take a look at Unetbootin
Avatar of JulienVan

ASKER

Thanks for you comments guys, I'll take a look at your links for understanding how grub is working.

@ssapkota: I tried your commands, but the kernel command seems to not be known, as you can see on enclosed image

@tmaleshafske: I've installed Ubuntu on my USB drive. But it wasn't USB when I installed it, it was my primary and unique HDD. I then connected it as a USB drive on my laptop with Windows XP.

I'd really like to boot on my USB drive where is installed Ubuntu without modifying the boot sector of my primary internal drive where is installed Windows XP.
IMAG0152.jpg
SOLUTION
Avatar of ssapkota
ssapkota
Flag of Nepal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@ssapkota: Thank you for your help, I went further by using the linux command, but I still have some errors, as you can see on enclosed screenshot.
I'll take a look on all the documentation this evening.
IMAG0154.jpg
Have you successfully booted into the USB device earlier?

Can you boot successfully if you follow following steps:
- Plug out the Hard drive (where you have installed windows).
- Now try and boot into the ubuntu from external USB drive.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@tobias: Thanks for your suggestion, I tried but I obtain following error when trying to mount the drive
Screenshot-250-GB-Hard-Disk--TOS.png
mount-attempt.png

Mind the space. There's no space between /dev/sdb1 and /mnt

sudo mount /dev/sda1 /mnt
sudo mount –bind /dev /mnt/dev
sudo chroot /mnt
sudo update-grub
Sorry, its sdb in your case:
sudo mount /dev/sdb1 /mnt
sudo mount –bind /dev /mnt/dev
sudo chroot /mnt
sudo update-grub
Yes, try again with a space!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry you were right, I forgot the space.
The commands cause following errors, would you know why?
Screenshot1.png
Screenshot2.png
Can you boot into your Ubuntu from the external hard drive? If so:

"If you had alternate OS entries, update-grub might say "Cannot find list of partitions!". Ignore it and continue - once you can boot into your linux installation, do so and then rerun update-grub and grub-install /dev/sdb as root. " - But first check that your external hard drive still is sdb!!!

Regards, Tobias
@Tobias: It worked !
I had a message telling that it couldn't mount (hda, 1) twice but it then booted successfully under my Ubuntu.

Enclosed is a screenshot of the terminal after having entered the commands you told me.

I'm going to reboot without my USB HDD to check that Windows still boots correctly.
grub-install.png
Good news, when I booted without the USB drive, Windows loaded correctly.

Bad news, when I restarted the computer with the USB drive connected and chose to boot from USB device, the grub terminal opened and I still have the same errors when entering the grub commands, as you can see on these screenshots.
IMAG0160.jpg
IMAG0163.jpg
ok.

Can you try do the process again, but don't run the last command (sudo grub-install /dev/sdb)?

boot an Ubuntu LiveCD and start a terminal window. Then run:

sudo mount /dev/sda1 /mnt
sudo mount –bind /dev /mnt/dev
sudo chroot /mnt
sudo update-grub

Boot the machine on the USB-disk, start a terminal window. Then run:

sudo update-grub

Regards, Tobias
and in your case, it should be sdb!!

sudo mount /dev/sdb1 /mnt
sudo mount –bind /dev /mnt/dev
sudo chroot /mnt
sudo update-grub
and it always best to check with

sudo fdisk -l

before you run the 'sudo mount /dev/sdb1 /mnt' command!
Thanks Tobias, it works like a charm. Except that following error message appears twice before executing Ubuntu:
error: hd0, 1 out of disk

Do you think that it can cause some problems? Or maybe affect the boot sector of Windows?
Is it sure that booting on Ubuntu using this method will not damage my Windows system in the future?
Can I mount the windows drive to read and write files on it with no risk?

Thanks again!
What Ubuntu version do you have on your external USB drive? This error might be a bug when booting from external drives.

Ref: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/477430

Regards, Tobias
It is version 10.04.
ok, yes the bug affected 10.04 as well. Maybe you can boot even though you're getting the error? I know it's irritating to have error messages, but I'm afraid I don't know what's causing the error.

You could start Grub in command line mode and then run the boot commands step by step to see which one is causing the error. Then you can edit the /etc/grub.d/10_linux file if you find out which commands should be removed to get rid of the error. And after this run 'sudo update-grub'.

Regards, Tobias
OK I'll take a look at this when I'll have some times. I'm closing the question, thanks for your help everyone!