diff --git a/roles/gitlab_runner/files/libvirt-executor b/roles/gitlab_runner/files/libvirt-executor
index c39d15b8b3276cbeedb785b7e89ac0f368258d05..a51a14f69deba4defb78c65d59be7c9bea03b41d 100755
--- a/roles/gitlab_runner/files/libvirt-executor
+++ b/roles/gitlab_runner/files/libvirt-executor
@@ -69,7 +69,13 @@ prepare() {
 run() {
   local ip
   ip="$(vm_ip "$(vm_name)")"
-  ssh "${ip}" bash < "${1}" || exit "${BUILD_FAILURE_EXIT_CODE:-1}"
+  if [[ ${2} == prepare_script ]]; then
+    # TODO: Get this fixed upstream or perhaps we should just install inetutils?
+    # https://gitlab.com/gitlab-org/gitlab-runner/-/blob/v17.5.2/shells/bash.go?ref_type=tags#L452-L456
+    ssh "${ip}" bash < <(sed 's/$(hostname)/$(hostnamectl hostname)/' "${1}") || exit "${BUILD_FAILURE_EXIT_CODE:-1}"
+  else
+    ssh "${ip}" bash < "${1}" || exit "${BUILD_FAILURE_EXIT_CODE:-1}"
+  fi
 }
 
 # https://docs.gitlab.com/runner/executors/custom.html#cleanup
diff --git a/roles/gitlab_runner/files/libvirt-executor-update-base-image b/roles/gitlab_runner/files/libvirt-executor-update-base-image
index 87ce385e153992c4f23942d2ba491d5bfd41e582..1f96ecaff49f5b7cae146cf52304c829b0dd4ee9 100755
--- a/roles/gitlab_runner/files/libvirt-executor-update-base-image
+++ b/roles/gitlab_runner/files/libvirt-executor-update-base-image
@@ -43,7 +43,9 @@ sed 's/^\(GRUB_CMDLINE_LINUX=".*\)"$/\1 lockdown=confidentiality"/' -i mnt/etc/d
 arch-chroot mnt /usr/bin/grub-mkconfig -o /boot/grub/grub.cfg
 install -d -m0700 mnt/root/.ssh
 install -m0600 /etc/libvirt-executor/id_ed25519.pub mnt/root/.ssh/authorized_keys
-rm -f mnt/etc/machine-id
+# We want to use the transient hostname
+# https://github.com/systemd/systemd/pull/30814
+rm -f mnt/etc/machine-id mnt/etc/hostname
 
 cp -a mnt/boot/{initramfs-linux-fallback.img,initramfs-linux.img}
 
diff --git a/roles/gitlab_runner/templates/domain_template.xml.j2 b/roles/gitlab_runner/templates/domain_template.xml.j2
index 6ce09333d92f564ec76c08e662ef14be718be467..16fc01ea994e10b2346d0ba521fa80727929ca69 100644
--- a/roles/gitlab_runner/templates/domain_template.xml.j2
+++ b/roles/gitlab_runner/templates/domain_template.xml.j2
@@ -2,8 +2,14 @@
   <name>$vm_name</name>
   <memory unit='MiB'>{{ gitlab_runner_libvirt_vm_memory }}</memory>
   <vcpu>4</vcpu>
+  <sysinfo type='smbios'>
+    <oemStrings>
+      <entry>io.systemd.credential:system.hostname=$vm_name</entry>
+    </oemStrings>
+  </sysinfo>
   <os>
     <type arch='x86_64' machine='q35'>hvm</type>
+    <smbios mode='sysinfo'/>
   </os>
   <features>
     <acpi/>