0

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 Answers2

1

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.

C.S.Cameron
  • 20,530
  • 12
  • 78
  • 125
0

So using the loopback feature of GRUB, one can boot an iso installed on a partition of you HDD.

  1. 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.

  2. Add an entry in grub configuration for the iso. To do that edit /etc/grub/40_custom and add something like

    insmod 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 isofile

  3. Run sudo update-grub

  4. Reboot and, in Grub menu, choose the loopback entry. Then do the installation as if booted from USB or DVD.

solsTiCe
  • 9,515