I downloaded the latest LTS release of Ubuntu 18.04. I currently do not have any spare USB or CD/DVD. So, I just want to install or upgrade my current system from that ISO without making any bootable device. Is it possible? If yes, then please tell me the whole process!
2 Answers
Backup! everything will be overwritten.
Copy Ubuntu 18.04 ISO to HDD root, (/).
Edit grub.cfg changing 40_custom as shown:
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "ubuntu-18.04-desktop-amd64" {
loopback loop (hd0,2)/ubuntu-18.04-desktop-amd64.iso
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/ubuntu-18.04-desktop-amd64.iso splash toram --
initrd (loop)/casper/initrd.lz
}
### END /etc/grub.d/40_custom ###
Install Ubuntu as normal, but you only get one chance.

- 19,519
-
Any explanation for the downvote? (hd0,2) may need to be modified depending on where "/" is. – C.S.Cameron May 06 '18 at 23:10
-
If there is a spare partition it might be worthwhile to use it for /home – C.S.Cameron May 07 '18 at 00:09
So using the loopback feature of GRUB, one can boot an iso installed on a partition of you HDD.
Copy the ubuntu ISO to one spare partition. By spare, I mean, one partition that you will not overwrite when installing ubuntu. For example, your NTFS windows partition.
Add an entry in grub configuration for the iso. To do that edit
/etc/grub/40_custom
and add something likeinsmod search_fs_uuid insmod ntfs search --no-floppy --set=isopart --fs-uuid XXXXXXXXXXXXX menuentry '[loopback]ubuntu-18.04-desktop-amd64' { set isofile='/Grub/ISO/ubuntu-18.04-desktop-amd64.iso' loopback loop ($isopart)$isofile linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile locale=en_US.UTF-8 initrd (loop)/casper/initrd.lz }
This needs a little explanation
This will search for your partition by filesystem uuid. So you need to know the uuid of your fs partition. You can use the output of
blkid
for that. Look for UUID not PARTUUID. So replace XXXXXXXXXX with the uuid of your fs.If your partition is not NTFS then you need to insmod the module for your fs like ext4.
The
isofile
variable is relative to the root of your partition, not the root of your current system. For example I have/media/me/Windows10/Grub/ISO/ubuntu-18.04-desktop-amd64.iso
, as the ISO, so I use/Grub/ISO/ubuntu-18.04-desktop-amd64.iso
as the isofileRun
sudo update-grub
Reboot and, in Grub menu, choose the loopback entry. Then do the installation as if booted from USB or DVD.

- 9,231
-
What if you do not have a spare partition? Even with a spare partition, if something goes wrong with the install the old install including grub will be gone the same as with my answer. – C.S.Cameron May 07 '18 at 00:01
-
-
You can resize a partition without affecting data in the alongside partition. Use a gparted Live UB – solsTiCe May 09 '18 at 10:56
dd
the iso to the hdd/sdd so as to use it in place of a usb/dvd (not install drive though). If you don't want to use the whole drive, you can use a partition on a drive (ie. part of a hdd/sdd). If you already have grub, you can add entries to your existing grub to boot the ISO, then select the 'iso' and install from there (this requires the least work & fix-up afterwards). I'd still recommend using a usb/dvd (back one up somewhere, use it, then restore data to it, or just go to a store & buy another) – guiverc May 06 '18 at 11:33