0

I want to install Ubuntu from other Linux and get everything the same as a fresh install booted from the ISO file.

It is easy to mount ubuntu-20.10-live-server-amd64.iso and then casper/filesystem.squashfs. However, after rsync -ahPHAXx to target and arch-chroot, I still have to mimic the server installer to set locale and timezone, as well as other stuff.

Is there any document for the process ? Or where can I read the script of Ubuntu server installer ?

Galaxy
  • 101

2 Answers2

1

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

LuxZg
  • 547
  • Ubuntu Base is a minimal dist. As I dare not to say I am familiar with the configuration of all ubuntu selected softwares, it is better to use squashfs as a start point. – Galaxy Jan 18 '21 at 02:59
  • You get a whole (basic) filesystem from Base. After a minimal configuration (explained above), you get a working OS with APT. If you simply install one of meta packages such as ubuntu-desktop, you will get same experience as if you followed installer. It will even ask you for stuff like time zones in an old fashioned wizard style of let's say 16.04 . Not saying it's foolproof, but if you're skipping on default installer consciously already, it is what it is. – LuxZg Jan 18 '21 at 17:23
  • Can I think that the install CDs are built from the minimal configuration and other deb files ? There will not be any further modification other than dpkg-reconfigure. Is this right ? – Galaxy Jan 22 '21 at 09:29
0

the casper/filesystem.squashfs contiant all linux files under / , like /bin,/etc...
to chroot to this system in casper/filesystem.squashfs , just extract with one of tree methode

  • mount to /path/of/new/dir then cp to new dir
  • unsquash with squashfsh-tools
  • use 7z 7z x casper/filesystem.squashfs something you need gz
  • but if you want to boot , we have the truble with service , you must enable after reboot, update your grub with a new entry that points to new partition/OS boot files,locale,passwd,network,fstab...