_       _       
  (_) ___ | |_ ____
  | |/ _ \| __|_  /
  | | (_) | |_ / / 
 _/ |\___/ \__/___|

How to build Jotz Live (Debian 12.1 Bookworm)

date: 13 Dec 2023


As a starting point, I adapted the examples provided here:

Preparing to use Debian Live

First, boot the PC into Debian 12.1 (Bookworm) using the standard USB live image.

sudo apt update
sudo apt install live-build

If you're going to build the custom image on a removable drive, you may need to remount it with the appropriate flags set, as shown below (replace the path shown with the one for your device).

sudo mount -o remount,exec,dev /media/user/[YOUR DEVICE NAME GOES HERE]

Custom build configuration

mkdir JotzLive
cd JotzLive/

The following command creates a configuration for the build process.

lb config -d bookworm --archive-areas "main contrib non-free-firmware" --parent-archive-areas "main contrib non-free-firmware" --bootappend-live "boot=live locales=en_GB.UTF-8 keyboard-layouts=gb timezone=Europe/Dublin user-default-groups=user,cdrom,floppy,sudo,audio,dip,video,plugdev,netdev,scanner,dialout"


  1. The "--archive-areas" and "--parent-archive-areas" options include "non-free-firmware", so that wifi firmware is included. Note that "firmware-linux" is also included in the package list below.
  2. The "dialout" group is included in the list of the live user's groups using "--bootappend-live" option so that serial port can be accessed by e.g. the Arduino IDE.

Selecting packages for custom build

Create a file my.list.chroot containing the list of packages to be included in the custom build.

echo "task-xfce-desktop firmware-linux build-essential printer-driver-all v4l2loopback-dkms exfatprogs live-build vim-gtk3 geany gedit hexedit inkscape gimp imagemagick feh ristretto gphoto2 ffmpeg mplayer vlc mpg123 audacity blender kdenlive obs-studio screenkey gromit-mpx chromium lynx w3m elinks wget curl filezilla freerdp2-x11 gcc clang git gdb freeglut3-dev gcc-arm-none-eabi gdb-multiarch openocd python3-matplotlib python3-scipy python3-serial php octave tmux figlet xterm stterm kitty pv xclip htop bpytop fzf gdu ncdu bat ranger mc trash-cli neofetch wmctrl xdotool testdisk cmatrix hollywood pandoc texlive texlive-xetex fonts-ibm-plex fonts-ebgaramond-extra fonts-ebgaramond fonts-adf-universalis fonts-beteckna fonts-linuxlibertine gpxviewer gpsbabel wine fontforge" > config/package-lists/my.list.chroot


  1. The above command failed at one point due to errors caused by octave's dependency on openjdk jre. However, after a long investigation, the above command actually worked fine on a subsequent attempt. My best hypothesis is that I originally had the "non-free" archive area included in the lb config step above and that that may have changed something. The successful build was on the basic Debian 12.1 Bookworm live image. As things stand, it's building without problems.

Automatic login script to apply final desktop tweaks

Add some additional commands to a setup script, "setup.sh", that will be placed in the default user's home directory. This can be used to make some final tweaks to the desktop (e.g. set number of workspaces, remove desktop icon) at login time:

mkdir -p config/includes.chroot/etc/skel
cat > config/includes.chroot/etc/skel/setup.sh << 'EOF'

# Set number of workspaces to two
xfconf-query -c xfwm4 -p /general/workspace_count -s 2

# Hide desktop icons
xfconf-query -c xfce4-desktop --create -t bool -p /desktop-icons/file-icons/show-filesystem -s false
xfconf-query -c xfce4-desktop --create -t bool -p /desktop-icons/file-icons/show-home -s false
xfconf-query -c xfce4-desktop --create -t bool -p /desktop-icons/file-icons/show-removable -s false
xfconf-query -c xfce4-desktop --create -t bool -p /desktop-icons/file-icons/show-trash -s false

