diff --git a/README.md b/README.md index 4726a90..0d4592e 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,8 @@ packer build --only=virtualbox-iso debian-babelbox.json Due to image size reasons we do not include a Debian DVD ISO image into the image. Therefore the VMs have to be booted into the regular OS (first Grub menu -option). Login as user `demo` with password `babelbox` and download a Debian -DVD ISO image into `/srv/`: +option). Login as user `demo` with password `babelbox`. The shell should start +to download a Debian DVD ISO image into `/srv/`. -``` -cd /srv -sudo wget https://cdimage.debian.org/debian-cd/10.3.0/amd64/iso-dvd/debian-10.3.0-amd64-DVD-1.iso -``` - -The version might be different but 10.3.0 has been used for my tests. +If this does not work due to connectivity or DNS issues you have `vim` and +`sudo` in your toolbelt. diff --git a/debian-babelbox.json b/debian-babelbox.json index fb2a1d6..60f6ac9 100644 --- a/debian-babelbox.json +++ b/debian-babelbox.json @@ -1,6 +1,8 @@ { + "description": "Debian Babelbox", "builders": [ { + "type": "virtualbox-iso", "boot_command": [ "", "install ", @@ -16,20 +18,20 @@ "keyboard-configuration/xkb-keymap=de ", "" ], - "disk_size": 10240, + "disk_size": 20480, "guest_os_type": "Debian_64", "hard_drive_interface": "sata", "headless": false, "http_directory": "http", - "iso_checksum": "sha256:1257373c706d8c07e6917942736a865dfff557d21d76ea3040bb1039eb72a054", - "iso_url": "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.9.0-amd64-netinst.iso", - "output_directory": "babelbox-virtualbox", + "iso_checksum": "64d727dd5785ae5fcfd3ae8ffbede5f40cca96f1580aaa2820e8b99dae989d94", + "iso_checksum_type": "sha256", + "iso_url": "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.4.0-amd64-netinst.iso", "shutdown_command": "sudo systemctl poweroff", + "ssh_username": "demo", "ssh_password": "babelbox", "ssh_port": "22", - "ssh_timeout": "1800s", - "ssh_username": "demo", - "type": "virtualbox-iso", + "ssh_wait_timeout": "1800s", + "vm_name": "babelbox-bookworm", "vboxmanage": [ [ "modifyvm", @@ -44,78 +46,74 @@ "1" ] ], - "vm_name": "babelbox-bookworm" + "output_directory": "babelbox-virtualbox" }, { - "accelerator": "kvm", - "boot_command": [ - "", - "install ", - "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", - "debian-installer/locale=en_US ", - "auto ", - "netcfg/get_hostname={{ .Name }} ", - "netcfg/get_domain=demo.local ", - "fb=false ", - "debconf/frontend=noninteractive ", - "console-setup/ask_detect=false ", - "console-keymaps-at/keymap=de ", - "keyboard-configuration/xkb-keymap=de ", - "" - ], - "boot_wait": "10s", - "disk_detect_zeroes": "on", - "disk_interface": "virtio", - "disk_size": "10240M", - "format": "qcow2", - "http_directory": "http-qemu", - "iso_checksum": "sha256:1257373c706d8c07e6917942736a865dfff557d21d76ea3040bb1039eb72a054", - "iso_url": "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.9.0-amd64-netinst.iso", - "memory": "1024", - "net_device": "virtio-net", + "type": "qemu", + "iso_checksum": "64d727dd5785ae5fcfd3ae8ffbede5f40cca96f1580aaa2820e8b99dae989d94", + "iso_checksum_type": "sha256", + "iso_url": "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.4.0-amd64-netinst.iso", "output_directory": "babelbox-qemu", - "qemuargs": [ - [ - "-display", - "sdl" - ] - ], "shutdown_command": "sudo systemctl poweroff", + "disk_size": "20480M", + "format": "qcow2", + "accelerator": "kvm", + "http_directory": "http-qemu", + "ssh_username": "demo", "ssh_password": "babelbox", "ssh_timeout": "20m", - "ssh_username": "demo", - "type": "qemu", - "vm_name": "babelbox-bookworm" + "vm_name": "babelbox-bookworm", + "net_device": "virtio-net", + "disk_interface": "virtio", + "disk_detect_zeroes": "on", + "boot_wait": "10s", + "boot_command": [ + "", + "install ", + "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", + "debian-installer/locale=en_US ", + "auto ", + "netcfg/get_hostname={{ .Name }} ", + "netcfg/get_domain=demo.local ", + "fb=false ", + "debconf/frontend=noninteractive ", + "console-setup/ask_detect=false ", + "console-keymaps-at/keymap=de ", + "keyboard-configuration/xkb-keymap=de ", + "" + ], + "memory": "1024", + "qemuargs": [ + ["-display", "gtk"] + ] } ], - "description": "Debian Babelbox", "provisioners": [ { + "type": "shell", "execute_command": "{{ .Vars }} sudo -E /bin/sh '{{ .Path }}'", "scripts": [ "scripts/babelbox-partitions.sh", "scripts/setup-babelbox.sh" - ], - "type": "shell" + ] }, { - "execute_command": "{{ .Vars }} sudo -E /bin/sh '{{ .Path }}'", + "type": "shell", "only": [ "virtualbox-iso" ], + "execute_command": "{{ .Vars }} sudo -E /bin/sh '{{ .Path }}'", "scripts": [ "scripts/virtualbox.sh" - ], - "type": "shell" + ] }, { + "type": "shell", "execute_command": "{{ .Vars }} sudo -E /bin/sh '{{ .Path }}'", "scripts": [ "scripts/cleanup.sh", "scripts/minimize.sh" - ], - "type": "shell" + ] } ] } - diff --git a/http-qemu/preseed.cfg b/http-qemu/preseed.cfg index 507c80a..64a0f8e 100644 --- a/http-qemu/preseed.cfg +++ b/http-qemu/preseed.cfg @@ -43,7 +43,7 @@ d-i partman-auto/disk string /dev/vda d-i partman-auto/method string regular d-i partman-auto/expert_recipe string \ root :: \ - 6144 50 6144 ext4 \ + 8192 50 8192 ext4 \ $primary{ } $bootable{ } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ @@ -78,7 +78,7 @@ d-i apt-setup/security_host string security.debian.org ### Package selection tasksel tasksel/first multiselect standard -d-i pkgsel/include string parted openssh-server acpid sudo ca-certificates curl +d-i pkgsel/include string parted openssh-server acpid sudo ca-certificates curl git vim-nox d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false diff --git a/scripts/cleanup.sh b/scripts/cleanup.sh index 0991947..6fded1f 100755 --- a/scripts/cleanup.sh +++ b/scripts/cleanup.sh @@ -1,12 +1,13 @@ -# Clean up +#!/bin/sh + +# Clean up +set -e -apt-get --yes remove dmidecode gcc-8 laptop-detect libc6-dev linux-libc-dev -apt-get --yes autoremove apt-get --yes clean # Removing leftover leases and persistent rules echo "cleaning up dhcp leases" rm /var/lib/dhcp/* -echo "Adding a 2 sec delay to the interface up, to make the dhclient happy" -echo "pre-up sleep 2" >> /etc/network/interfaces +# Use systemd-resolved nameserver +echo "nameserver 127.0.0.53" > /etc/resolv.conf diff --git a/scripts/setup-babelbox.sh b/scripts/setup-babelbox.sh index 0f8035b..1011949 100644 --- a/scripts/setup-babelbox.sh +++ b/scripts/setup-babelbox.sh @@ -2,20 +2,43 @@ set -e -apt-get install -y git wget +FDISK_VERSION=2.38.1-5+b1 + cd /srv -wget http://ftp.debian.org/debian/dists/stable/main/installer-amd64/current/images/hd-media/gtk/initrd.gz http://ftp.debian.org/debian/dists/stable/main/installer-amd64/current/images/hd-media/gtk/vmlinuz http://ftp.debian.org/debian/pool/main/u/util-linux/fdisk-udeb_2.33.1-0.1_amd64.udeb +curl -L -O http://ftp.debian.org/debian/dists/stable/main/installer-amd64/current/images/hd-media/gtk/initrd.gz +curl -L -O http://ftp.debian.org/debian/dists/stable/main/installer-amd64/current/images/hd-media/gtk/vmlinuz +curl -L -O http://ftp.debian.org/debian/pool/main/u/util-linux/fdisk-udeb_${FDISK_VERSION}_amd64.udeb mkdir initrd_with_fdisk cd initrd_with_fdisk gunzip -c ../initrd.gz | cpio -id -dpkg-deb -x ../fdisk-udeb_2.33.1-0.1_amd64.udeb . +dpkg-deb -x ../fdisk-udeb_${FDISK_VERSION}_amd64.udeb . find . | cpio --create --format='newc' | gzip -9 > ../initrd.gz cd .. -rm -rf initrd_with_fdisk fdisk-udeb_2.33.1-0.1_amd64.udeb +rm -rf initrd_with_fdisk fdisk-udeb_${FDISK_VERSION}_amd64.udeb git clone https://salsa.debian.org/installer-team/babelbox.git cd babelbox cat babelbox-grub >> /etc/grub.d/40_custom update-grub ./cronscript -echo "You need to download a Debian amd64 DVD ISO into /srv" +cat > /etc/systemd/network/80-dhcp.network <> /home/demo/.bashrc <