updated June 2020
Back in 2012, I was trying everything I could do to get a customised Live CD put together so that I could start installing Debian on other PC's. I spent a long time learning how to use Live build, and I tweaked it so that I could make a Live CD with about 95% of the apps and config I wanted. But then how about updating the Live CD? It required another build process over the internet that could take hours (it's a lot faster with apt caching though).
But what if you install a heap of apps that a user will want to remove? That could be a waste of time. Better, I think, to make a basic Live CD to install a base system with the bare minimal needed for a desktop and internet connectivity, and then install other packages later on, per user requirement. You could even include some guides to installing software.
If you want to install with a much larger choice of software ready to go, it would be better to build that system in a real desktop, with all your menus and other tweaks, and then run refractasnapshot
(see my system backup
page) on it, to make a Live CD from the installed system.
So my strategy would be:
1. Live Build
- minimal base install (easy to keep cleaning and re-building it)
- a grander Live CD with much more choice installed.
and it will be essential to make sure you have these installed too:
now find some space on a partition where all the live-build work will take place (up to 4Gb for basic) and run the initial setup command, `lb config`:
(that will build the basic config tree)
2. Congfigure the live cd build
The command is run with options to build what you want:
You can keep using `lb config` with different parameters to set up the configuration before building -but note that you can't override one that's been set unless you do a `lb clean` -it is better to use an auto script (see below).
The "chroot" mirror is where packages will come from and the "binary" is what the Live CD will be set to (chroot mirror should default to --mirror-bootstrap).
The 686 flavour with amd64, is essential for the live installer to work, or else you will just have a Live CD without installer, so the man page says.
Or use an auto script
All config options can be put into an auto script so that you only need to run `lb config` and the options are set from the script.
edit auto/config to look something like this -adapt to your preference, with amd64/686 or whatever. Here's how it looks with my example 3,
The script is read when lb config is run. but you may need to run `lb config --conffile auto/config`
I set the mirrors to devuan and lb config still set up for a Debian Jessie build. So following that you will need to edit the files in config/ to enable a devuan build.
set Disribution to Devuan and mirrors to
Mirror-Bootstrap: http://deb.devuan.org/merged beowulf
The proxy line is for Apt-cacher-ng APT proxy.
Note: to speed up the process and avoid downloading all the packages again and again with each new build attempt, it is highly recomended that you set up a good APT caching proxy that live-build will retrieve packages from (and being downloaded already through the proxy they are kept in the proxy cache to be retrieved much faster the next time).
See my APT proxy
page for notes how to do that.
3. Add package name lists before the build
su to root and run these in the build directory, to create lists which will be used to install whatever you need added to the build:
First of all, those needed for successful build as they are possibly excluded by the "no-recommends" option.
then do either
1. minimal LXDE install
2. plain openbox install
If you are making a Live CD for a basic install (further packages to be added post-install) then no point in making the build too complex or over-sized, and I would leave it at that.
but if you have ny othe specific areas of packages needed, such as samba, then you can create more package lists like these.
4. Add other/customised packages
You can put .deb archives in config/packages.chroot.
! Check the packages names with running dpkg-name *.deb
in the dir as they must comply to be included.
with thunar a few years back, the latest was found in experimental, but it had so many dependencies it failed to install just using packages.
Therefore it was necessary to pin it to the experimental repository, with all other packages defaulting to the config repository, like this
add this content
Omit a package from the build
-say, if it is a recommended package or installed by a metapackage, you give it a negative Pin-Priority in config/apt/preferences,
5. Add files to be included in the Live cd
If you'd like to customize the Live CD environment, with autostart, no recommends files etc, you simply add the files to config/includes.chroot
directory with the same dir tree as they need in a real file system.
Set groups for the Live user
- apt files > config/includes.chroot/etc/apt
- LXDE autostart file > config/includes.chroot/etc/xdg/lxsession/LXDE
- openbox files > config/includes.chroot/etc/skel/.config/openbox
- ranger files > config/includes.chroot/etc/skel/.config/ranger
- home dot files > config/includes.chroot/etc/skel
make a file
and fill with [include whatever groups you require]
6. Building the live cd
to run live build, cd to my_live_build and enter (sudo or as root)
and this command can be split into four parts:
where bootstrap caches all the necessary packages
chroot unpacks and installs them and carries out tasks in the chroot env
binary creates a squashfs compressed archive
source puts it into a bootable ISO image
to cleanup the working directory to build again
to build again with changes to config (this cleans chroot so all the packages will need unpacking again with the next build)
to build with interactive options
The iso file will be created (if successful) in the "my_live_build" directory, which just needs (renaming and) burning to disk or sending to a usb stick.
You can make a live build from your installed system with (haven't tested it myself)
But this won't build a devuan system
- if a build has been interrupted, lb build might fail, if so do
but it will
clean out the cache!
Example, the build fails with an error:
P: Configuring file /etc/debian_chroot
/usr/share/live/build/scripts/build/lb_chroot_debianchroot: 50: /usr/share/live/build/scripts/build/lb_chroot_debianchroot: cannot create chroot/etc/debian_chroot: Directory nonexistent
P: Begin unmounting filesystems...
P: Saving caches...
chroot: failed to run command `/usr/bin/env': No such file or directory
Another one would be:
P: Begin install linux-image... cp: cannot stat `chroot/boot/vmlinuz-*': No such file or directory
P: Begin unmounting filesystems
And this error would require unmounting the file system where the build was in process in order to build successfully. See here mail-archive...
Another error I had was aptitude failing to download packages and reporting:
E: Cannot get debconf version. Is debconf installed?
try fixing this with
I also found out that build will terminate prematurely if the filesystem is mounted with "noexec" or "nodev" (which are set by "user" or "users" in fstab!) So what I did was edit /etc/fstab for the partition I'm using for backups and live-helper, remove "users" from the line, then do `sudo mount -a` (remounted drives as per fstab)
because of this running live build on a separate partition to any system/data partition is probably essential.
Then use sudo chown -R on the 'my_live_build' dir, to allow write access to the live build directory, which is more useful.
the build may also terminate if APT is specified and there is a package not found. You can switch to Aptitude so that the build won't terminate on these, with: lb config --apt aptitude
there's a catch to turning off package recommends as there are some needed recommends (to make the live cd work) and these will need to be added to the package lists (list made above), see customizing-package-installation
recommends for live-boot and live-config include: eject file live-boot-doc rsync uuid-runtime live-config-doc live-tools sudo user-setup
my build couldn't find "linux-firmware" even with "contrib non-free" set in the config so I got the deb files and put them config/packages.chroot, which were: firmware-linux firmware-linux-free firmware-linux-nonfree fromhttp://packages.debian.org
I also downloaded and put debian-installer-launcher in config/packages.chroot to make sure it was added.
the first time I got stuck with multiarch-support libgcc1 libc6 pre-depends circle! But that may have been fixed now as a bug.
Second time the Live CD built successfully! But I had no live-installer because my lb config flag was --debian-installer=true (incorrect) and not --debian-installer live
Third time and "LiveInstaller" was found in the Other sub-menu (it is also found in System >Install Debian Sid). It complained about the kernel version that I needed to boot the 486 kernel, but I just continued and it allowed me to install.
- No ext3 or ext4 partitioning option! So I had to select "Use free space automatically". this made ext4 partitions for / and /home and a swap of 4Gb. Later, with Gparted, I removed the /home and swap partitons and made new ones (smaller). After booting the system, and logging in as root, /etc/fstab needed making and /dev/sda? mounting to /home. Then I could log in as my user.
- with one install I still couldn't log-in the user, so logged in as root, deleted that user with deluser bob and then added it again with adduser bob, and bob was then added to /home and I could log-in
- GRUB did not install and, as I was installing to a Win7 machine and needed it to dual-boot, I used Super Grub (Rescatux) to boot the new OS, then I ran
- Grub Recover CD does a good job too, automatically searches for OS and installs GRUB with options -see my GRUB page
- In fact, if I attempted GRUB install the installer terminated early without finishing (set up users and passwords etc) so I found I had to use the "Go back" button at Configure Mirrors stage in order to select "Continue without installing GRUB".
Firstly, make a working directory where you've got some space
this is the basic build command, which may be out-dated by now:
fill in your own preferred mirror!
to make the profiles file (with package names), in my-simple-cdd dir:
simple-cdd defaults to just using main, so to also use contrib and non-free, put this in profiles/default.conf:
lastly, invoke simple-cdd to pull from approx cache