Skip to content

Recovering from a system boot issue related to UNetbootin

February 20, 2009

Incorrectly configuring UNetbootin can lead to system boot issues, such as not being able to boot to your original desktop any more. One way this can happen is by selecting the Show all drives option. There is a popup dialog in UNetbootin warning you about the boot issues this option could cause:

UNetbootin - Show all drives option

UNetbootin - Show all drives option

If you ignore this warning for whatever reason, things can get sticky.  I did it during one of my first attempts to install UNetbootin to a separate, dedicated ISO partition.  Here is my test setup.   The following two commands can be used to verify your own configuration.  My hard drive is /dev/sda , so if yours is different, such as /dev/hda, adjust your commands accordingly.  (The -l is a lower-case L.)

g33kgrrl@home ~ $ sudo fdisk -l /dev/sda

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device     Boot   Start   End     Blocks    Id  System
/dev/sda1   *        1    1200    9638968+  83  Linux
/dev/sda2         1201    1735    4297387+  82  Linux swap / Solaris
/dev/sda3         1736    9437   61866315   83  Linux
/dev/sda4         9438    9729    2345490   83  Linux
g33kgrrl@home ~ $ df -h
Filesystem   Size  Used  Avail  Use%  Mounted on
/dev/sda1    9.2G  2.1G  6.6G   25%   /
/dev/sda3     59G   13G   46G   21%   /home
/dev/sda4    2.3G  1.4G   29M   99%   /mnt/iso

g33kgrrl@home ~ $

/dev/sda2 is the swap partition.  I am using this configuration and running Linux Mint 5 for testing purposes.  (Ultimately this will all be done on my father’s system, to ease future administration in the event that something goes awry in the future.)  I put a pre-downloaded ISO and the UNetbootin executable on /mnt/iso and then ran UNetbootin from there.  In the Diskimage box I gave the path to the ISO.  I then selected the Show all drives option and pointed it to /dev/sda4 (aka /mnt/iso).

UNetbootin - installing to sda4

UNetbootin - installing to sda4

This led to the next reboot being a UNetbootin-only boot screen. The top title was UNetbootin and my only options were the ones I would have had if I’d been booting to the openSUSE 11.1 KDE4 LiveCD (since that’s the ISO I’d selected). However, because the initrd file that comes with openSUSE 11.1 is not suitable as-is for this kind of use with UNetbootin (as I unfortunately found out later rather than sooner), choosing to boot to openSUSE didn’t boot to a virtual openSUSE LiveCD where I could at least make some repairs. Instead, it left me with an error message that the disk image could not be found and stopped dead in its tracks. There was no way to go back and boot to my old desktop, and no way to finish booting into the virtual LiveCD either. Now what?

First things first.  You’ll need to boot to something other than your hard drive, obviously. This can be a LiveCD or a bootable USB drive. I have LiveCD’s on hand so I booted into Linux Mint 5, which is, as I mentioned, what I’m running as the original desktop.  However, I am going to explain how to fix this from the command line interface (CLI) for a few reasons:

  1. You may not have the luxury of booting to the LiveCD for the same distribution as you are normally running
  2. The GUI (Graphic User Interface) directions for getting this done may vary from distro to distro
  3. You may not even have a GUI available, if the only bootable device you can get your hands on only gives you a CLI

Most commands in this howto will need to be run as root. Remember that Ubuntu/Kubuntu/Mint need sudo in front of the commands to make this happen. Since I’m using Mint here, I’ll be doing this on most of the steps. For other distros you will enter su at the prompt:

guest@localhost ~ $ su
root@localhost ~ #

Most LiveCD’s will not prompt you for a password. In the unlikely event that yours does, try root which is the usual default.

If you look at my original setup above, you’ll see that under normal conditions,  /dev/sda1 is mounted as / and so that’s the partition I’m normally booting to.  Now we will start the fdisk utility with

sudo fdisk /dev/sda

to see what’s going on after the UNetbootin install:

fdisk - start

fdisk - start

If you enter m here, you will see a whole list of fdisk command actions:

fdisk - help

fdisk - help

First I want to see what’s happening, so I enter p for the fdisk command to print the partition table.  That shows me, with a * under the Boot column, that /dev/sda4 is now marked as the partition to boot to.  I want to go back to booting to my usual /dev/sda1, so I turn off the boot flag for /dev/sda4 by entering a for the fdisk command to toggle a bootable flag, and 4 to choose the 4th partition, then I turn on the boot flag for /dev/sda1 by entering a , then 1 .  Now I enter p again so I can make sure it’s all correct:

fdisk - setting boot flag

fdisk - setting boot flag

I see that, indeed, the * is now on /dev/sda1 .  So I enter w to write table to disk and exit:

fdisk - write table

fdisk - write table

You may notice that I got an error here.  This is normal.  Any changes you make to the partition table don’t actually take effect until the next reboot.  (This is true for Windows, too.)  What’s happened is that fdisk has written to the partition table and marked it as busy so that you don’t corrupt it by making changes on top of the changes.  So when ioctl goes to re-read the partition table, it fails and gives you this message.  No sweat.

At this point, just to make sure you’re reading from the modified partition table and everything is on the up-and-up, you may want to reboot.  You’ll still need your LiveCD or other bootable media, however, because there is no boot loader in place yet.

Now it’s time to remedy that by reinstalling grub (the GRand Unified Bootloader.  But since I’m still running on a LiveCD, I’ll first need to make sure my / partition (/dev/sda1) is mounted.  (Again, the -l is a lower-case L.)

sudo fdisk -l /dev/sda

df -h

Here are my results for these two commands:

Check what is mounted

Check what is mounted

My fdisk listing here shows that my hard drive partitions are sda1, sda2, sda3, and sda4. The df -h listing shows that none of my hard drive partitions are mounted.  If your bootable media automatically mounts your / partition for you, you can skip this step.  I used mkdir /mnt/sda1 to make a folder, mounted /dev/sda1 there, and did an ls to make sure everything worked and all the system files, especially the /boot directory, were indeed where they should be:

mount sda1

mount sda1

All clear to reinstall grub .  But since I’m still on a LiveCD, it’s not going to get installed to the right place without specifying where / (the root directory) is currently mounted.  It goes in the format grub-install [OPTION] install_device . So I used:

grub-install --root-directory=/mnt/sda1 /dev/sda



Looks correct – the first hard drive is hd0 and the device name is /dev/sda .  Time to reboot and revel in the normalcy of your old desktop!

Remember, when you go to install UNetbootin to your hard drive, don’t put a check in the Show all devices box, even if your ISO is located on a different partition than / .  Select / anyway and then point the Diskimage box to your ISO path:

unetbootin - proper install

unetbootin - proper install

This way, the UNetbootin option will get added to your existing grub menu instead of replacing it.


No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: