Skip to content

Upgrade OS images: Proxmox VE, Ubuntu, OpenWRT, Debian - #177

Merged
bubacoder merged 4 commits into
mainfrom
feature/os-upgrade
Aug 11, 2025
Merged

Upgrade OS images: Proxmox VE, Ubuntu, OpenWRT, Debian#177
bubacoder merged 4 commits into
mainfrom
feature/os-upgrade

Conversation

@bubacoder

@bubacoder bubacoder commented Aug 10, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Chores
    • Updated Debian base image from Bookworm to Trixie across dev containers, CI workflows, and build tasks.
    • Added Debian 13 support to the Ansible bootstrap process.
    • Bumped OpenWRT and Ubuntu Server installer versions; installer scripts now verify downloads and improve reliability and argument handling.
  • Documentation
    • Added Proxmox VE v9 upgrade guidance and replaced placeholder notes.

@coderabbitai

coderabbitai Bot commented Aug 10, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Updated the Debian base image from bookworm to trixie across devcontainer configs and CI; added Debian 13 handling in Ansible bootstrap; added Proxmox v9 upgrade notes; and bumped/fortified OpenWRT and Ubuntu VM creation scripts with checksum verification and argument-parsing refactors.

Changes

Cohort / File(s) Change Summary
Devcontainer Base Image Update
.devcontainer/Dockerfile, .devcontainer/Taskfile.dev.yaml, .devcontainer/devcontainer.json, .github/workflows/devcontainer.yml
Switched default Debian base image and related variables/descriptions from debian:bookworm-slim to debian:trixie-slim.
Ansible Bootstrap Script
ansible/bootstrap-ansible.sh
Added detection for Debian 13 / trixie* and mapped it to Ubuntu codename noble for the Ansible PPA-based install.
Proxmox Documentation
proxmox/README.md
Replaced TODO with "Upgrade to Proxmox v9" section linking official guide and noting pve8to9 --full checks.
OpenWRT VM Script
proxmox/create-openwrt-vm.sh
Bumped OpenWRT to 24.10.2; changed downloads to wget -q --show-progress; added SHA256SUMS retrieval and sha256 verification; localized vars; switched arg parsing to while loop.
Ubuntu Server VM Script
proxmox/create-ubuntu-server-vm.sh
Bumped Ubuntu ISO to 24.04.3; added ISO checksum download & verification; localized AUTHORIZED_KEYS_FILE; CD to ISO dir before download; switched arg parsing to while loop.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Script
    participant Remote
    User->>Script: request download (ISO/image)
    Script->>Remote: wget (file)
    Remote-->>Script: file stream
    Script->>Remote: wget (SHA256SUMS)
    Remote-->>Script: SHA256SUMS
    Script->>Script: extract expected checksum
    Script->>Script: echo "expected  file" | sha256sum -c -
    alt checksum matches
        Script->>User: proceed (create VM)
    else checksum mismatch or missing
        Script->>User: exit with error
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related PRs


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 30ed948 and 65fd227.

