Menu

Customization How-To

Dirk Krause
← Previous ↑ Home ↑ Live System Next →

Disklessian and DKtoolian Customization How-To

Build live system

Caching proxy

A caching proxy might help if

  • internet access is slow or
  • data tranfer volume is limited.

Install squid
In the virtual machine used to build the live systems, run as root:

apt install squid

Modify squid configuration
Edit the /etc/squid/squid.conf file:

  • Modify disk cache size.
    At the end of the “TAG: cache_dir” section add a line
    cache_dir aufs /var/spool/squid 2048 32 256
    
    This allows squid to use 2 GiB disk space in /var/spool/squid for caching. In the first hierarchy level 32 subdirectories will be created, each of the having in turn 256 subdirectories.
     
  • Set caching times.
    At https://code.launchpad.net/squid-deb-proxy.conf choose the “browse the source code” link and download/inspect the “squid-deb-proxy.conf” file.
    From /etc/squid/squid.conf remove all refresh_pattern lines, replace them by the following lines:
    refresh_pattern deb$   129600 100% 129600
    refresh_pattern udeb$   129600 100% 129600
    refresh_pattern tar.gz$  129600 100% 129600
    refresh_pattern tar.xz$  129600 100% 129600
    refresh_pattern tar.bz2$  129600 100% 129600
    refresh_pattern .* 0 0% 0
    
  • Set maximum object size.
    As archive file can be large, add/replace the maximum_object_size value to 512MB:
    maximum_object_size 512 MB
    

Example /etc/squid/squid.conf file:

acl SSL_ports port 443
acl Safe_ports port 80      # http
acl Safe_ports port 21      # ftp
acl Safe_ports port 443     # https
acl Safe_ports port 70      # gopher
acl Safe_ports port 210     # wais
acl Safe_ports port 1025-65535  # unregistered ports
acl Safe_ports port 280     # http-mgmt
acl Safe_ports port 488     # gss-http
acl Safe_ports port 591     # filemaker
acl Safe_ports port 777     # multiling http
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
include /etc/squid/conf.d/*.conf
http_access allow localhost
http_access deny all
http_port 3128
maximum_object_size 512 MB
cache_dir aufs /var/spool/squid 2048 64 256
cache_mem 256 MB
maximum_object_size_in_memory 10240 KB
coredump_dir /var/spool/squid
refresh_pattern deb$   129600 100% 129600
refresh_pattern udeb$   129600 100% 129600
refresh_pattern tar.gz$  129600 100% 129600
refresh_pattern tar.xz$  129600 100% 129600
refresh_pattern tar.bz2$  129600 100% 129600
refresh_pattern .* 0 0% 0 refresh-ims

Create PROXY entry in dklivesys.conf
In the dklivesys.conf file create a line:

PROXY=http://127.0.0.1:3128

The specified proxy URL is passed to “lb config” as --apt-http-proxy option value. Additionally the environment variables “http_proxy” and “ALL_PROXY” are set for all sub processes of dklivesys-build-livesys.

Run all VM updates through the proxy
In the virtual machine create a file /etc/apt/apt.conf.d/proxy.conf containing

Acquire::http::Proxy "http://127.0.0.1:3128/";
Acquire::https::Proxy "http://127.0.0.1:3128/";
Acquire::ftp::Proxy "http://127.0.0.1:3128/";

Software in the live system

Boot method

In the custom/dklivesys.conf file create a LIVETYPE entry, i.e.

LIVETYPE=hybrid

The “hybrid” type results in a *.iso file you can use on USB stick or DVD, the “nfs” type results in data for network boot.
Note: Extra preparation steps are required to build network boot systems.

→ Details


Choose desktop

In the custom/dklivesys.conf file create a DESKTOP entry, i.e.

DESKTOP=gnome

The following desktops are supported:

  • none
  • gnome
  • xfce

The following desktops are not really supported, their use is “experimental”:

  • mate
  • lxde
  • cinnamon
  • kde
  • lxqt

→ Details


Use LibreOffice

In the custom/dklivesys.conf file create a ALLOWLIBREOFF entry, i.e.

ALLOWLIBREOFF=no

to avoid LibreOffice installation, use “yes” to install LibreOffice.

→ Details


Packages from Debian repositories

Write the package names into the custom/pkg.txt file, one package name per line.
Optionally you can add a comment after the package name use the raute character # to start the comment. The comment ends at the end of line.

→ Details


Packages available as local files

Create the custom/pkgs directory, place the *.deb files in this directory.

→ Details


Software installation from source, other files

Place the files you want to have in the live system in the custom/root directory.

For software packages using a configure script and supporting the DESTDIR variable you can use:

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make
make DESTDIR=/.../custom/root install

→ Details


WiFi

Add WiFi access

Security note: Create images containing WiFi access data only for yourself or for use by specific persons or on specific computers.
Publishing an image with included WiFi access data discloses your WiFi access data!

Many (most ?) WiFi devices do not work without non-free firmware files. Probably you want to set

ALLOWNONFREE=yes

in custom/dklivesys.conf.

  • Create a live system without WiFi access first.
  • Run the live system.
  • Manually connect to WiFi, enter the WiFi key/password when asked.
  • Connection data is stored in a new file in the /etc/NetworkManager/system-connections directory in the live system. Copy that file into the /home/user/livesys1/custom/root/etc/NetworkManager/system-connections directory of the virtual machine used to build the live system.
  • Correct file ownership and permissions: Only root should have permission to read or write the file.
  • Now create a live system once again.

Bookmarks

Add bookmarks

Set the BOOKMARKURLS option in the custom/dklivesys.conf file, i.e.:

BOOKMARKURLS=One Bank|https://www.one-bank.com/|Other Bank|https://www.other.com/

Bookmark items are separated by “|”.
Each bookmark item contains Bank name and URL separated by “|”.

→ Details


Kernel

Use recent Debian Sid kernel

To use the kernel from Debian Unstable (Sid) instead of the kernel from Debian Stable, just add the line

SIDKERNEL=yes

to your custom/dklivesys.conf file before building the live system.

→ Details


Use other non-standard kernel

To use a non-standard kernel, i.e. the latest kernel from Debian testing, download the kernel as *.deb package.

In your “custom” directory create a “pkgs” subdirectory, place the *.deb file in the “custom/pkgs” directory.

In your “custom” directory create a “hooks” subdirectory, place the following files in that directory:

  • 0605-list-k-pkgs.hook.chroot
#! /bin/sh

if [ "X${VERBOSE}" = "Xyes" ]
then
echo 'P:' `date '+%Y-%m-%d %H:%M:%S'` 'Hook chroot 0605-list-k-pkgs (start)'
fi

dpkg-query --show --showformat='${Package}\n' 'linux-image-*'   \
    > /tmp/kernel-packages-to-delete.txt


if [ "X${VERBOSE}" = "Xyes" ]
then
echo 'I: Kernel packages to remove'
cat /tmp/kernel-packages-to-delete.txt
echo 'P:' `date '+%Y-%m-%d %H:%M:%S'` 'Hook chroot 0605-list-k-pkgs (finished)'
fi

exit 0
  • 0615-remove-k-pkgs.hook.chroot
#! /bin/sh

if [ "X${VERBOSE}" = "Xyes" ]
then
echo 'P:' `date '+%Y-%m-%d %H:%M:%S'` 'Hook chroot 0615-remove-k-pkgs (start)'
echo 'I: Packages to remove'
cat /tmp/kernel-packages-to-delete.txt
fi

dpkg --force-all -P `cat /tmp/kernel-packages-to-delete.txt`
rm /tmp/kernel-packages-to-delete.txt

if [ "X${VERBOSE}" = "Xyes" ]
then
echo 'P:' `date '+%Y-%m-%d %H:%M:%S'` 'Hook chroot 0615-remove-k-pkgs (finished)'
fi

exit 0

Both hooks are available in the share/dklivesys/contrib/hooks/own-kernel directory.

The *.deb package containing the kernel is installed by the 0610-custom-pkgs.hook.chroot hook. So we build the list of kernel packages to remove in a hook executed before the installation. Package removal is executed after installing our kernel package, so we ensure to have at least one kernel remaining.

→ Details


← Previous ↑ Home ↑ Live System Next →

Related

Wiki: Live Systems

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.