This is an old revision of the document!

  • install temporary proxmox ve install in KVM VM
  • aptitude install dab
  • make a temporary directory with the following files (based on PVE debian minimal and debian 64-bit vm's):


Suite: jessie
CacheDir: ../cache
Source: SUITE main
Source: SUITE-updates main
Source: SUITE/updates main
Architecture: amd64
Name: debian-8.0-tom
Version: 8.7-tom2
Section: system
Maintainer: Tom Dobes <>
Description: Debian Jessie for Tom
 The base Debian Jessie amd64 install plus common utils.

Side note: Yes, the name really does need to contain 8.0. If it doesn't, dab makes the filename of the resulting template really long by including both debian-8.0 and your name. Argh!


BASEDIR:=$(shell dab basedir)

all: info/init_ok
	dab bootstrap --minimal
	dab install aptitude

	# dab is hardcoded to install sysvinit on jessie because they want to party like it's 1999, apparently
	dab install udev
	dab install systemd
	dab install systemd-sysv
	dab install dbus
	dab exec aptitude -y purge sysvinit-core

	dab exec aptitude -y purge dmidecode kmod
	dab exec dpkg --purge --force-remove-essential e2fsprogs e2fslibs
	dab install locales
	sed -e 's/^# en_US.UTF-8/en_US.UTF-8/' -i ${BASEDIR}/etc/locale.gen
	dab exec dpkg-reconfigure -f noninteractive locales
	echo "LANG=en_US.UTF-8" > ${BASEDIR}/etc/default/locale
	dab install screen rsync psmisc file patch tcpdump vim strace bzip2 lsof xz-utils
	dab install dnsutils
	dab install unattended-upgrades
	echo $\'APT::Periodic::Update-Package-Lists "1";\nAPT::Periodic::Unattended-Upgrade "1";' > ${BASEDIR}/etc/apt/apt.conf.d/20auto-upgrades

	# workaround for shutting down container -- see
	# This probably won't be needed in future Debian releases
	echo $\'[Unit]\nDescription=Shut down containers on SIGPWR\nConditionVirtualization=container\n\n[Service]\nType=oneshot\nExecStart=/bin/systemctl --no-block poweroff' > ${BASEDIR}/etc/systemd/system/sigpwr-container-shutdown.service
	mkdir -p ${BASEDIR}/etc/systemd/system/
	ln -s /etc/systemd/system/sigpwr-container-shutdown.service ${BASEDIR}/etc/systemd/system/

	dab exec cp /dev/null /etc/motd
	dab exec systemctl disable ssh.service
	dab exec systemctl enable ssh.socket

	dab exec systemctl mask proc-sys-fs-binfmt_misc.automount
	dab exec systemctl mask systemd-binfmt.service
	dab exec systemctl mask systemd-udevd.service

	# Not sure if this getty crap will be needed in future Debian releases
	dab exec systemctl mask getty-static.service
	mkdir -p ${BASEDIR}/etc/systemd/system/getty\@tty1.service.d
	echo '[Service]' > ${BASEDIR}/etc/systemd/system/getty\@tty1.service.d/noclear.conf
	echo 'TTYVTDisallocate=no' >> ${BASEDIR}/etc/systemd/system/getty\@tty1.service.d/noclear.conf
	echo '[Unit]' > ${BASEDIR}/etc/systemd/system/getty\@tty1.service.d/run_in_container.conf
	echo 'ConditionPathExists=' >> ${BASEDIR}/etc/systemd/system/getty\@tty1.service.d/run_in_container.conf
	echo 'ConditionPathExists=/dev/tty1' >> ${BASEDIR}/etc/systemd/system/getty\@tty1.service.d/run_in_container.conf
	mkdir -p ${BASEDIR}/etc/systemd/system/getty\@tty2.service.d
	echo '[Unit]' > ${BASEDIR}/etc/systemd/system/getty\@tty2.service.d/run_in_container.conf
	echo 'ConditionPathExists=' >> ${BASEDIR}/etc/systemd/system/getty\@tty2.service.d/run_in_container.conf
	echo 'ConditionPathExists=/dev/tty2' >> ${BASEDIR}/etc/systemd/system/getty\@tty2.service.d/run_in_container.conf

	echo "America/Chicago" > ${BASEDIR}/etc/timezone
	dab exec dpkg-reconfigure -f noninteractive tzdata
	cat sources.list > ${BASEDIR}/etc/apt/sources.list
	dab exec aptitude forget-new
	rm ${BASEDIR}/etc/ssh/ssh_host_*_key*
	dab finalize

info/init_ok: dab.conf
	dab init
	touch $@

.PHONY: clean
	dab clean
	rm -f *~

.PHONY: dist-clean
	dab dist-clean
	rm -f *~

Note that when testing this you need to be sure to run dab init before the commands in the 'all' section. Also, note that it's important that the dpkg-reconfigure for locales go BEFORE setting the contents of the /etc/default/locale file, or else it will get commented out.


deb jessie main
deb-src jessie main

deb jessie/updates main
deb-src jessie/updates main

# jessie-updates, previously known as 'volatile'
deb jessie-updates main
deb-src jessie-updates main

# jessie-backports, previously on
#deb jessie-backports main
#deb-src jessie-backports main
  • run make in that directory (Note: Since dab is in /usr/sbin/, this has to be done as root)


  • at the end of this, we don't seem to have a package cache in the VM… maybe related to the sources.list copy which we do to add the deb-src lines? Everything's fine after you run aptitude update once in the VM.

How to update tom1 CT to tom2 (getty stuff)

systemctl unmask console-getty.service
systemctl unmask container-getty\@0.service
ln -s /lib/systemd/system/getty\@.service /etc/systemd/system/\@tty1.service
rm /etc/systemd/system/\@1.service
rm /etc/systemd/system/\@2.service
mkdir -p /etc/systemd/system/getty\@tty1.service.d
echo '[Service]' > /etc/systemd/system/getty\@tty1.service.d/noclear.conf
echo 'TTYVTDisallocate=no' >> /etc/systemd/system/getty\@tty1.service.d/noclear.conf
echo '[Unit]' > /etc/systemd/system/getty\@tty1.service.d/run_in_container.conf
echo 'ConditionPathExists=' >> /etc/systemd/system/getty\@tty1.service.d/run_in_container.conf
echo 'ConditionPathExists=/dev/tty1' >> /etc/systemd/system/getty\@tty1.service.d/run_in_container.conf
mkdir -p /etc/systemd/system/getty\@tty2.service.d
echo '[Unit]' > /etc/systemd/system/getty\@tty2.service.d/run_in_container.conf
echo 'ConditionPathExists=' >> /etc/systemd/system/getty\@tty2.service.d/run_in_container.conf
echo 'ConditionPathExists=/dev/tty2' >> /etc/systemd/system/getty\@tty2.service.d/run_in_container.conf
computer/build_debian_jessie_amd64_lxc_pve_template.1487435432.txt.gz · Last modified: 2017/02/18 10:30 by tdobes
Recent changes RSS feed Driven by DokuWiki Valid XHTML 1.0 Valid CSS