latest, almost builds now

Jeffrey Paul 4 years ago
parent d96fa24bcf
commit 3b378e2f3d
  1. 16
  2. 3
  3. 29
  4. 205

@ -13,16 +13,16 @@ RUN apt update && \
qemu-user \
qemu-utils \
sudo \
man-db \
RUN useradd -m user
RUN qemu-img create -f qcow2 /image.qcow2 100G
USER user
WORKDIR /home/user
RUN qemu-img create -f qcow2 image.qcow2 100G
ADD . /home/user/
RUN chown user:user /*.qcow2 && chown user:user /home/user/* && chmod a+rwX /home/user/*
RUN sudo --login -u user /home/user/
USER root
RUN chown user:user /home/user/* && chmod a+rwX /home/user/*
USER user
#RUN /bin/bash /home/user/
ENTRYPOINT /bin/bash

@ -2,3 +2,6 @@ default: build
docker build -t sneak/docker-linux-vm .
docker run -ti sneak/docker-linux-vm

@ -1,21 +1,36 @@
function wait_for_finish() {
echo "Waiting for install to finish..."
while sleep 10 ; do
STATUS="$(virsh dominfo linux | grep State | awk -F' ' '{print $2}')"
if [[ "x$STATUS" == "xrunning" ]]; then
date -u
echo "Still waiting for install to finish..."
if [[ "x$STATUS" != "xrunning" ]]; then
echo "Install done."
function install_os() {
osinfo-query os
virsh list
virt-install --virt-type qemu --name linux \
--ram 4096 \
--disk path=/image.qcow2 \
--vcpus 4 \
--os-type linux \
--disk path=image.qcow2 \
--os-variant ubuntu18.04 \
--initrd-inject=preseed.cfg \ \
--graphics none \
--location '' \
--extra-args 'console=ttyS0,115200n8 serial'
virsh list
virsh console linux
#virsh list
#virsh console linux
exit 0

@ -1,66 +1,181 @@
# Preconfiguration file for jessie.
# For more details see
d-i debian-installer/locale string en_US
### Preseed for Ubuntu 18.04
# Derived from:
### Compatibility
# Tested with the netboot image:
# Might work with the regular image (not tested):
### Authentication
# We recommend to use public key authentication and therefore disabled the root
# password. The script will do all the hard work for you.
# In case you still want to use password authentication, you need to set the
# passwd/root-password-crypted variable. See below for further instructions.
### Usage
# We recommend to use the script to build an image with embedded
# preseed and other required files. In that case the preseed file gets loaded
# automatically and all additional files are available to the installer.
# In case you want to use a vanilla ISO image, please use the following boot
# instructions to load the preseed file (press ESC and enter in boot prompt):
# install auto=true priority=critical url=
# Note: you will need to adjust the "preseed/late_command" variable to match
# your environment in case you do not use the script.
### Unattended Installation
d-i auto-install/enable boolean true
d-i debconf/priority select critical
### Localization
d-i debian-installer/locale string en_US.UTF-8
d-i localechooser/supported-locales multiselect en_US.UTF-8, de_DE.UTF-8
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
# Choose an network interface that has link if possible.
### Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/hostname string device
d-i netcfg/get_hostname string device
d-i netcfg/get_domain string unnamed
d-i hw-detect/load_firmware boolean true
# Disable that annoying WEP key dialog.
d-i netcfg/wireless_wep string
# Mirror settings.
### Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string
d-i mirror/http/hostname string
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string
# Root account setup. You can set password in plain-text or pre-encrypted.
d-i passwd/root-login boolean false
#d-i passwd/root-password password 98e1c23d2a5a2
#d-i passwd/root-password-again password 98e1c23d2a5a2
#d-i passwd/root-password-crypted password $6$1LCVFshS/kbYVg$M1QS1ZJ3.E7NkAD8sqkqhqExA2HWQ5/iDE.l23Xbr89Z7hTg/jUuBMyrYzANLmRybYcH8Smcy.yGDKMAX3okd0
# User account setup.
#d-i passwd/make-user boolean false
d-i passwd/user-fullname string user
d-i passwd/username string user
d-i passwd/user-password password password
d-i passwd/user-password-again password password
#d-i passwd/user-password-crypted password $6$dU9we2Mm$Btq1Tk1WkFx3/8YsXWbZr13m56uv0PabJKxk5teKAImLLQhtniOURXuOVLmbiBl0O3iS6xQBctNIc9Dn5b3vR.
# Password login is disabled.
d-i passwd/user-password-crypted password !
# Controls whether or not the hardware clock is set to UTC.
### Account setup
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password !!
d-i passwd/make-user boolean false
# The root password is disabled by default. In case you want to use a root
# password, please generate a password with the following command
# printf "please-change-password" | mkpasswd -s -m sha-512
# and update the passwd/root-password-crypted variable accordingly. Furthermore
# you need to remove the call to "usermod" below.
### Clock and time zone setup
d-i clock-setup/utc boolean true
# See the contents of /usr/share/zoneinfo/ for valid values.
d-i time/zone string UTC
# Controls whether to use NTP to set the clock during the install.
d-i time/zone string Etc/UTC
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string
### Do NOT install on the USB stick(!)
# The Debian installer will install on the first disk it finds which can
# sometimes be the USB stick itself. Work around this by rolling our own auto
# detect logic which disallows installing on USB devices.
d-i partman/early_command string \
USBDEV_LIST="$(mktemp)"; \
list-devices usb-partition | sed "s/\(.*\)./\1/" > "$USBDEV_LIST"; \
BOOTDEV="$(list-devices disk | grep -vf "$USBDEV_LIST" | head -n 1)"; \
debconf-set partman-auto/disk "$BOOTDEV"; \
debconf-set grub-installer/bootdev "$BOOTDEV"; \
while /bin/true; do sleep 0.01; rm -f /target/etc/grub.d/30_os-prober; done &
# Simple non-LVM, all files in one partition.
# For more examples see
d-i partman-auto/method string regular
d-i partman-auto/choose_recipe select atomic
### Partitioning
d-i preseed/early_command string umount /media || true
d-i partman-auto/method string lvm
d-i partman-auto-lvm/guided_size string max
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto-lvm/new_vg_name string main
d-i partman-md/device_remove_md boolean true
d-i partman-md/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-basicmethods/method_only boolean false
# Do not install recommended packages by default.
d-i base-installer/install-recommends boolean false
tasksel tasksel/first multiselect
# Individual additional packages to install. acpid and acpi-support-base are required to make virsh shutdown to work.
# ACPI packages are needed for `virsh shutdown <domain>` to work.
d-i pkgsel/include string openssh-server ca-certificates acpid acpi-support-base
popularity-contest popularity-contest/participate boolean false
### GPT
d-i partman-basicfilesystems/choose_label string gpt
d-i partman-basicfilesystems/default_label string gpt
d-i partman-partitioning/choose_label string gpt
d-i partman-partitioning/default_label string gpt
d-i partman/choose_label string gpt
d-i partman/default_label string gpt
# Boot loader installation.
### EFI
d-i partman-efi/non_efi_system boolean true
### Grub
d-i grub-installer/only_debian boolean true
d-i grub-installer/bootdev string /dev/vda
d-i grub-installer/with_other_os boolean true
# Use entire disk
d-i partman-auto/expert_recipe string \
boot-root :: \
1 1 1 free \
$bios_boot{ } \
method{ biosgrub } \
. \
256 256 256 fat32 \
$primary{ } \
$iflabel{ gpt } \
$reusemethod{ } \
method{ efi } format{ } \
mountpoint{ /boot/efi } \
. \
512 512 512 ext4 \
$primary{ } \
$bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ /boot } \
. \
1024 102400000 1000000000 ext4 \
$lvmok{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } \
lv_name{ root } \
. \
200% 200% 200% linux-swap \
$lvmok{ } \
method{ swap } format{ } \
lv_name{ swap } \
### Base system installation
d-i base-installer/install-recommends boolean true
d-i base-installer/kernel/image string linux-generic
### Apt setup
d-i apt-setup/restricted boolean true
d-i apt-setup/universe boolean true
d-i apt-setup/backports boolean true
d-i apt-setup/use_mirror boolean false
d-i apt-setup/services-select multiselect security, updates
d-i apt-setup/security_host string
d-i apt-setup/security_path string /ubuntu
### Package selection
d-i tasksel/first multiselect none
d-i pkgsel/include string openssh-server python
d-i pkgsel/upgrade select full-upgrade
d-i pkgsel/update-policy select unattended-upgrades
### Finishing up the installation
d-i preseed/late_command string \
in-target sh -c 'lvremove -f --noudevsync main/placeholder || true'; \
in-target sh -c 'rm -f /etc/ssh/ssh_host_*_key* && mkdir -p /usr/lib/systemd/system && cp /custom/ssh-host-keygen.service /usr/lib/systemd/system/ssh-host-keygen.service && systemctl enable ssh-host-keygen.service'; \
in-target sh -c 'echo "IPv4: \\\4" >> /etc/issue && echo "IPv6: \\\6" >> /etc/issue && echo "" >> /etc/issue'; \
in-target sh -c 'eject || true'; \
cp /target/tmp/ && chmod 755 /target/tmp/ && in-target /tmp/ ;
# Run in /target just before the install finishes.
d-i preseed/late_command string cp postinst.tar.gz /target/tmp/ && chmod 755 /target/tmp/ && in-target /tmp/
d-i debian-installer/splash boolean false
d-i cdrom-detect/eject boolean true
# Avoid that last message about the install being complete.
### Shutdown machine
d-i finish-install/reboot_in_progress note
d-i debian-installer/exit/poweroff boolean true