my tutorials‎ > ‎

Remote Install

 

A year ago, in Aug 2012, I was trying everything to get a customised Live CD put together so that I could start installing Debian on other PC's (my friends' not any odd person'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, but try to build 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.


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)
  1. Install Live CD X (preferred Debian Wheezy)
  2. Remove/install apps and make apt-get remove line Y, install line Z
  3. 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)
  1. Install X  
  2. Fine details: add user to sudoer, "no recommends" file, edit fstab
  3. copy over Apt-L and Apt-C
  4. Execute apt-get lines Y and Z
  5. Copy over config files and CTRL-ALT F2, reboot
  6. Install other apps from deb's
  7. Copy over SL to (b) (in case of internet connectivity later) and attempt wireless driver install on (b) to make internet-ready
  8. Copy over libflashplayer.so 

Future update of laptop (b) should be possible too.
  1. on (a) apt-get clean & apt-get update & apt-get upgrade
  2. copy Apt-L and Apt-C from (a)
  3. delete and replace Apt-L and Apt-C on (b) with those new from (a)
  4. 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) needs.



Methods to test for remote Debian installs

Method Status Remark
Simple-cdd (see below)   No success so far  No time.
Live-helper (see below)   Successfully made a Live CD and installed the system as per my packages.  Installed a breeze.  (but with a few hiccups)
Remastersys

 No success with Wheezy - and it's now discontinued (a fork is happening?)  Display manager woes. With Slim, ISO boots to blank screen. With Lightdm login screen with no known login/password.
Refracta SystemBackup page   Successfully made snapshots of two systems and installed to another partition  Fast and easy to use





Simple-CDD

sudo apt-get install simple-cdd approx
make a build directory, my-simple-cdd, cd there

make a working directory where you've got some space
mkdir my-simple-cdd
cd /my-simple-cdd

this is the basic build command:
build-simple-cdd --dist wheezy --debian-mirror http://cdn.debian.net/debian --profiles NAME

fill in your own preferred mirror!

to make the profiles file (with package names), in my-simple-cdd dir:
mkdir profiles
for p in <packages to include> ; do echo $p >> profiles/NAME.packages ; done

simple-cdd defaults to just using main.
so to also use contrib and non-free, in profiles/default.conf:
  mirror_components="main contrib non-free"

----------------------------------------------------------------------------------------------------
set up approx to cache packages http://www.debianadmin.com/...
I still can't get this to work.

set the mirror and un-comment the lines 
sudo nano /etc/approx/approx.conf
e.g.
debian          http://cdn.debian.net/debian
security        http://security.debian.org
deb-multimedia  http://www.deb-multimedia.org


