Skip to content

update-os.sh

Updates a VM's operating system based on its type (NixOS or Debian/Ubuntu).

Usage

update-os.sh <vmname> <vmid> <node>

Parameters

Parameter Description Example
vmname Name of the VM nextcloud
vmid Proxmox VM ID 610
node Proxmox node name tappaas1

Example

update-os.sh myvm 610 tappaas1

What it does

  1. Waits for VM to get an IP address (via guest agent or DHCP leases)
  2. Updates SSH known_hosts
  3. Detects OS type (NixOS or Debian/Ubuntu)
  4. For NixOS:
  5. Runs nixos-rebuild using ./<vmname>.nix in current directory
  6. Reboots VM to apply configuration
  7. Waits for VM to come back up
  8. For Debian/Ubuntu:
  9. Waits for cloud-init to complete
  10. Runs apt-get update && apt-get upgrade
  11. Installs QEMU guest agent
  12. Fixes DHCP hostname registration via NetworkManager

Requirements

  • For NixOS VMs: ./<vmname>.nix must exist in current directory
  • SSH access to VM as tappaas user
  • QEMU guest agent installed on VM

See Also