How to install Ubuntu from casper/filesystem.squashfs with chroot?

There is other way to do it, as envisioned by Ubuntu team.

Starts with Ubuntu Base, then you go on to install everything. No need for filesystem.squashfs from ISO.

Roughly follow my answer here: https://askubuntu.com/a/1293305/1080682

Instead boot from other LiveCD or network boot use your current Ubuntu, skip formatting boot permission, just edit bootloader, and use Ubuntu Base squashfs, then APT to install whole desktop.

Instead putting script in autoinstaller, you can execute it in your Terminal/CLI. Just be careful with what gets executed in and outside chroot.

Since I typed this in answer instead comment (early morning) here is rough step (for exact commands see link):

  • boot your current OS
  • download Ubuntu Base squashfs (actually tar.gz) - http://cdimage.ubuntu.com/ubuntu-base/releases/
  • prepare partition for new OS
  • unpack the file system to new partition
  • chroot to add kernel (linux-image-generic), users, password, group membership setup neworking, etc, see link for few extras and explanation why
  • in your case you can run any other APT install commands while in chroot (eg ubuntu-desktop) - this is optional, can be done after reboot from CLI
  • if you need to do this offline, you can mount your ISO, and install packages that are on it using dpkg - this can also be done from CLI after reboot
  • update your grub with a new entry that points to new partition/OS boot files
  • reboot

P.s. Sorry got posted before finishing typing