kamilion / customizer

Ubuntu Live CD remastering tool
GNU General Public License v2.0
304 stars 95 forks source link

Does Custom Live CD == Custom Install Media? #213

Open q5sys opened 4 years ago

q5sys commented 4 years ago

Perhaps a dumb question, but as this is described as a 'live cd' remaster tool. Does this include the ability to install from the LiveCD and that include the same packages/setup/config that the LiveCD has? A LiveCD does not necessarily equal Install Media, and its not specified so I figured I'd ask.
If the LiveCD doesn't have the functionality to install the customized environment to a hard disk, are you aware of a tool that does that.

kamilion commented 4 years ago

In general yes; if you use a normal ubuntu livecd that includes the ubiquity installer package, if it's not removed during the customization process, can be invoked normally after booting the customized ISO.

If you're using one of the weird ISOs like ubuntu-server-live with subiquity, or ubuntu-mini-remix, or something other than the usual "ubuntu, lubuntu, xubuntu" choices as your source ISO, or a different ubuntu spin altogether like Mint, then you'll probably run into quirks that may break the installer scripts.

Although I can say, I have no problems invoking the installer with a heavily customized lubuntu ISO, and I do get all of the customized packages from the ISO installed to the hard disk when I've tried with 16.04 and 18.04. If you'd like an example of what can be done with Customizer, I integrate the xen hypervisor and other virtual machine host packages in Kamikazi, https://github.com/kamilion/kamikazi-core/releases And publish the build scripts utilizing Customizer that allows anyone to reproduce the release ISOs if they wish. https://github.com/kamilion/kamikazi-core/tree/master/buildscripts/bionic Most of them are heavily commented, feel free to steal any useful snippet you find without attribution, that repo's all WTFPL licensed.

kamilion commented 4 years ago

Had a look at Lumina, I'm a QT fan; looks like you shouldn't have a lot of trouble using Customizer to integrate the Lumina packageset onto an ISO. I'd suggest using lubuntu as a starting point, as they've already been doing a big push towards LXQT anyway.

You might find my minilubuntu starting point for kamikazi useful to clean further packages from. It's available in the release artifacts.

One thing that I use near constantly is gnome-disks-tool, to mount and unmount loopback images while I'm working on development. There is currently no equivalent UI for QT. Closest I've found is the KDE Partition Manager, which is VERY not the same thing (otherwise I'd just invoke gparted).

Since you're working on Lumina; perhaps I might be able to convince you to spend some energy in that direction? Right now gnome-disk-utility relies on dbus calls to udisks2; it should not be very difficult to adapt from GTK to QT. Pyside2/pyside6 would interest me more, but I'll take whatever I can get if it makes people's lives easier.

Feel free to private message me on Freenode IRC if you need deeper insight into anything I've touched in the last 12 years with ubuntu.

As long as you have an iso that uses initramfs-tools, casper, and ubiquity, things should just work. Lubuntu 18.10, 19.04, and 19.10 are all QT-only and I believe they're using their own installer package now instead of relying on ubiquity, but I could be mistaken and it may just be a different theme for ubiquity or something -- I'm not on the installer team, just the lubuntu-packaging team. 18.04 LTS is the last release to use LXDE, it's all LXQT since then. Still have a few bugs to iron out before 20.04 LTS though. Praying we manage to nail down the big ones.

kamilion commented 4 years ago

As for the technical specifics... Customizer relies on an iso that utilizes the normal 'casper' livecd mechanism. casper is a set of hooks and scripts for initramfs-tools, but isn't around on the server isos, which is why they don't work with Customizer.

casper relies on finding a squashfs file on the ISO that contains the root filesystem. It can optionally copy it to ram before mounting it with the TORAM=Yes kernel option, which I highly recommend for 4GB+ RAM systems.

If the ISO contains a desktop environment (and it hasn't been tampered with as in kamikazi to not-autostart) then there will be an icon for the installer on the desktop, usually.

After partitioning and all that, the first thing the installer will do is extract the squashfs into the new root.

After that, it'll start invoking the package manager normally.

Anything that's already been modified in the squashfs, remains that way in the installed system. That can be a problem, kamikazi, for example, relies on extracting configuration from the USB stick it's started up from using a casper hook, seen here, replacing the original script that set the system hostname in early boot.

https://github.com/kamilion/kamikazi-core/blob/master/resources/xenial/mods/usr/share/initramfs-tools/scripts/casper-bottom/18kamikazi_restore

If that script isn't run in early boot, the marker file that I had supervisord looking for is never created, so my late-boot scripts never run.

In practice, this is actually beneficial, because as an installed image, none of that configuration needs to be 'restored' into the live environment, it's already persisting on disk normally.

Buuuuut, in certain servers, that use the SAS cards I blacklist, only to later manually probe for them (which is a stupid stupid stupid way of making sure USB/NVME/AHCI disks show up before SAS disks do) in the late-boot scripts, will never fire up their HBAs. You may need some kind of a cleanup/fixup script to run after the installer, on firstboot or something to that effect. A systemd unit would be appropriate at this point, but uh, I ended up being lazy and sticking with supervisord this long...

So yeah. Your mileage may vary, see vendor for details.

The long short of it though, any modification to the squashfs you make with Customizer should persist into the installed system, unless you start doing goofy things like I did for strange purposes like virtualization.

frollog commented 4 years ago

Hello! Is it not possible to install from a custom ISO with my server Ubuntu 16.04, is it? Is there any way to use debootstrap instead ubiquity?

kamilion commented 4 years ago

@frollog No. ubuntu-server doesn't use casper. Customizer won't even be able to locate the squashfs to unpack. You can start from any of the media that DOES include casper, purge any packages you don't need, and figure out debian-installer or subiquity customization by installing those packages and making your configuration edits.

debootstrap is a completely different can of worms; Go look at Packer, debos, or virt-builder for wrappers around it. Generally you're not going to be able to build ISOs, because that's not what debootstrap does. https://packer.io/ https://lwn.net/Articles/758461/ https://www.collabora.com/news-and-blog/blog/2018/06/27/introducing-debos/ https://github.com/go-debos/debos http://libguestfs.org/virt-builder.1.html