3

I am working with the assumption I have a computer with a single hard drive, no USB connectivity and no access to external disks (no optical, diskette or network drives). No PXE either, of course.

The hard drive contains a single partition (such as ext4), with a working Ubuntu installation. Somehow, I have managed to download a recent ISO LiveCD image to this hard drive (such as 14.04.2). I would now like to install the LiveCD system to the hard drive, replacing the existing system.

Note: this is not a real situation, just something I have thought up to torture myself. And others. ;-)

What I have so far:

  • The first step was to configure GRUB2 to boot from the ISO image. This works, following instructions given in this link: http://www.howtogeek.com/196933/how-to-boot-linux-iso-images-directly-from-your-hard-drive/
  • Once in the live session, I run ubiquity (the Ubuntu installer). In manual hard drive selection, I specifiy using the hard drive's unique partition, but not to format it. I have previously removed the former operating system, deleting directories /bin, /lib, /usr, etc. (but retained /boot and the place where I have the ISO image file).
  • Ubiquity complains it needs to unmount partitions on /dev/sda, even though I have specified no changes are to be made to the existing partition.
  • I have also tried to boot the Ubuntu LiveCD ISO image file completely to RAM (kernel parameter: toram). This works with >= 4 GBytes RAM. Once inside the LiveCD, I manually unmount /dev/sda1. The unmount works, and the LiveCD continues working correctly; i.e. I can run applications from the menu. But the installer still blocks, this time complaining it cannot access the LiveCD. This also happens just after the partitioning stage of the install process.

I have read the responses to a similar question here Can I install Ubuntu on the same hard drive I booted with? but the answers do not seem to be applicable to my case (they set out from a less complex initial situation.)

Any ideas on how to proceed from here?

ALAN WARD
  • 542

2 Answers2

2

Boot to RAM, unmount partitions, use gparted to create a small partition 1-2gb, copy iso image there, set up grub to boot iso. boot iso. install. Hope this will work

Fraha
  • 21
0

Here is a detailed solution to this problem, my solution is based on the guidance of Fraha's answer.

  1. Boot into RAM: Go to rescue mode
  2. Mount tmpfs, and copy iso into tmpfs.
  3. Umount disk /dev/sda; Use gdisk to create 2 partitions, 500M for EFI parition(/dev/sda1), 20G for ISO parition(/dev/sda2).
  4. mkfs.vat /dev/sda1
  5. dd iso into ISO parition
  6. Mount /dev/sda1 into /mnt/efi, mount /dev/sda2 into /mnt/iso; Copy EFI directory in the /mnt/iso into /mnt/efi/; Edit /mnt/efi/EFI/BOOT/grub.cfg, replace search root with set root=(hd0,gpt2).
  7. Reboot into the ISO installation page, then install the OS into the free disk space.