Category: Linux

  • Unlocking a Proxmox Guest VM Using the qm Command: A Step-by-Step Guide

    If you’re unable to start, stop, or migrate a Proxmox guest VM because it’s showing as locked, you need to clear that lock using the qm command before you can act on the VM. This usually happens after an interrupted backup, snapshot, or migration leaves a stale lock in place. This article walks through how to unlock a Proxmox guest VM. Skip to the bottom for a TL;DR.

    Step 1: Access the Proxmox shell
    You’ll need shell access to the Proxmox host. Connect over SSH, or use the “Shell” option in the Proxmox web interface for the relevant node.

    Step 2: Identify the guest VM ID
    Run qm list to see all guest VMs on the host along with their IDs and current status.

    Step 3: Check the lock type (optional but recommended)
    Run qm config <VM ID> and look for a lock: line in the output. This tells you what kind of lock is in place (e.g. backup, snapshot, migrate, rollback), which is useful context if the lock keeps coming back — it usually means the underlying job (a backup, for example) is still stuck or failing.

    Step 4: Unlock the guest VM
    Run qm unlock <VM ID>. Note that a locked VM typically can’t be stopped or started normally in the first place — that’s the point of the lock — so this is usually your first real action, not something you do after stopping the VM.

    Step 5: Start or stop the VM as needed
    Once unlocked, you can manage the VM normally: qm start <VM ID> or qm stop <VM ID>.

    Unlocking a Proxmox guest VM with qm unlock is quick, but treat it as a fix for a stuck lock, not routine practice. If a VM keeps re-locking, check what job is putting the lock there (backups are the most common culprit) and address that directly rather than repeatedly clearing the symptom. Keep your login credentials secure, and keep regular backups of your VMs.

    TL;DR:

    To unlock a Proxmox guest VM:

    qm config        # optional: check lock type first
    qm unlock 
    qm start         # or: qm stop 

    Replace <VM ID> with the actual guest VM ID in each command. For LXC containers, use pct in place of qm (e.g. pct unlock <CT ID>) — the commands aren’t interchangeable between VMs and containers.

  • Using Pigz with Tar

    pigz is a drop in multi-threaded replacement for gzip. If you have plenty of cores then it’ll significantly speed things up.

    tar -c --use-compress-program=pigz -f newtarball.tar dir
  • Cron Job for Let’s Encrypt nginx standalone renew Ubuntu

    I run nginx as a reverse proxy for sites that use SSL. Normally I’m doing something a bit strange so it doesn’t quite work having certbot manage my configs. This will renew ssl certs at 3am each morning if needed.

    0  3    * * 1   root    /usr/bin/certbot --standalone renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" > /dev/null 2>&1
  • Static Netplan template Ubuntu 20.04

    Editor’s note (2026): `gateway4` shown below is deprecated in current Netplan releases — it still works but throws a deprecation warning. The current-style syntax is a `routes:` block instead. Both are shown here.

    I like to leave a dhcp server up so that when I spin up a virtual machine to tinker with it’ll grab that IP and I’ll be on my marry way.

    If in the event that I want to later statically assign it (the ip) just use the following template and adjust.

    Older / still-working style (deprecated):

    network:
      ethernets:
        ens18:
          addresses:
          - 172.16.0.2/24
          nameservers:
            addresses:
            - 172.16.0.2
            - 8.8.8.8
            search:
            - domain.com
          gateway4: 172.16.0.1
      renderer: networkd
      version: 2

    Current-style syntax using a routes block instead of gateway4:

    network:
      ethernets:
        ens18:
          addresses:
          - 172.16.0.2/24
          nameservers:
            addresses:
            - 172.16.0.2
            - 8.8.8.8
            search:
            - domain.com
          routes:
          - to: default
            via: 172.16.0.1
      renderer: networkd
      version: 2

  • Linux Cheat Sheet ‘ls’

    One of the most common commands in Linux is the ‘ls’ command. It dates back to 1961 and is used to “list” files and directories on a filesystem.

    To list files and directories:

    user@host:/etc/bind$ ls
    bind.keys  db.0  db.127  db.255  db.empty  db.local  externals  internals  named.conf  named.conf.default-zones  named.conf.local  named.conf.options  rev  rndc.key  zones.rfc1918
    

    To list file details (long):

    user@host:/etc/bind$ ls -l 
    total 56
    -rw-r--r-- 1 root root        1991 Apr 27  2021 bind.keys
    -rw-r--r-- 1 root root         237 Dec 17  2019 db.0
    -rw-r--r-- 1 root root         271 Dec 17  2019 db.127
    -rw-r--r-- 1 root root         237 Dec 17  2019 db.255
    -rw-r--r-- 1 root root         353 Dec 17  2019 db.empty
    -rw-r--r-- 1 root root         270 Dec 17  2019 db.local
    drwxr-sr-x 2 root bind        4096 Jan 25 14:26 externals
    drwxr-sr-x 2 root bind        4096 Jan 23 00:05 internals
    -rw-r--r-- 1 root bind         466 Jun 16  2021 named.conf
    -rw-r--r-- 1 root bind         498 Dec 17  2019 named.conf.default-zones
    -rw-r--r-- 1 root bind         752 Jan 24 23:36 named.conf.local
    -rw-r--r-- 1 root bind           0 Jan 24 23:34 named.conf.options
    drwxr-sr-x 2 root bind        4096 Jan  9 14:56 rev
    -rw-r----- 1 bind Debian-snmp  101 Jan 23 00:54 rndc.key
    -rw-r--r-- 1 root root        1244 Jan  8 21:39 zones.rfc1918

    List all files:

    user@host:/etc/bind$ ls -l 
    .  ..  bind.keys  db.0  db.127  db.255  db.empty  db.local  externals  internals  named.conf  named.conf.default-zones  named.conf.local  named.conf.options  rev  rndc.key  zones.rfc1918

    List all files with details:

    user@host:/etc/bind$ ls -al 
    total 64
    drwxr-sr-x   5 root bind        4096 Jan 25 22:10 .
    drwxr-xr-x 104 root root        4096 Jan 26 13:43 ..
    -rw-r--r--   1 root root        1991 Apr 27  2021 bind.keys
    -rw-r--r--   1 root root         237 Dec 17  2019 db.0
    -rw-r--r--   1 root root         271 Dec 17  2019 db.127
    -rw-r--r--   1 root root         237 Dec 17  2019 db.255
    -rw-r--r--   1 root root         353 Dec 17  2019 db.empty
    -rw-r--r--   1 root root         270 Dec 17  2019 db.local
    drwxr-sr-x   2 root bind        4096 Jan 25 14:26 externals
    drwxr-sr-x   2 root bind        4096 Jan 23 00:05 internals
    -rw-r--r--   1 root bind         466 Jun 16  2021 named.conf
    -rw-r--r--   1 root bind         498 Dec 17  2019 named.conf.default-zones
    -rw-r--r--   1 root bind         752 Jan 24 23:36 named.conf.local
    -rw-r--r--   1 root bind           0 Jan 24 23:34 named.conf.options
    drwxr-sr-x   2 root bind        4096 Jan  9 14:56 rev
    -rw-r-----   1 bind Debian-snmp  101 Jan 23 00:54 rndc.key
    -rw-r--r--   1 root root        1244 Jan  8 21:39 zones.rfc1918