Attached: Vagrantfile.

Best regards,

--
Julien Plissonneau Duquène
# Usage: vagrant up --provider=libvirt

Vagrant.configure("2") do |config|
  config.vm.box = "debian/testing64"
  config.vm.box_version = "0"
  #config.vm.box_version = "20250126.1"
  # Note: 
https://vagrantcloud.com/debian/boxes/testing64/versions/20250126.1/providers/libvirt/amd64/vagrant.box
  #       fails with 429 Too Many Requests
  #       -> download with a browser from:
  #       
https://portal.cloud.hashicorp.com/vagrant/discover/debian/testing64/versions/20250126.1
  #       and run:
  #       vagrant box add --provider libvirt --name "debian/testing64" 
--checksum 073c794a90187cff320096c3ff0310d4e69f5469e93bbc354dd59584a0c8294b 
trixie_607a06e9-dc01-11ef-8648-52d4cdf5194b.box
  config.vm.box_download_checksum = 
"073c794a90187cff320096c3ff0310d4e69f5469e93bbc354dd59584a0c8294b"
  config.vm.box_download_checksum_type = "sha256"

  config.vm.box_check_update = false

  bugref = "1095682"

  config.vm.define "testing" do |it|
    it.vm.hostname = "testing"
  end

  config.vm.provider "libvirt" do |libvirt|
    # unfortunately won't work OOTB:
    #libvirt.qemu_use_session = true

    libvirt.default_prefix = "bug-#{bugref}-"
  end

  config.vm.provision "shell", inline: <<-'SHELL'
apt-get purge -y unattended-upgrades
apt-get -y -U install --no-install-recommends apt-eatmydata zstd kbd
apt-get -y dist-upgrade
cat > /var/tmp/runonce.sh <<EOD
openvt -s -- journalctl --unit=tmp-runonce.service --no-tail --follow
cat > /etc/apt/sources.list.d/trixie.sources <<EOD2
Types: deb deb-src
URIs: https://deb.debian.org/debian
Suites: trixie
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOD2
rm /etc/apt/sources.list
apt-get -U purge -y '~o'
apt-get install -y --no-install-recommends openbox-lxde-session \\
    lxterminal notification-daemon polkitd xdg-utils \\
    lightdm-autologin-greeter xserver-xorg-video-cirrus \\
    xserver-xorg-input-libinput
apt-get -y autopurge
systemctl stop lightdm
sed -i -e 's/\\(autologin-user=\\).*/\\1vagrant/' \\
    /etc/lightdm/lightdm.conf.d/lightdm-autologin-greeter.conf
cat > /etc/X11/xorg.conf.d/test.conf <<EOD2
Section "Device"
  Identifier "Device0"
  Driver     "cirrus"
EndSection

Section "Screen"
  Identifier    "Screen0"
  Device        "Device0"
  #DefaultDepth  8
EndSection
EOD2
systemctl edit --stdin lightdm.service <<EOD2
[Service]
Restart=no
EOD2
systemctl disable tmp-runonce.service
rm /etc/systemd/system/tmp-runonce.service # /var/tmp/runonce.sh
rm -f /var/log/Xorg.0.log
echo Waiting for X to start or crash...
systemctl start lightdm.service
while systemctl is-active lightdm.service && [ ! -f '/tmp/.X11-unix/X0' ] ; do 
sleep 1 ; done
echo ==== Status and logs below: ====
systemctl status lightdm.service
cat /var/log/Xorg.0.log
echo Done.
sleep 5 # give a chance to journalctl to complete printing status
EOD
cat > /etc/systemd/system/tmp-runonce.service <<EOD
[Unit]
Description=Run once temporary script after reboot.

[Service]
Type=oneshot
ExecStart=/bin/sh /var/tmp/runonce.sh

[Install]
WantedBy=multi-user.target
EOD
systemctl enable tmp-runonce.service
reboot
SHELL

  config.vm.post_up_message = <<EOT
================================================================

      The VM will now restart and complete configuration.

  Please use a GUI client to connect to the VM and wait for it
  to finish configuration, e.g.:

    virt-viewer -c qemu:///system -- bug-#{bugref}-testing

  You may also follow or retrieve the logs with:

    vagrant ssh -- sudo journalctl --unit=tmp-runonce.service --no-tail --follow

================================================================
EOT

end

Reply via email to