commit 042673d080adc03575fe201697b8c48582d1233b Author: YuruC3 Date: Sun Jul 12 22:22:43 2026 +0200 Init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..627caed --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +venv +ZIPs \ No newline at end of file diff --git a/146952812.gif b/146952812.gif new file mode 100644 index 0000000..a265a29 Binary files /dev/null and b/146952812.gif differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..491e784 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +bruh why did I remade it in CloudInit + +![mfw CloudInit](./146952812.gif) \ No newline at end of file diff --git a/VyOS_CloudInit/.gitignore b/VyOS_CloudInit/.gitignore new file mode 100644 index 0000000..ca4fdc6 --- /dev/null +++ b/VyOS_CloudInit/.gitignore @@ -0,0 +1,4 @@ +*.iso +*.json +*.raw +*.qcow2 \ No newline at end of file diff --git a/VyOS_CloudInit/imageBuild.md b/VyOS_CloudInit/imageBuild.md new file mode 100644 index 0000000..899e555 --- /dev/null +++ b/VyOS_CloudInit/imageBuild.md @@ -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 + 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 +``` + + + + +Then also apply the fix for the **--allow-downgrades** problem, and after that start from the beggining diff --git a/VyOS_CloudInit/imageBuildFromISO.md b/VyOS_CloudInit/imageBuildFromISO.md new file mode 100644 index 0000000..9da3f04 --- /dev/null +++ b/VyOS_CloudInit/imageBuildFromISO.md @@ -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 HashiCorp’s 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 < .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 + + + + diff --git a/architecture.md b/architecture.md new file mode 100644 index 0000000..e5e5420 --- /dev/null +++ b/architecture.md @@ -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 │ +└────────────────────────┘ \ No newline at end of file diff --git a/twinsync-stage1-template-reconciler-pve9fix5/.gitignore b/twinsync-stage1-template-reconciler-pve9fix5/.gitignore new file mode 100644 index 0000000..c588151 --- /dev/null +++ b/twinsync-stage1-template-reconciler-pve9fix5/.gitignore @@ -0,0 +1,9 @@ +.venv/ +__pycache__/ +.pytest_cache/ +*.py[cod] +.env +config.yaml +output/ +state/ +*.log