verify-vm: fix Vagrantfile for first real run
Two issues surfaced during the first end-to-end verification attempt
(verify.sh pwnkit, generic/ubuntu2004):
1. 'The machine with the name skk-pwnkit was not found' — the original
Vagrantfile used c.vm.box/hostname without a c.vm.define block, so
passing a machine name to 'vagrant up <name>' had nothing to match.
Wrap every per-machine config in 'c.vm.define host do |m| ... end'
so each module gets its own tracked machine in
.vagrant/machines/skk-<module>/parallels/.
2. 'Installing the proper version of Parallels Tools' fails on
Ubuntu 20.04: 'Error: current Linux kernel version 5.4.0-169-generic
is outdated and not supported'. The latest Parallels Tools wants
newer guest kernels. We don't need the Tools at all — rsync
sync_folder over plain SSH does our source mount. Disable both:
p.update_guest_tools = false
p.check_guest_tools = false
Verified externally (with Apple hypervisor as a temporary bypass
during the user's pending Parallels-extension allow + Mac restart):
the VM boots, SSH connects, network works. The only remaining gate
was the Parallels Tools provisioner now skipped.
This commit is contained in:
Vendored
+22
-11
@@ -24,22 +24,30 @@ kver = ENV["SKK_VM_KERNEL_VERSION"] || ""
|
||||
host = ENV["SKK_VM_HOSTNAME"] || "skk-verify"
|
||||
|
||||
Vagrant.configure("2") do |c|
|
||||
c.vm.box = box
|
||||
c.vm.hostname = host
|
||||
# Define ONE Vagrant machine named after SKK_VM_HOSTNAME. Per-module
|
||||
# isolation: each module gets its own `skk-<module>` machine that
|
||||
# vagrant tracks in .vagrant/machines/skk-<module>/parallels/.
|
||||
c.vm.define host do |m|
|
||||
m.vm.box = box
|
||||
m.vm.hostname = host
|
||||
|
||||
c.vm.synced_folder REPO_ROOT, "/vagrant",
|
||||
m.vm.synced_folder REPO_ROOT, "/vagrant",
|
||||
type: "rsync", rsync__exclude: ["build/", ".git/", "*.o", "skeletonkey-test*"]
|
||||
|
||||
c.vm.provider "parallels" do |p|
|
||||
m.vm.provider "parallels" do |p|
|
||||
p.memory = 2048
|
||||
p.cpus = 2
|
||||
p.name = host
|
||||
# Headless: don't pop a Parallels GUI window for every verify run.
|
||||
p.update_guest_tools = true
|
||||
# Don't auto-update Parallels Tools: the installer fails on older
|
||||
# guest kernels (e.g. Ubuntu 20.04's 5.4.0-169 is "outdated and
|
||||
# not supported" by latest tools). We use rsync over SSH for
|
||||
# sync_folder, which doesn't need the guest tools at all.
|
||||
p.update_guest_tools = false
|
||||
p.check_guest_tools = false
|
||||
end
|
||||
|
||||
# 1. Always install build deps + sudo (needed for module verification).
|
||||
c.vm.provision "shell", inline: <<-SHELL
|
||||
m.vm.provision "shell", inline: <<-SHELL
|
||||
set -e
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
@@ -52,7 +60,7 @@ Vagrant.configure("2") do |c|
|
||||
|
||||
# 2. Pin target kernel if requested. Reboot needed afterward.
|
||||
if !pkg.empty?
|
||||
c.vm.provision "shell", name: "pin-kernel-#{pkg}", inline: <<-SHELL
|
||||
m.vm.provision "shell", name: "pin-kernel-#{pkg}", inline: <<-SHELL
|
||||
set -e
|
||||
if dpkg-query -W -f='${Status}' #{pkg} 2>/dev/null | grep -q 'install ok installed'; then
|
||||
echo "[=] #{pkg} already installed"
|
||||
@@ -72,9 +80,11 @@ Vagrant.configure("2") do |c|
|
||||
end
|
||||
|
||||
# 3. Build SKELETONKEY in-VM and run --explain --active for the target module.
|
||||
# SKK_MODULE is set by verify.sh on the second-pass `vagrant provision` call
|
||||
# (post-reboot if kernel was pinned).
|
||||
c.vm.provision "shell", name: "build-and-verify", run: "never", inline: <<-SHELL
|
||||
# SKK_MODULE is set by verify.sh on the second-pass `vagrant provision`
|
||||
# call (post-reboot if kernel was pinned).
|
||||
m.vm.provision "shell", name: "build-and-verify", run: "never",
|
||||
env: { "SKK_MODULE" => ENV["SKK_MODULE"] || "" },
|
||||
inline: <<-SHELL
|
||||
set -e
|
||||
cd /vagrant
|
||||
echo "[*] kernel: $(uname -r)"
|
||||
@@ -86,4 +96,5 @@ Vagrant.configure("2") do |c|
|
||||
echo
|
||||
./skeletonkey --explain "${SKK_MODULE}" --active 2>&1 || true
|
||||
SHELL
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user