Skip to content

Instantly share code, notes, and snippets.

@jepio
Last active May 2, 2023 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jepio/94afbb53bbe2f60cc70ae97cc9c50247 to your computer and use it in GitHub Desktop.
Save jepio/94afbb53bbe2f60cc70ae97cc9c50247 to your computer and use it in GitHub Desktop.
Gist to reproduce tdp_mmu root invalidation issue
#!/bin/bash
set -xe
fetch_flatcar ()
{
sudo apt-get update
sudo apt-get install -y qemu-system-x86 lbzip2
local channel=$1;
local version=${2:-current};
local machine=$(uname -m);
local arch=;
if [[ ${machine} = "aarch64" ]]; then
arch=arm64-usr;
else
if [[ ${machine} = "x86_64" ]]; then
arch=amd64-usr;
fi;
fi;
local base=https://$channel.release.flatcar-linux.net/${arch}/${version};
wget $base/flatcar_production_qemu.sh;
wget $base/flatcar_production_qemu_image.img.bz2;
lbunzip2 -kvf flatcar_production_qemu_image.img.bz2
chmod +x flatcar_production_qemu.sh
sed -i -e 's/VM_NCPUS=.*/VM_NCPUS="1"/' flatcar_production_qemu.sh
}
[ -f flatcar_production_qemu_image.img ] || fetch_flatcar stable
cat <<EOF >config.json
{
"ignition": {
"version": "3.3.0"
},
"storage": {
"files": [
{
"group": {
"id": 500
},
"overwrite": true,
"path": "/home/core/.bashrc",
"user": {
"id": 500
},
"contents": {
"compression": "",
"source": "data:,sudo%20shutdown%20-h%20now%0A"
},
"mode": 420
}
]
}
}
EOF
# first run is meant to take a bit longer due to processing provisioning
# data, subsequent runs should be stable.
time sudo ./flatcar_production_qemu.sh -i config.json -nographic -m 4096
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment