This commit is contained in:
2026-07-12 22:22:43 +02:00
commit 042673d080
8 changed files with 537 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
venv
ZIPs

BIN
146952812.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 MiB

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
bruh why did I remade it in CloudInit
![mfw CloudInit](./146952812.gif)

4
VyOS_CloudInit/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
*.iso
*.json
*.raw
*.qcow2

View File

@@ -0,0 +1,252 @@
Image was built using Debian 12, kernel 6.1.0-50-cloud-amd64, Docker version 29.6.1, build 8900f1d
Built date is 12/07/2026
# Install docker
To install Docker, follow the installation tutorial available on the [official Docker website](https://docs.docker.com/engine/install/debian/)
# Prepare the VyOS builder container
First download the prerequisites and clone the repository
```bash
sudo apt update
sudo apt install git
git clone --branch rolling --single-branch \
https://github.com/vyos/vyos-build.git
cd vyos-build
```
Then pull the docker image
```bash
sudo docker pull vyos/vyos-build:rolling
```
And then inside container edit the **data/build-flavors/proxmox-cloud.toml** file to include
```toml
image_format = "qcow2"
packages = [
"cloud-init",
"cloud-utils",
"ifupdown",
"qemu-guest-agent"
]
[boot_settings]
console_type = "ttyS"
console_num = "0"
console_speed = "115200"
```
Then add the Cloud-Init configuration
```bash
# Create the configuration directory
mkdir -p \
data/live-build-config/includes.chroot/etc/cloud/cloud.cfg.d
# Select Proxmox-compatible data sources
cat > \
data/live-build-config/includes.chroot/etc/cloud/cloud.cfg.d/99-datasource.cfg \
<<'EOF'
datasource_list: [ NoCloud, ConfigDrive ]
EOF
#Disable generic Linux network configuration
cat > \
data/live-build-config/includes.chroot/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg \
<<'EOF'
network:
config: disabled
EOF
```
This prevents generic Cloud-Init from creating /etc/network/interfaces configuration that would conflict with VyOS configuration.
After that, add a live-build chroot hook
```bash
cat > \
data/live-build-config/hooks/live/19-cloud-init-qemu.chroot \
<<'EOF'
#!/bin/sh
set -e
echo "I: Configuring Cloud-Init"
systemctl enable cloud-init.service
rm -f /etc/network/interfaces.d/50-cloud-init
echo "I: Configuring QEMU Guest Agent"
systemctl enable qemu-guest-agent.service
exit 0
EOF
chmod +x \
data/live-build-config/hooks/live/19-cloud-init-qemu.chroot
```
Thereafter, start the docker build container
```bash
sudo docker run --rm -it \
--privileged \
--sysctl net.ipv6.conf.lo.disable_ipv6=0 \
-v "$PWD":/vyos \
-w /vyos \
vyos/vyos-build:rolling \
bash
```
Then we come to building the qcow disk image. In this example flag **--disk-size 10** means that we are creating a 10 GB virtual disk.
```bash
sudo make clean
sudo ./build-vyos-image \
--architecture amd64 \
--build-by "yuru@shupogaki.org" \
--disk-size 10 \
proxmox-cloud
```
After the build completes, run the following command
```bash
find build -maxdepth 1 -type f \
\( -name '*.qcow2' -o -name 'manifest.json' \) \
-ls
```
to verify that it resembles the following text
```
build/vyos-1.x-rolling-YYYYMMDDHHMM-proxmox-cloud-amd64.qcow2
```
# Errors
## Missing --allow-downgrades flag
If you get the following error when building the qcow2 virtual disk
```bash
E: Packages were downgraded and -y was used without --allow-downgrades.
E: An unexpected failure occurred, exiting...
```
Re-clone the repository and follow the commands and text below
Then it means that during bootstrap, Debian installed its current openssl and libssl3 packages. After the VyOS rolling repository was enabled, APT selected VyOS-provided versions that it classified as downgrades.
To fix it, run the following command from the root of the cloned vyos-build repository and check the current line
```bash
grep -n -- '--apt-options' scripts/image-build/build-vyos-image
```
You shold see a result that looks simmilar to this
```bash
vyos_bld@93f129e939ac:/vyos$ grep -n -- '--apt-options' scripts/image-build/build-vyos-image
655: --apt-options "--yes" \
```
This means in file **scripts/image-build/build-vyos-image** on line 655 a **--yes --allow-downgrades** flag is missing. You can add it manually, or run the following command
```bash
sed -i \
's/--apt-options "--yes"/--apt-options "--yes --allow-downgrades"/' \
scripts/image-build/build-vyos-image
```
After that, apply the fix for the second error and start from the begining
## Missmatched shim package version
If you get the following error
```bash
The following packages have unmet dependencies:
shim-helpers-amd64-signed : Depends: shim-unsigned (>= 16.1-2~deb12u1) but 16.0-1+vyos1 is to be installed
E: Unable to correct problems, you have held broken packages.
E: An unexpected failure occurred, exiting...
P: Begin unmounting filesystems...
P: Saving caches...
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Traceback (most recent call last):
File "/vyos/./build-vyos-image", line 810, in <module>
build()
File "/vyos/./build-vyos-image", line 721, in build
cmd("lb build 2>&1")
File "/vyos/scripts/image-build/utils.py", line 89, in cmd
raise OSError(f"Command '{command}' failed")
OSError: Command 'lb build 2>&1' failed
```
First, re-clone the respository and run the following command
```bash
cat > \
data/live-build-config/archives/debian-shim.pref.chroot \
<<'EOF'
Package: shim-unsigned shim-signed shim-signed-common shim-helpers-amd64-signed
Pin: release o=Debian
Pin-Priority: 1001
EOF
```
<!--
Add the following file
```bash
vim data/live-build-config/archives/debian-shim.pref.chroot
```
With the following contents
```bash
Package: shim-unsigned shim-signed shim-signed-common shim-helpers-amd64-signed
Pin: origin "deb.debian.org"
Pin-Priority: 1001
EOF
```
Or just run this command
```bash
cat > data/live-build-config/archives/debian-shim.pref.chroot <<'EOF'
Package: shim-unsigned shim-signed shim-signed-common shim-helpers-amd64-signed
Pin: origin "deb.debian.org"
Pin-Priority: 1001
EOF
```
-->
Then also apply the fix for the **--allow-downgrades** problem, and after that start from the beggining

View File

@@ -0,0 +1,221 @@
Image was built using Debian 12, kernel 6.1.0-50-cloud-amd64, Docker version 29.6.1, build 8900f1d
Built date is 12/07/2026
Here, an existing rolling release ISO is modified to include qemu-guest-agent and to be CloudInit capable instead of building the whole QCOW2 image from the ground up.
First download the prerequisites
```bash
sudo apt update
sudo apt install -y \
git \
make \
qemu-system-x86 \
qemu-utils \
wget \
gpg \
lsb-release
```
Install Packer from HashiCorps repository
```bash
wget -O - https://apt.releases.hashicorp.com/gpg |
sudo gpg --dearmor \
-o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com \
$(grep -oP '(?<=UBUNTU_CODENAME=).*' /etc/os-release || lsb_release -cs) main" |
sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update
sudo apt install -y packer
```
Verify everything
```bash
packer version
qemu-system-x86_64 --version
qemu-img --version
test -e /dev/kvm && echo "KVM available" || echo "KVM unavailable"
egrep -m1 '(vmx|svm)' /proc/cpuinfo
```
# Clone packer-vyos
```bash
ISO_SOURCE="./vyos-2026.03-generic-amd64.iso"
VM_NAME="$(basename "$ISO_SOURCE" .iso)"
cp "$ISO_SOURCE" "iso/${VM_NAME}.iso"
```
Create and verify checksums
```bash
cd iso
sha256sum "${VM_NAME}.iso" > SHA256SUM
cd ..
cat iso/SHA256SUM
sha256sum -c iso/SHA256SUM
```
First, remove the VyOS current repository from the temporary APT source used by Packer
```bash
sed -i \
'\|dev.packages.vyos.net/repositories/current|d' \
http/debian_12-vyos.list
```
Now replace the script that normally reinstalls Cloud-Init
```bash
cat > scripts/vyos/cloud-init-vyos.sh <<'EOF'
#!/bin/bash
set -euo pipefail
set -x
if [[ "${CLOUD_INIT:-}" != "vyos" ]]; then
echo "VyOS Cloud-Init preservation not requested; skipping"
exit 0
fi
# Fail rather than silently replacing the Stream ISO's Cloud-Init package.
if ! dpkg-query -W -f='${Status}\n' cloud-init 2>/dev/null |
grep -qx 'install ok installed'; then
echo "ERROR: The installed VyOS image does not contain cloud-init."
exit 1
fi
# Enable the existing VyOS-patched Cloud-Init installation.
systemctl enable cloud-init.service
# Do not let generic Cloud-Init networking conflict with VyOS interface
# configuration. Interfaces will be configured using vyos_config_commands.
mkdir -p /etc/cloud/cloud.cfg.d
cat > /etc/cloud/cloud.cfg.d/99-disable_network_config.cfg <<'CFG'
network: {config: disabled}
CFG
# Match the image-builder behaviour: do not execute generic config-stage
# modules. VyOS-specific user-data processing remains available.
cat > /etc/cloud/cloud.cfg.d/90-disable_config_stage.cfg <<'CFG'
cloud_config_modules:
CFG
rm -f /etc/network/interfaces.d/50-cloud-init
EOF
chmod +x scripts/vyos/cloud-init-vyos.sh
```
The repository normally installs vim and net-tools during stage two. They are unnecessary for this image, so make that script a no-op
```bash
cat > scripts/vyos/apt-install.sh <<'EOF'
#!/bin/bash
set -euo pipefail
echo "Skipping optional vim and net-tools installation"
EOF
chmod +x scripts/vyos/apt-install.sh
```
The Makefile checks specifically for **local-vyos-1.5.pkrvars.hcl**, not merely **local.pkrvars.hcl**, so create it
```bash
cat > local-vyos-1.5.pkrvars.hcl <<EOF
ssh_username = "vyos"
ssh_password = "vyos"
# Exact ISO basename without ".iso"
vm_name = "${VM_NAME}"
# Causes scripts/vyos/platform-qemu.sh to install qemu-guest-agent
platform = "qemu"
# Keep and configure the VyOS-patched Cloud-Init from the Stream ISO
cloud_init = "vyos"
# Allow Proxmox NoCloud and ConfigDrive sources
cloud_init_datasource = "nocloud_configdrive"
# Stream 2026.03 belongs to the Circinus/1.5 generation
vyos_release = "circinus"
# Serial console for Proxmox
grub_serial = 1
# Automated build without VNC
headless = true
# Size in MB: 10 GiB
disk_size = 10240
EOF
```
Create a minimal .env
```bash
cat > .env <<'EOF'
PACKER_LOG=1
PARALLEL_BUILDS=1
SLEEP_BEFORE_SHUTDOWN=0
# Leave these unset so Packer selects available ports.
# VNC_PORT_FIXED=
# HOST_PORT_FIXED=
EOF
```
Initialize Packer. The target initializes the QEMU plugin for all supported templates
```bash
make init
```
Optional validation
```bash
packer validate \
-var-file=local-vyos-1.5.pkrvars.hcl \
vyos-image1-1.5.pkr.hcl
packer validate \
-var-file=local-vyos-1.5.pkrvars.hcl \
vyos-image2-1.5.pkr.hcl
```
Build stage one
make build1-1.5

46
architecture.md Normal file
View File

@@ -0,0 +1,46 @@
┌────────────────────┐
│ MariaDB │
│ inventory/history │
│ jobs/model results │
└─────────┬──────────┘
┌─────────────────┐ ┌───────────▼───────────┐
│ PT Proxmox │────────▶│ Topology Reconciler │
│ inventory/API │ │ desired vs actual │
└─────────────────┘ └───────────┬───────────┘
│ proxmoxer
┌─────────▼──────────┐
│ DT Proxmox │
│ clone/config/start │
└────────────────────┘
PT/DT VyOS commit events
┌────────────────────────┐
│ Config Sync Coordinator│
│ retrieve/sanitize/diff │
│ snapshot/apply/verify │
└────────────────────────┘
DT SUPERSPINE sFlow
│ UDP/6343
┌────────────────────────┐
│ sFlow Collector │
│ parse + time buckets │
│ feature vectors │
└────────────┬───────────┘
┌─────────────────────────────────┐
│ Inference Service │
│ LSTM / ARIMA / Isolation Forest │
└────────────┬────────────────────┘
┌────────────────────────┐
│ Decision Engine │
│ correlate/vote/policy │
│ propose ACL action │
└────────────────────────┘

View File

@@ -0,0 +1,9 @@
.venv/
__pycache__/
.pytest_cache/
*.py[cod]
.env
config.yaml
output/
state/
*.log