1

I screwed up my Ubuntu system, so now I need to format and reinstall Ubuntu, but I don't have any USB drives or CD/DVDs

enter image description here

It looks like this now. I only have Ubuntu, so I don't have dualboot of any kind.

I was thinking about creating a new partition from the unused space in /dev/sda2 for my backup stuff and then create another partition to install a bootable Ubuntu on, then I'll boot into that bootable partition and then format and install Ubuntu on /dev/sda2 again.

Is it possible for me to achieve something like this?

Jeggy
  • 3,122
  • 16
  • 57
  • 80

2 Answers2

2

I found a way which requires an rooted Android device.

You need to download this app: DriveDroid - Google Play. And move a Ubuntu iso file to your Android device and use the app to make Android bootable with that iso and then use your computer to boot from it.

enter image description here

I had issues with I couldn't do anything with my /dev/sda2 partition even when booting from Android. So I downloaded GParted live iso and used GParted to shrinken my root partition and make a backup partition, then I used Ubuntu to move my files from my root partition to the new backup partition.

Then set Android to be a Ubuntu bootable again and install ubuntu from there. Then copy my files and used gparted again to make my new ubuntu use the old backup partition.

Jeggy
  • 3,122
  • 16
  • 57
  • 80
1

Based on comments, you must have a wired internet connection to use netboot.

Download the appropriate initrd.gz file and the appropriate linux file for your architecture and distribution from here.

Save them inside /boot. (These files are quite small, under 10MB for either architecture.)

Reboot your computer and enter the grub menu. Now we will get grub to boot from the files you just downloaded.

Press c to get a grub command prompt. Type each of the following lines:

root=(hd0,1)

Replace hd0,1 with the drive and partition on which your /boot is located. You can look at and copy the root line of any existing boot menu entry if you are at all unsure what this is, or you can try tab-completing after root ( or root (hd0,.

Now type

linux /boot/linux

Then

initrd /boot/initrd.gz

Finally type

boot

Your system should now boot into the Ubuntu installer. Follow the instructions from there.

Here is the official documentation for netboot.

Mark Kirby
  • 18,949
  • 19
  • 79
  • 116