# Identify connected monitor and store name in shell variable
monitor=`xrandr -q | sed -n '0,\|[[:space:]]connected[[:space:]]| s/^\([^[:space:]]*\)[[:space:]]\+connected[[:space:]].*$/monitor\1/ p'`

# Disable wallpaper on connected monitor (probably sufficient to set workspace0 only)
xfconf-query -c xfce4-desktop -pn /backdrop/screen0/$monitor/workspace0/image-style -t 'int' -s 0
xfconf-query -c xfce4-desktop -pn /backdrop/screen0/$monitor/workspace1/image-style -t 'int' -s 0

# Disable wallpaper (NB this version not working)
#for property in $(xfconf-query -c xfce4-desktop -l | grep image-style); do xfconf-query -c xfce4-desktop -p $property -s 0 ; done
#xfconf-query -c xfce4-desktop -pn /backdrop/screen0/monitor0/image-style -t 'int' -s 0
#xfconf-query -c xfce4-desktop -pn /backdrop/screen0/monitor1/image-style -t 'int' -s 0

# Enable touchpad tap to click
xfconf-query -c pointers -pn /SynPS2_Synaptics_TouchPad/Properties/libinput_Tapping_Enabled -t 'int' -s 1
xfconf-query -c pointers -pn /DELL0A2000_06CBCE65_Touchpad/Properties/libinput_Tapping_Enabled -t 'int' -s 1

# Create browser profiles one and two
firefox -CreateProfile one
firefox -CreateProfile two

# Set up shortcuts
echo "firefox -P one -private-window about:profiles &" > ~/one
echo "firefox -P two -private-window about:profiles &" > ~/two

chmod 755 ~/one ~/two

Set the mode of "setup.sh" so that it's executable:

chmod +x config/includes.chroot/etc/skel/setup.sh

To run the above setup script automatically at login, autostart it by creating the file MyDebLive.setup.desktop, as follows:

mkdir -p config/includes.chroot/etc/skel/.config/autostart
cat > config/includes.chroot/etc/skel/.config/autostart/MyDebLive.setup.desktop << 'EOF'
[Desktop Entry]

Add dot files for vim and tmux

Create ".vimrc":

cat > config/includes.chroot/etc/skel/.vimrc << 'EOF'
" Disable compatibility with vi
set nocompatible

" Filetype detection and configuration
filetype on
filetype plugin on
filetype indent on

" Syntax highlighting
syntax on

" Remap up and down arrow keys to move cursor
" one screen line in normal and visual modes
:noremap <Up> gk
:noremap <Down> gj

" Remap up and down arrow keys to move cursor
" one screen line in insert mode
:inoremap <Up> <C-o>gk
:inoremap <Down> <C-o>gj

" Enable line numbers
set number
"set nonumber

" Set tab width
set shiftwidth=4
set tabstop=4
set expandtab

" Set colour scheme
colorscheme ron 

" Disable Vim mouse interaction, which re-enables
" regular terminal highlighting with mouse
set mouse=

Create ".tmux.conf":

cat > config/includes.chroot/etc/skel/.tmux.conf << 'EOF'
set-option -g escape-time 10
set-option default-terminal tmux-256color

Fix for wireless keyboard scrolling post-resume from suspend

Use a heredoc to create a file "/lib/systemd/system-sleep/post-suspend.sh" in the live system that will reload the usbhid module every time the system resumes after suspend. The file permissions are also changed to make the file executable.

mkdir -p config/includes.chroot/lib/systemd/system-sleep
cat > config/includes.chroot/lib/systemd/system-sleep/post-suspend.sh << 'EOF'
if [ "${1}" == "post" ]; then
modprobe -r usbhid && modprobe usbhid
chmod +x config/includes.chroot/lib/systemd/system-sleep/post-suspend.sh

Build the live image

As root, build the bootable live image. This may take several minutes.

sudo lb build

NB The following can be used instead to log the output during the build process:

sudo lb build 2>&1 | tee build.log

Write the image to a USB key

