How do I change the device on which ubuntu boots?

I have a laptop with an internal SSD (let's call it samsung-SSD), and I would like to install ununtu 12.04 on an external SSD connected via USB3 (let's call this one vertex2).

I downloaded an ubuntu iso and created a bootable usb key from it.

Then I booted on the usb key, and followed the ubuntu install:

  /dev/sda is the internal samsung-SSD.
  /dev/sdb is the usb key from which I am installing
  /dev/sdc is the external vertex2 on which I am installing.

The install completes, I boot ubuntu this time from the vertex2. But as the usb key is not here anymore, the vertex2 is known as /dev/sdb. Ubuntu tried to boot on /dev/sdc and fails, because /dev/sdc does not exist.

So a BusyBox terminal shows up, with the message

Gave up waiting for root device. Common problems...

In this terminal, I can do the following:

# only vertex2 is plugged
> ls /dev | grep sd
/dev/sda # samsung SSD
/dev/sda1
/dev/sda2
/dev/sdb # vertex2

# removing vertex2
> ls /dev | grep sd
/dev/sda # samsung SSD
/dev/sda1
/dev/sda2

# pluging usb
> ls /dev | grep sd
/dev/sda # samsung SSD
/dev/sda1
/dev/sda2
/dev/sdb # usb stick

# pluging vertex2 in addition to usb stick
> ls /dev | grep sd
/dev/sda # samsung SSD
/dev/sda1
/dev/sda2
/dev/sdb # usb stick
/dev/sdc # vertex2

Now the vertex2 is know as /dev/sdc (as during the the install).

> exit # this command tries to resume the boot process

And this way I can boot on ubuntu.

So my question is: how do I configure ubuntu so that it tries to boot on /dev/sdb instead of /dev/sdc?

Can I achieve that with mount and chroot?

Edit: my fstab:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdc2 during installation
UUID=2586eee0-5f24-462b-b44d-5c9a25aebe6c /               ext2    errors=remount-ro 0       1
# swap was on /dev/sdc5 during installation
UUID=56498034-3361-4d7d-ae7f-dc8e69b582ed none            swap    sw              0       0

What I don't understand is that in my fstab, the vertex2 is known by it's UUID. So it shouldn't matter if it appears as sdb or sdc. And yet I am able to boot only when it appears as sdc... I tried to replace the vertex UUID by sdb in the fstab, and it didn't help. It's like some other file is used to mount drives on boot.


Edit 2: In the boot menu, I can edit entries. If I edit the ubuntu entry (by pressing e), I see this text:

recordfail
        gfxmode $linux_gfx_mode
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd2,msdos2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd2,msdos2 --hint-efi=hd2,msdos2 --hint-baremetal=ahci2,msdos2  25\
86eee0-5f24-462b-b44d-5c9a25aebe6c
        else
          search --no-floppy --fs-uuid --set=root 2586eee0-5f24-462b-b44d-5c9a25aebe6c
        fi
        linux   /boot/vmlinuz-3.5.0-17-generic root=/dev/sdc2 ro   quiet splash $vt_handoff
        initrd  /boot/initrd.img-3.5.0-17-generic

If I change sdc2 to sdb2, and press f10 to resume boot, ubuntu boots sucessfully (no BusyBox prompt).

This text is located in /boot/grub/grub.cfg. But I should not edit it directly. It has this header:

#                                                                                                                                
# DO NOT EDIT THIS FILE                                                                                                          
#                                                                                                                                
# It is automatically generated by grub-mkconfig using templates                                                                 
# from /etc/grub.d and settings from /etc/default/grub                                                                           
#   

I see no /dev/sdc2 in the grub config :

> sudo grep -r "sdc2" /etc/grub.d/
> #no results

Where sdc2 comes from ? How do I change it permanently to sdb2 ? (The change in the boot menu is only temporary.)


You should try setting one of:

GRUB_DEVICE_UUID=2586eee0-5f24-462b-b44d-5c9a25aebe6c
GRUB_DEVICE=/dev/sdb

in the file: /etc/default/grub

Then run: sudo update-grub