📒 Files selected for processing (8)
  • .devcontainer/Dockerfile (1 hunks)
  • .devcontainer/Taskfile.dev.yaml (1 hunks)
  • .devcontainer/devcontainer.json (1 hunks)
  • .github/workflows/devcontainer.yml (1 hunks)
  • ansible/bootstrap-ansible.sh (1 hunks)
  • proxmox/README.md (1 hunks)
  • proxmox/create-openwrt-vm.sh (3 hunks)
  • proxmox/create-ubuntu-server-vm.sh (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • .devcontainer/Dockerfile
  • .devcontainer/devcontainer.json
  • proxmox/README.md
  • .github/workflows/devcontainer.yml
  • ansible/bootstrap-ansible.sh
  • .devcontainer/Taskfile.dev.yaml
  • proxmox/create-openwrt-vm.sh
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{sh,Dockerfile,yml,yaml,tf}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Follow the pre-commit rules defined in .pre-commit-config.yaml, which includes linting for shell scripts, Dockerfiles, YAML files, Ansible playbooks, and Terraform configurations.

Files:

  • proxmox/create-ubuntu-server-vm.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build-test-push (ubuntu, ubuntu:24.04)
  • GitHub Check: build-test-push (debian, debian:trixie-slim)
  • GitHub Check: check
🔇 Additional comments (6)
proxmox/create-ubuntu-server-vm.sh (6)

8-8: LGTM! Ubuntu version upgrade looks correct.

The version bump from 24.04.2 to 24.04.3 is a valid patch update and aligns with the PR objective of upgrading OS images.


34-34: Good improvement: proper variable scoping.

Making AUTHORIZED_KEYS_FILE a local variable is a best practice that prevents variable pollution and potential conflicts.


79-95: Excellent security improvements with checksum verification.

The additions are well-implemented:

  • Local variables improve scoping
  • SHA256 checksum verification prevents corrupted/tampered downloads
  • Proper error handling with exit on verification failure
  • Appropriate wget options for automated downloads

Consider adding cd - after the download operations to return to the original directory, though it doesn't affect this script's functionality since no further operations depend on the working directory.


112-112: Good defensive programming: explicit string comparison.

The explicit string comparison [ "$AUTOINSTALL" = true ] is more robust than the previous boolean evaluation, preventing issues with unexpected values like "false" or "0".


123-134: Excellent improvement: standard bash argument parsing pattern.

The switch from a for loop to while loop with shift follows bash best practices for command-line argument processing and is more maintainable and flexible.


130-130: Correctly updated error message for new argument parsing.

The error message now accurately references $1 which aligns with the while loop argument parsing structure.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/os-upgrade

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (7)
proxmox/create-openwrt-vm.sh (2)

20-30: Add checksum verification for downloaded image

Validate integrity of the OpenWRT image after download to avoid corrupted/incomplete media.

 download_installer() {
-    readonly IMAGE_PATH="openwrt-${OPENWRT_VERSION}.img.gz"
-    readonly DOWNLOAD_URL="https://downloads.openwrt.org/releases/${OPENWRT_VERSION}/targets/x86/64/openwrt-${OPENWRT_VERSION}-x86-64-generic-ext4-combined.img.gz"
+    local -r IMAGE_PATH="openwrt-${OPENWRT_VERSION}.img.gz"
+    local -r DOWNLOAD_URL="https://downloads.openwrt.org/releases/${OPENWRT_VERSION}/targets/x86/64/openwrt-${OPENWRT_VERSION}-x86-64-generic-ext4-combined.img.gz"
+    local -r SHA256SUMS_URL="https://downloads.openwrt.org/releases/${OPENWRT_VERSION}/targets/x86/64/sha256sums"

     if [ -e "${IMAGE_PATH}" ]; then
         echo "OpenWRT disk image ${IMAGE_PATH} already downloaded"
     else
         echo "Downloading OpenWRT disk image ${IMAGE_PATH}"
-        wget -O "${IMAGE_PATH}" "${DOWNLOAD_URL}"
+        wget -q --show-progress -O "${IMAGE_PATH}" "${DOWNLOAD_URL}"
+        echo "Verifying SHA256 checksum..."
+        EXPECTED_SHA256="$(wget -qO- "${SHA256SUMS_URL}" | awk '/generic-ext4-combined\.img\.gz$/ {print $1; exit}')"
+        if [ -z "$EXPECTED_SHA256" ]; then
+            echo "Failed to retrieve expected SHA256 from ${SHA256SUMS_URL}" >&2
+            exit 1
+        fi
+        echo "${EXPECTED_SHA256}  ${IMAGE_PATH}" | sha256sum -c -
     fi
 }

61-73: Fix argument parsing: shift inside for-in is incorrect

Using shift inside a for arg in "$@" loop is a common pitfall and can lead to skipped or misparsed args. Use a while loop over "$1".

-for arg in "$@"; do
-    case $arg in
-        --download-only)
-            DOWNLOAD_ONLY=true
-            shift
-            ;;
-        *)
-            echo "Unknown argument: ${arg}"
-            exit 1
-            ;;
-    esac
-done
+while [[ $# -gt 0 ]]; do
+    case "$1" in
+        --download-only)
+            DOWNLOAD_ONLY=true
+            shift
+            ;;
+        *)
+            echo "Unknown argument: $1"
+            exit 1
+            ;;
+    esac
+done
proxmox/create-ubuntu-server-vm.sh (3)

78-86: Add checksum verification for the ISO (optionally verify signature)

Validate the ISO using official SHA256SUMS (and GPG signature if desired).

 download_installer() {
     readonly INSTALL_ISO_PATH="/var/lib/vz/template/iso/${INSTALL_ISO}"
     if [ -e "${INSTALL_ISO_PATH}" ]; then
         echo "Installer ISO ${INSTALL_ISO} already downloaded"
     else
         echo "Downloading installer ISO ${INSTALL_ISO}"
-        wget -O ${INSTALL_ISO_PATH} https://releases.ubuntu.com/${UBUNTU_VERSION}/${INSTALL_ISO}
+        local -r BASE_URL="https://releases.ubuntu.com/${UBUNTU_VERSION}"
+        wget -q --show-progress -O "${INSTALL_ISO_PATH}" "${BASE_URL}/${INSTALL_ISO}"
+        echo "Verifying SHA256 checksum..."
+        wget -q -O /tmp/SHA256SUMS "${BASE_URL}/SHA256SUMS"
+        if ! sha256sum -c /tmp/SHA256SUMS --ignore-missing | grep -q "${INSTALL_ISO}: OK"; then
+            echo "Checksum verification failed for ${INSTALL_ISO}" >&2
+            exit 1
+        fi
+        # Optional: also verify GPG signature with SHA256SUMS.gpg and Ubuntu keys
     fi
 }