N.B. It is extremely important to identify the correct device filename of your USB drive (e.g. /dev/sdb, /dev/sdc, etc.) before writing the image to it. Writing the image to the wrong device using the command provided below will destroy the data on that device.

Still as root, copy the completed image to a USB drive. This may take several minutes to complete. The sync command ensures that all data has been written to the USB drive before it is removed.

sudo cp live-image-amd64.hybrid.iso /dev/[USB DRIVE DEVICE FILE NAME GOES HERE]
sudo sync

The USB key can now be unplugged and should be ready to use.

Create a backup copy of the iso with today's date added to the filename:

mv live-image-amd64.hybrid.iso `date +%Y.%m.%d_live-image-amd64.hybrid.iso`

Change log

Changes in next version:

  1. Add libfuse2. Filesystem in Userspace (FUSE) is required to run an AppImage (which I'm currently doing for e.g. Inkscape 1.3). It seems that libfuse3 is already installed by default, but libfuse2 is required for AppImages.
  2. Add sshpass for automating password entry (e.g. to sftp) in shell scripts.
  3. Maybe add psutils? (for the likes of psnup).
  4. Maybe add texlive-extra-utils? (for pdfjam, which allows multiple pdf pages to be combined into one).
  5. Maybe add "gh" package for command line interface to github? The jury's out on this for now.
  6. Add "cgdb" and "ddd" packages for more visual debugging with gdb.
  7. Maybe add "z3" package (solver)?
  8. Add "ncal" package for cal calendar CLI application.
  9. Maybe add "openssh-server" package?
  10. Add python3-pygame

Changes in 15-Aug-2023 version:

  1. Added "non-free-firmware" to "--archive-areas" and "--parent-archive-areas" in "lb config" command.
  2. Added figlet package.
  3. Removed "julia" package because it seems to have been removed from Debian 12 Bookworm.
  4. Changed "exfat-utils" package to "exfatprogs" because the former seems to have been removed (and maybe additional exfat support is built in by default?).
  5. Removed "pandoc-citeproc" package, which seems to be gone in Debian 12 Bookworm (possibly now built in to pandoc?).
  6. Removed "tilde" and "micro" packages (both terminal-based text editors).
  7. Added "wine" package for running LTspice.
  8. Changed package "vim-gtk" to "vim-gtk3".
  9. Added "fontforge" package.

Changes in 13-Jan-2023 version:

  1. Re-organized packages in list for better readability and to hopefully fix file associations.
  2. Added freerdp2-x11 back in.
  3. Replaced vim with vim-gtk to enable clipboard functionality (still runs in terminal).
  4. Added terminal emulators: xterm stterm kitty
  5. Added mpg123 for internet radio.
  6. Removed tldr, because it required additional step to actually download documentation before it worked.
  7. Added steps to create .vimrc and .tmux.conf in the home directory of the live system.

Changes in 13-Dec-2022 version:

  1. Additional packages for pandoc references: pandoc-citeproc
  2. Additional packages for ARM development: gcc-arm-none-eabi gdb-multiarch openocd (add Frank Duignan's build script, etc. also?)
  3. System monitors / process control: htop, bpytop
  4. Useful free font family from IBM: fonts-ibm-plex
  5. Terminal text editors: vim tilde micro
  6. Terminal multiplexer: tmux
  7. Fuzzy find tool: fzf
  8. Disk usage analyzers: gdu, ncdu
  9. Alternative to cat with extra stuff: bat
  10. File managers: ranger, mc
  11. Command line apps: trash-cli, neofetch (display system info summary)
  12. GNU debugger: gdb
  13. Terminal browser(s): lynx, w3m, elinks
  14. Eye candy: cmatrix, hollywood?
  15. utilities to copy text to system clipboard (e.g. in Vim): xclip
  16. Community driven man pages alternative: tldr (need to run "tldr -u" after install to update content)
  17. Removed these: texstudio texlive-latex-extra darktable openfortivpn freerdp2-x11