How to remove a second Ubuntu install?

15,311

Solution 1

Boot in to Ubuntu installation that you want to keep. Delete the partitions for the other Ubuntu install and run update-grub.
So if you want to keep your old linux installation and get rid of the one you installed later, just boot into your old linux installation and start gparted or disk-utility (which ever you like). From there delete sda4, sda5, sda6, sda7 and sda8 i.e all the partitions you created for new installation of Ubuntu. Now open terminal and run sudo update-grub. This will update the grub and remove the other Ubuntu install from the grub startup screen.

Solution 2

You can perform the following steps:

  1. comment out the lines for sda1 and sda3 in your /etc/fstab. this prevents them from being mounted.

  2. reformat (and maybe even repartition) the two partitions. However, merging them will most likely only work, if they are stored physically behind each other on the disk.

  3. invoke update-grub to make grub refresh its menu.

But be careful, your computer seems to boot from sda1. Depending on how you installed the second ubuntu, you might have to mark the new root / boot partition as bootable.

Share:
15,311

Related videos on Youtube

moraes
Author by

moraes

Updated on September 18, 2022

Comments

  • moraes
    moraes over 1 year

    I installed Windows XP in dual-boot with Ubuntu to play Skyrim and that ended up breaking GRUB. After trying zillions of things to fix it (including using boot-repair), I installed Ubuntu in a new partition, side-by-side with the old Ubuntu and XP. After that GRUB worked again and I can now access my old Ubuntu and XP, but now I have two Ubuntus and I want to drop the new one. How do I do that without breaking GRUB again?

    Here's the result for sudo fdisk -l:

    Device      Boot    Start       End     Blocks      Id  System
    /dev/sda1   *           1       17303   138986316   83  Linux
    /dev/sda2           19799       29359    76798732+   7  HPFS/NTFS
    /dev/sda3           29360       30401     8369865   82  Linux swap / Solaris
    /dev/sda4           17304       19798    20040705    5  Extended
    /dev/sda5           17304       17595     2343936   83  Linux
    /dev/sda6           17595       18811     9764864   83  Linux
    /dev/sda7           18811       19677     6952960   83  Linux
    /dev/sda8           19677       19798      975872   82  Linux swap / Solaris
    

    sda1 and sda3 are my old Ubuntu, sda2 is Windows XP, and sda4 to sda8 are the new Ubuntu install (I created different partitions for /boot, / and /home, should not have done that just to fix GRUB).

    And /etc/fstab looks like this:

    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    proc            /proc           proc    nodev,noexec,nosuid 0       0
    # / was on /dev/sda1 during installation
    UUID=e41d0403-82db-4379-9d3e-b67cb06fc08d /               ext4    errors=remount-ro 0       1
    # swap was on /dev/sda5 during installation
    UUID=5a54507a-82f0-4275-b531-f88b9cfabbcb none            swap    sw              0       0
    

    And here is the report from Boot-Repair:

    http://paste.ubuntu.com/740188/

    And here is the list from /dev/disk/by-uuid:

    ubuntu@ubuntu:~$ ls -la /dev/disk/by-uuid
    total 0
    drwxr-xr-x 2 root root 140 2011-11-16 13:21 .
    drwxr-xr-x 6 root root 120 2011-11-16 13:19 ..
    lrwxrwxrwx 1 root root  10 2011-11-16 13:19 11F7-4048 -> ../../sdb1
    lrwxrwxrwx 1 root root  10 2011-11-16 13:19 40b84b5c-dd62-4267-a41c-e5afc0c178a4 -> ../../sda3
    lrwxrwxrwx 1 root root  11 2011-11-16 13:19 82672ddd-82ac-4d41-98c2-fc359f248f3b -> ../../loop1
    lrwxrwxrwx 1 root root  10 2011-11-16 13:21 DE34ED7A34ED5655 -> ../../sda2
    lrwxrwxrwx 1 root root  10 2011-11-16 13:21 e41d0403-82db-4379-9d3e-b67cb06fc08d -> ../../sda1
    
    • jrg
      jrg over 12 years
      Did you install it via Wubi?
    • moraes
      moraes over 12 years
      No, I just created a new partition, booted from Windows CD and installed it.
    • moraes
      moraes over 12 years
      I mean, I never used Wubi I think. Ubuntu is my main OS, and I installed it using the distribution from ubuntu.org. Windows came only these days.
    • Michael K
      Michael K over 12 years
      can you add the output of ls -la /dev/disk/by-uuid please? You have two swap partitions, which is unusual.
    • moraes
      moraes over 12 years
      @MichaelK I updated it with that info. I created a second swap for the second Ubuntu install. But I no longer have it, as I deleted the partitions sda4,sda5,sda6,sda7,sda8 following previous answers. I also added the output from Boot-Repair, got while I am on the live-USB.
    • Michael K
      Michael K over 12 years
      yes now you need to change your fstab to use the correct swap partition, else it cannot be mounted during boot. just replace the uuid in the swap line of the fstab by the uuid of sda3 you got in the output of by-uuid (5c-dd62-4267-a41c-e5afc0c178a4)
    • Michael K
      Michael K over 12 years
      can you as well say, where the boot process stops? What messages are printed on the screen? Maybe a screenshot? By the way, grub2 can also be configured the way that it performs a quiet boot.
    • moraes
      moraes over 12 years
      Re: where the boot process stops. It doesn't even start, it seems. All that appears in the screen is: "error: no such partition. \n grub rescue>" and a prompt. I'd learn how to take a screenshot from command line but there's nothing more than that, really. I'll try to change fstab now.
  • moraes
    moraes over 12 years
    sda1 and sda3are the ones I want to keep, so I'll take that you mean sda4 to sda8. These latter ones are all close to each other in the disk, and I can merge to sda1 in the end (the space was taken from sda1 for the new Ubuntu install).
  • moraes
    moraes over 12 years
    I updated the question with the contents of /etc/fstab. I'm not sure if I have anything to comment out from there. When I run update-grub, it finds the new Ubuntu on /dev/sda6. I need to discover how to make GRUB ignore that one.
  • Michael K
    Michael K over 12 years
    ah okay... well the change in fstab is only necessary to prevent your new linux from trying to mount a partition which you later delete. This is not the case for you. So now you can remove (delete) the partitions of the linux installation you want to remove and invoke update-grub. (update-grub will detect both linux versions as long as both are present) However, if you were to delete sda1 you would run into trouble.
  • moraes
    moraes over 12 years
    I did that. Deleted partitions from new Ubuntu using gparted, then ran update-grub. Now I'm on the Live CD because GRUB got borked again. :-(
  • moraes
    moraes over 12 years
    For some reason that did not work. I deleted the partitions, ran update-grub and restarted. GRUB is borked again and I am on the Live CD.
  • binW
    binW over 12 years
    the above link is for grub2 and the step 13 i.e "Reinstalling GRUB 2 from LiveCD" is the one you need to follow. In case you a version of Ubuntu with Grub (not Grub2) then you can use the steps mentioned at ubuntuforums.org/showthread.php?t=224351 to reinstall grub
  • moraes
    moraes over 12 years
    Thank you, sir. And to everybody who helped. I'm back to my old Ubuntu and the new one is finally gone. :)