18-21: Hash method mismatch: comment says SHA-512 but value is SHA-256

The hash starts with $5$ (SHA-256). Either regenerate with SHA-512 ($6$) as the comment states, or update the comment to SHA-256 for accuracy.

Options:

  • Regenerate with SHA-512:
    docker run -it --rm alpine mkpasswd --method=SHA-512
  • Or update the comment to: --method=SHA-256

112-124: Fix argument parsing: shift inside for-in is incorrect

Same issue as the OpenWRT script. Use a while loop over "$1".

-for arg in "$@"; do
-    case $arg in
-        --download-only)
-            DOWNLOAD_ONLY=true
-            shift
-            ;;
-        *)
-            echo "Unknown argument: ${arg}"
-            exit 1
-            ;;
-    esac
-done
+while [[ $# -gt 0 ]]; do
+    case "$1" in
+        --download-only)
+            DOWNLOAD_ONLY=true
+            shift
+            ;;
+        *)
+            echo "Unknown argument: $1"
+            exit 1
+            ;;
+    esac
+done
ansible/bootstrap-ansible.sh (2)

33-33: Fix package name: use gnupg instead of non-existent pgp.

Debian/Ubuntu provide gpg via gnupg. The "pgp" package does not exist and will cause apt failures.

-  apt-get install --yes wget pgp
+  apt-get install --yes wget gnupg

57-57: Correct gpg option: use --dearmor (current --dearmour will fail).

gpg uses the American spelling --dearmor. The current flag breaks keyring creation.

-  wget -O- "https://keyserver.ubuntu.com/pks/lookup?fingerprint=on&op=get&search=0x6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367" | gpg --dearmour -o /usr/share/keyrings/ansible-archive-keyring.gpg
+  wget -O- "https://keyserver.ubuntu.com/pks/lookup?fingerprint=on&op=get&search=0x6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367" | gpg --dearmor -o /usr/share/keyrings/ansible-archive-keyring.gpg
🧹 Nitpick comments (5)
proxmox/create-openwrt-vm.sh (1)

32-37: Avoid global readonly in functions; use local -r

