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 Helper, and tweaked it so that I could get a Live CD to install with about 95% of the apps and config I wanted. But then how about updating the Live CD? Another build process over the internet that can take hours.
More recently I've had success with refractasnapshot (system backup page), which makes a Live CD from an installed system. So from the system installed with my Live Helper-made Live CD, which I upgraded and dist-upgraded, and tweaked with all the config I wanted, I made a snapshot of it and now I have a grand "2nd generation" Live CD.
So, if you were to use Live Helper, you probably shouldn't spend so much time getting the config files into it, and hefty-sized deb archives, but try to build just a basic
Live Debian to install on a test-bed partition. Then boot into that and make all the fine tuning you need. Finally build your 2nd and better Live CD with refractasnapshot, or even partclone (see my system backup
page for those two).
Cloning the apt-cache!
I've been pondering on the task of installing Linux (Debian wheezy LXDE) to remote laptops (zero internet connectivity), but having a connected laptop at base.
Obviously, a customised Live CD would be the ideal option of installing the system with all the app's needed.
Otherwise, I could "clone" my install on the connected laptop by using the same Live CD on the remote PC's and copying the apt index and apt cache onto them. But would it work?
On connected laptop (a):
- Install Live CD X (preferred Debian)
- Remove/install apps and make apt-get remove line Y, install line Z
- Copy /var/lib/apt/lists/ (Apt-L), /var/cache/apt/ (Apt-C), plus config files (CF), /etc/apt/sources.list (SL), libflashplayer.so from /usr/lib/chromium/plugins to a USB stick
on remote laptop (b)
- Install X
- Fine details: add user to sudoer, "no recommends" file, edit fstab
- copy over Apt-L and Apt-C
- Execute apt-get lines Y and Z
- Copy over config files and CTRL-ALT F2, reboot
- Install other apps from deb's
- Copy over SL to (b) (in case of internet connectivity later) and attempt wireless driver install on (b) to make internet-ready
- Copy over libflashplayer.so
Future update of laptop (b) should be possible too.
- on (a) apt-get clean & apt-get update & apt-get upgrade
- copy Apt-L and Apt-C from (a)
- delete and replace Apt-L and Apt-C on (b) with those new from (a)
- on (b) run apt-get upgrade
This page here http://gnuser.wordpress.com...
is very helpful method for installing packages on a PC with no internet connection. If it is an unknown Debian install, or it's out of date, or out of sync with the connected machine (a), then it would be necessary to find out which packages are needed as there may well be many more needed than the base PC (a) would need during an update.
The right tool
Well, now I found there's a tool that's just right for this... Keryx
. It makes a database for a target box, ie with what packages it has, and what versions, and then uses an online box to retrieve what it needs to update or install new on the target - all via a USB stick.
Get it here https://launchpad.net/keryx
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:
set up approx
to cache packages
I still can't get this to work.
set the mirror and un-comment some lines in the file
import the apt cache into approx cache (only if deb files are recent)
lastly, invoke simple-cdd to pull from approx cache
add sid snapshots to sources list (not sure if this is still required?)
now find some space on a partition where all the live-build work will take place
(that will build the basic config tree)
2. Congfiguring how the live cd will be built
The command is run with options to build what you want:
You can keep using "lh 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 "lh 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 486 flavour with i386 architecture, or 686 with amd64, is essential for the live installer to work, or else you will just have a Live CD, so the man page says.
Or use an auto script
All config options can be put into an auto script so that one only needs to run "lh 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,
lb config noauto \
--architectures i386 \
--linux-flavours 486 \
--mirror-bootstrap http://ftp.uk.debian.org/debian/ \
--mirror-chroot http://ftp.uk.debian.org/debian/ \
--mirror-binary http://ftp.uk.debian.org/debian/ \
--mirror-chroot-security http://security.debian.org/ \
--archive-areas "main contrib non-free" \
--apt-recommends disabled \
--apt aptitude \
-d wheezy \
--debian-installer live \
The script is read when lh build is run.
Note: in the file config/bootstrap
there is also LB_PARENT_MIRROR_BOOTSTRAP... and LB_PARENT_MIRROR_CHROOT... which seem to override the --mirror-bootstrap
parameters so that during the build packages are retrieved from ftp.debian.org, not from your prefered mirror.
3. Add package lists before the build
updated Oct 2017
su to root and run these in the build directory, to create lists which will be used to install whatever you need 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
All other apps
For build dependencies
4. Add other/customised packages
Put their .deb archives in config/packages.chroot -for example, most recent XnviewMP, refractasnapshot etc.
! Check the packages names with running dpkg-name *.deb
in the dir as they must comply to be included.
Package pinning example
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 the multimedia repo
add the multimedia repository (or any repo you like, same method), in my-livecd dir:
(this is not in the recent debian live manual -try without first)
Enable live-helper to use the latest snapshot of live-initramfs with a sources list entry (run in my-livecd dir)
and at binary stage with
get the gpg key:
copy it to the binary
or get the live-boot-initramfs-tools
deb file and put it in config/packages.chroot
7. 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
- put the LXDE autostart file in
- Add config files to
so that they will be used to create the live user's home directory... and the installed user's?
make a file
and fill with [include whatever groups you require]
8. Building the live cd
to run live build, cd to my-livecd and enter (sudo or as root)
debian live manual now uses lb build (same thing?)
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-livecd" 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)
- if a build has been interrupted, lh 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-livecd' 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: lh 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 lh 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.
Xfce4-power-manager and catfish were the only two app's that couldn't run on the new install. Running apt-get build-dep I found quite a lot of dependencies were missing. I guess these could be added to a package list to get them added to the build. Run these commands in the build directory:
for p in binutils build-essential debhelper dpatch dpkg-dev g++ g++-4.7 gcc gcc-4.7
gettext gettext-base html2text intltool-debian libasprintf0c2 libc-dev-bin
libc6-dev libdpkg-perl libgettextpo0 libitm1 libstdc++6-4.7-dev
linux-libc-dev make patch po-debconf ;do echo $p >> config/package-lists/catfishdep.list.chroot ;done
for p inautoconf automake autotools-dev binutils build-essential debhelper dpkg-dev
g++ g++-4.7 gcc gcc-4.7 gettext gettext-base gir1.2-notify-0.7
gir1.2-polkit-1.0 html2text intltool intltool-debian libasprintf0c2
libatk1.0-dev libc-dev-bin libc6-dev libcairo-script-interpreter2
libcairo2-dev libdbus-1-dev libdbus-glib-1-dev libdpkg-perl libexpat1-dev
libfontconfig1-dev libfreetype6-dev libgdk-pixbuf2.0-dev libgettextpo0
libglib2.0-bin libglib2.0-dev libgtk2.0-dev libice-dev libitm1 libnotify-dev
libpango1.0-dev libpcre3-dev libpixman-1-dev libpng12-dev
libpolkit-gobject-1-dev libpthread-stubs0 libpthread-stubs0-dev libsm-dev
libstdc++6-4.7-dev libx11-dev libxau-dev libxcb-render0-dev libxcb-shm0-dev
libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev
libxext-dev libxfce4ui-1-dev libxfce4util-dev libxfconf-0-dev libxfixes-dev
libxft-dev libxi-dev libxinerama-dev libxrandr-dev libxrender-dev
linux-libc-dev m4 make patch pkg-config po-debconf x11proto-composite-dev
x11proto-core-dev x11proto-damage-dev x11proto-fixes-dev x11proto-input-dev
x11proto-kb-dev x11proto-randr-dev x11proto-render-dev x11proto-xext-dev
x11proto-xinerama-dev xfce4-panel-dev xorg-sgml-doctools xtrans-dev
zlib1g-dev ;do echo $p >> config/package-lists/xfce4-pman-dep.list.chroot ;done
- 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".