import the apt cache into approx cache (only if deb files are recent)
sudo approx-import /var/cache/apt/archives/*.deb
sudo service networking restart
sudo service openbsd-inetd restart 

invoke simple-cdd to pull from approx cache
build-simple-cdd --dist wheezy --debian-mirror http://localhost:9999/debian --profiles NAME
----------------------------------------------------------------------------------------------------



Live-helper

useful read:


1. install
add sid snapshots to sources list
su
sh -c 'echo "deb http://live.debian.net/debian/ sid-snapshots main contrib non-free" >> /etc/apt/sources.list'
wget http://live.debian.net/debian/project/keys/archive-key.asc -O - | apt-key add -
apt-get update
apt-get install live-helper

now find some space on a partition where all the live-build work will take place 
mk dir my-livecd
cd my-livecd
lh config
(that will build the basic config tree)


2. Congfiguring how the live cd will be built
example.1
lh config --architecture i386 -d wheezy -p lxde --archive-areas "main contrib non-free" --debian-installer live

example.2
lh config -d squeeze -p xfce --archive-areas "main contrib non-free" --debian-installer live --linux-flavours 686

example.3
lh config --mirror-bootstrap "http://cdn.debian.net/debian/" --mirror-chroot "http://cdn.debian.net/debian/" --mirror-chroot-security "http://security.debian.org/debian/" --apt-recommends disabled --architecture i386 --linux-flavours 486 --archive-areas "main contrib non-free" -d wheezy --debian-installer live --apt aptitude

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).  See http://manpages.ubuntu.com/
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.

-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.

cp /usr/share/doc/live-build/examples/auto/* auto/

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,
#!/bin/sh
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... LB_PARENT_MIRROR_CHROOT... which seem to override the  --mirror-bootstrap and  --mirror-chroot 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
su to root and run these in the build directory:

needed for successful build as they are possibly excluded by the "no-recommends" option.
for p in eject file live-boot-doc rsync uuid-runtime live-config-doc live-tools sudo user-setup grub ;do echo $p >> config/package-lists/needed.list.chroot ;done

minimal LXDE install
for p in xorg lxde lightdm lxtask xfce4-power-manager locales pm-utils hdparm cpufrequtils alsa-utils network-manager-gnome chromium-browser firestarter thunar thunar-volman thunar-archive-plugin thunar-media-tags-plugin tumbler tumbler-plugins-extra zip unzip bzip2 p7zip-full imagemagick openjdk-6-jre icedtea6-plugin bluetooth blueman ntfs-3g blktool testdisk unetbootin bash-completion tango-icon-theme gnome-icon-theme-symbolic openbox-themes xcursor-themes moblin-cursor-theme gtk2-engines gtk2-engines-xfce gtk2-engines-murrine debian-installer-launcher ;do echo $p >> config/package-lists/base.list.chroot ;done

apps (copy to a text editor and omit/add what you like)
for p in ffmpeg x264 mplayer gnome-mplayer vlc avidemux handbrake-gtk bombono-dvd k3b libk3b6-extracodecs normalize-audio dvdrip audacious evince feh gimp pinta marble gcalctool clipit clamav clamtk catfish pidgin uget xfe xfce4-notes-plugin gdmap gparted qshutdown ksnapshot kcharselect luckybackup cheese meld regexxer furiousisomount bleachbit ardour easytag gpsbabel gpsbabel-gui viking libcurl4-openssl-dev gnome-doc-utils celestia stellarium htop etherape yelp xiphos fonts-sil-ezra gnome-color-chooser systemsettings ;do echo $p >> config/package-lists/my.list.chroot ;done

build essential
for p in build-essential intltool pkg-config libalglib-dev libglib2.0-dev libdbus-1-dev libdbus-glib-1-dev libx11-dev libgtk2.0-dev libwnck-dev x11-xserver-utils libgudev-1.0-dev libgtkmm-2.4-dev libssl-dev libnotify-dev gcc make cmake checkinstall ;do echo $p >> config/package-lists/build.list.chroot ;done



4. Add other/customised packages 
Put their .deb archives in config/packages.chroot -for example, most recent Libre Office, XnviewMP, refractasnapshot etc. 
! Check the packages names with running dpkg-name *.deb in the dir as they must comply to be included.

Note with thunar: the latest is found in experimental, but it has so many dependencies it failed to install for me using packages.
Therefore it is wiser to pin it to the experimental repository, with all other packages defaulting to the config repository, like this
echo "deb http://ftp.uk.debian.org/debian/ experimental main" > config/archives/experimental.list.chroot

sudo leafpad config/archives/experimental.pref.chroot

add
Package: thunar libexo-1-0 libxfce4ui-1-0 libxfce4util6 thunar-data libxfce4ui-1-dev libthunarx-2-0 exo-utils libxfce4util-dev libxfconf-0-dev libxfconf-0-2
Pin: release n=experimental
Pin-Priority: 600

Package: *
Pin: release n=experimental
Pin-Priority: 1
 

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,
sudo leafpad config/apt/preferences
Package: iceweasel
Pin: version *
Pin-Priority: -1



5. add the multimedia repo
add the multimedia repository (or any repo you like, same method), in my-livecd dir:
echo "deb http://www.deb-multimedia.org testing main non-free" > config/archives/deb-multimedia.list.chroot

copy /usr/share/keyrings/deb-multimedia-keyring.gpg to config/archives/deb-multimedia.key.chroot
cp /usr/share/keyrings/deb-multimedia-keyring.gpg config/archives/deb-multimedia.key.chroot


6. live-initramfs (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)
mkdir config/chroot_sources
sh -c 'echo "deb http://live.debian.net/ sid-snapshots main contrib non-free" > config/chroot_sources/debian-live_sid-snapshots.chroot'
and at binary stage with
cp config/chroot_sources/debian-live_sid-snapshots.chroot config/chroot_sources/debian-live_sid-snapshots.binary

get the gpg key:
wget http://live.debian.net/debian/project/keys/archive-key.asc -O config/chroot_sources/debian-live_sid-snapshots.chroot.gpg
copy it to the binary
cp config/chroot_sources/debian-live_sid-snapshots.chroot.gpg config/chroot_sources/debian-live_sid-snapshots.binary.gpg

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.
  • put the LXDE autostart file in config/includes.chroot/etc/xdg/lxsession/LXDE/ 
Add config files to config/includes.chroot/etc/skel/ so that they will be used to create the live user's home directory... and the installed user's?


Set groups for the Live user
make a file
leafpad config/includes.chroot/etc/live/config/user-setup.conf
and fill with [include whatever groups you require]
LIVE_USER_DEFAULT_GROUPS="plugdev netdev powerdev dialout lpadmin admin clamav"



8. Building the live cd
to run live build cd to my-livecd and enter (sudo or as root)
lh build
debian live manual now uses lb build (same thing?)

to cleanup the working directory to build again 
lh clean --binary

to build again with changes to config (this cleans chroot so all the packages will need unpacking again with the next build)
lh clean
..
lh build

to build with interactive options
lh clean
lh config --interactive shell
lh build

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)
lh config --bootstrap copy --debian installer live
lh build


Notes
  • if a build has been interrupted, lh build might fail, if so do
        lh clean --purge && lh build
        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. 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
        cd  chroot/var/lib/dpkg/
        #cp available-old available && cp diversions-old diversions && cp status-old status

  • 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 sudo umount /dev/sda8 (unmounted it) followed by sudo mount /dev/sda8 /media/BKP (remounted it to a dir in /media) -because of this running live build on a separate partition to any system/data partition is probably essential. Then use sudo chown -R <user> /media/{abc}/my-livecd 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 from http://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:
catfish
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

xfce4-power-manager
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


Install problems
  • 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 a 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
sudo apt-get install grub
sudo grub-install /dev/sda
  • 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".

Comments