readonly inside functions creates global, immutable variables. Use local -r to limit scope.

 create_vm() {
     # extract disk image
-    readonly VM_IMG="openwrt-${OPENWRT_VERSION}-vm-${VMID}.img"
+    local -r VM_IMG="openwrt-${OPENWRT_VERSION}-vm-${VMID}.img"
proxmox/create-ubuntu-server-vm.sh (2)

33-39: Scope and quoting improvements for authorized_keys

Use local for AUTHORIZED_KEYS_FILE and quote variables. Minor robustness improvement.

 get_authorized_keys_config() {
-    AUTHORIZED_KEYS_FILE=~/.ssh/authorized_keys
-    if [ -s "$AUTHORIZED_KEYS_FILE" ]; then
+    local AUTHORIZED_KEYS_FILE="$HOME/.ssh/authorized_keys"
+    if [ -s "$AUTHORIZED_KEYS_FILE" ]; then
         echo "    authorized-keys:"
-        sed 's/^/\      - "/; s/$/"/' "$AUTHORIZED_KEYS_FILE"
+        sed 's/^/\      - "/; s/$/"/' "$AUTHORIZED_KEYS_FILE"
     fi
 }

102-106: Consistent boolean check for AUTOINSTALL

Prefer test expression over executing a command named “true/false”.

-    if $AUTOINSTALL; then
+    if [ "$AUTOINSTALL" = true ]; then
         create_autoinstall_config
         qm set ${VMID} --ide0 local-lvm:cloudinit
         qm set ${VMID} --cicustom "vendor=local:snippets/${AUTOINSTALL_CONFIG_FILE}"
     fi
proxmox/README.md (1)

17-23: Good addition: v9 upgrade pointers

Nice concise guidance. Consider adding two bullets:

  • Take a backup/snapshot and ensure cluster is healthy before upgrade.
  • Verify repository configuration (enterprise vs no-subscription) matches environment.
ansible/bootstrap-ansible.sh (1)

58-58: Use HTTPS for the APT source line.

You already pin the keyring with signed-by (good). Use https to reduce exposure to MITM even further.

-  echo "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] http://ppa.launchpad.net/ansible/ansible/ubuntu $UBUNTU_CODENAME main" | tee /etc/apt/sources.list.d/ansible.list
+  echo "deb [signed-by=/usr/share/keyrings/ansible-archive-keyring.gpg] https://ppa.launchpadcontent.net/ansible/ansible/ubuntu $UBUNTU_CODENAME main" | tee /etc/apt/sources.list.d/ansible.list

Note: launchpad supports HTTPS via ppa.launchpadcontent.net for content delivery.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9987ab1 and 3bd2270.

📒 Files selected for processing (8)
  • .devcontainer/Dockerfile (1 hunks)
  • .devcontainer/Taskfile.dev.yaml (1 hunks)
  • .devcontainer/devcontainer.json (1 hunks)
  • .github/workflows/devcontainer.yml (1 hunks)
  • ansible/bootstrap-ansible.sh (1 hunks)
  • proxmox/README.md (1 hunks)
  • proxmox/create-openwrt-vm.sh (1 hunks)
  • proxmox/create-ubuntu-server-vm.sh (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{sh,Dockerfile,yml,yaml,tf}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Follow the pre-commit rules defined in .pre-commit-config.yaml, which includes linting for shell scripts, Dockerfiles, YAML files, Ansible playbooks, and Terraform configurations.

Files:

  • proxmox/create-openwrt-vm.sh
  • proxmox/create-ubuntu-server-vm.sh
  • ansible/bootstrap-ansible.sh
🧠 Learnings (1)
📚 Learning: 2025-01-25T11:16:21.899Z
Learnt from: bubacoder
PR: bubacoder/infra#89
File: ansible/bootstrap-ansible.sh:23-24
Timestamp: 2025-01-25T11:16:21.899Z
Learning: In the bootstrap-ansible.sh script, the `--ignore-installed` flag is only needed for pip installations on Ubuntu to fix PyYAML conflicts. The Debian installation works fine without this flag.

Applied to files:

  • ansible/bootstrap-ansible.sh
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: check
  • GitHub Check: build-test-push (debian, debian:trixie-slim)
  • GitHub Check: build
  • GitHub Check: build-test-push (ubuntu, ubuntu:24.04)
🔇 Additional comments (10)
proxmox/create-openwrt-vm.sh (3)

8-8: Version bump looks good

OPENWRT_VERSION updated to 24.10.2. No issues spotted with the change itself.


41-49: Network bridges: verify intended LAN/WAN mapping

Both net0 and net1 attach to vmbr0. If vmbr1 is intended for WAN, adjust accordingly.


38-40: Resizing raw disk doesn’t expand filesystem

qemu-img resize grows the block device but not the filesystem. Confirm OpenWRT auto-expands the ext4 root or add resize logic.

proxmox/create-ubuntu-server-vm.sh (2)

8-10: Ubuntu version bump looks correct

Updated to 24.04.3. Filename/URL pattern matches Ubuntu release naming.


41-76: Ensure storage ‘local’ supports snippets

cicustom uses local:snippets. Confirm storage ‘local’ has content type snippets enabled, or switch to a storage that does.

ansible/bootstrap-ansible.sh (1)

61-61: Good: Debian pip flags align with our prior guidance.

Debian path omits --ignore-installed while keeping --break-system-packages. This matches the prior learning about avoiding --ignore-installed on Debian.

.devcontainer/Dockerfile (1)

3-3: LGTM: Base image upgraded to debian:trixie-slim.

Consistent with other files. ARG is correctly in scope for the first stage and overridden where needed.

.devcontainer/devcontainer.json (1)

11-11: LGTM: devcontainer build-arg updated to trixie.

Matches Dockerfile and CI. No further changes needed.

.github/workflows/devcontainer.yml (1)

35-35: LGTM: CI matrix updated to debian:trixie-slim.

Workflow remains pinned to SHAs and includes a sanity test; alignment with devcontainer changes is good.

.devcontainer/Taskfile.dev.yaml (1)

15-15: LGTM: Task updated for Debian trixie.

Description and BASE_IMAGE are consistent with Dockerfile/CI.

Also applies to: 19-20

Comment thread ansible/bootstrap-ansible.sh Outdated
@bubacoder
bubacoder merged commit adf76ea into main Aug 11, 2025
6 checks passed
@bubacoder
bubacoder deleted the feature/os-upgrade branch August 11, 2025 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant