How to Uninstall Ubuntu from a Linux Dual Boot

How to Uninstall Ubuntu from a Linux Dual Boot
Page content

Returning to Pure -Insert Linux Distro of Choice Here-

So, you caught the Ubuntu bug and went ahead and setup a dual-boot configuration with your Linux distribution of choice and Ubuntu but are just not feeling it? No worries, the removal of Ubuntu really couldn’t be any easier. In this guide I make a few assumptions; you want to totally remove Ubuntu, you are comfortable working with hard drive partitions and you are using either the grub or grub2 boot-loader. Most modern Linux distributions use either the grub or grub2 Linux boot-loader. If you are unsure which boot-loader your particular Linux boot-loader uses please refer to your distributions website.

Note: We will be working with partitions and anytime you make changes to your hard drive partition table there is always the chance of data loss. That being said, be sure you have a backup of any important files stored on your hard drive.

(Image: https://www.sxc.hu/pic/m/f/fl/flautenbag/103255_linux_desktop.jpg)

Backup Files

The first steps you will want to take before removing Ubuntu from your system is to make sure a) all files on your system are backed up and b) any files on your Ubuntu partition are transfered to another partition. You may not want to keep Ubuntu but you may want to keep some of the files you downloaded while using Ubuntu.

Once you are sure all your data is where it needs to be you are ready to move on to the next step…

Boot Your LiveCD

In this scenario we are going to use Fedora 15 with gnome-shell as an example, but regardless of which Linux distribution you have installed along with Ubuntu, chances are you installed it from a LiveCD. If you have lost your LiveCD you can download another copy from the official website of your distribution of choice. Insert your LiveCD into your computer (this LiveCD can be in the form of a CD, DVD or USB stick), make sure your computer is set to boot from the LiveCD medium and boot into a LiveCD desktop session (do not choose the install option).

Remove Your Ubuntu Partition

Once you are at your LiveCD desktop unmount any hard drives that have auto-mounted and open gparted. gparted is a software program designed to add, delete and modify hard drive partitions on a Linux system and can be found under “Activities” > “Applications”. With gparted open you will want to select your Ubuntu partition and delete it. Once deleted you can expand the partition of your other Linux distribution to reclaim the hard drive space. With this completed you can exit gparted and move on to updating grub to remove the Ubuntu menu item.

Re-install and Update Grub

At this point you will want to install your original grub boot-loader from your Fedora LiveCD (or whatever distribution you are using). Again, terminal can be found under “Activities” > “Applications” on the Fedora 15 LiveCD. You will want to re-install the Fedora version of the grub boot-loader (replaced by the Ubuntu boot-loader if you installed Ubuntu after Fedora) and update the boot-loader to include only your Fedora install. To re-install grub:

Grub2

  1. Boot your Linux LiveCD
  2. Mount your Linux partition. If you have multiple Linux partitions (/home, /tmp, /boot, /) you need to mount the /boot partition.
  3. Open terminal and verify you mounted the correct partition with the command: mount | tail -l. The output from this command should resemble the following: /dev/sda2 on /media/0d104aff-ec8c-44c8-b811-92b993823444 type ext4 (rw,nosuid,nodev,uhelper=devkit).
  4. Re-install grub2 with the following command but substitute the UUID in the example with your UUID: sudo grub-install –boot-directory=/media/0d104aff-ec8c-44c8-b811-92b993823444/boot /dev/sda

Grub

  1. Boot your Linux LiveCD.
  2. Mount your Linux partition. If you have multiple Linux partitions (/home, /tmp, /boot, /) you need to mount the /boot partition.
  3. Using terminal open the grub command-line utility by executing: sudo grub.
  4. Execute: root (hd0, 1) - this is assuming you have Ubuntu installed on the second partition of the first hard drive.
  5. Execute: setup (hd0) - this is assuming that your first hard drive is your boot device. Ubuntu can be installed on any drive but in most cases your BIOS will look at your first hard drives MBR to find the boot-loader.
  6. Execute: quit - to leave the grub command-line utility.
  7. Reboot your system and grub should now function properly.

That’s all there is to it. You have now removed the Ubuntu partition, reclaimed the space and updated the grub boot-loader to reflect these changes. The next time you boot your computer you will only be given the option to boot your lone Linux operating system.

References

  1. Author’s own experience.
  2. Ubuntu Documentation, Recovering Ubuntu After Windows Install