gif gif

The interesting corner

gif gif

Useful commands for a fresh LXC container

When I was setting up some services for my homelab on my Proxmox machine, I was entering the same commands multiple times. So I wrote them down here to be able to quickly enter them again.

Create user with home directory and bash as shell

        
          sudo useradd -m -s /bin/bash username
        
      

Set password of new user

        
          sudo passwd username
        
      

Add user to sudo group

        
          sudo usermod -aG sudo username
        
      

Enable networking

Edit the file /etc/network/interfaces and add the contents:

        
          auto lo
          iface lo inet loopback

          auto eth0
          iface eth0 inet dhcp
        
        

Then restart the networking service:

        
          sudo service networking restart
        
        

Ubuntu 24.04 container

Ubuntu 24.04 uses netplan and the above setup will not work. To get internet to work, use these commands:

          
            sudo nano /etc/netplan/00-installer-config.yaml
          
          

Change the contents to:

            
              network:
                version: 2
                ethernets:
                  eth0:
                    dhcp4: true
                    dhcp6: false
                    optional: true
                    nameservers:
                      addresses:
                        - 10.10.10.102
            
          

Then apply:

            
              sudo netplan apply
            
          

Install SSH server

        
          sudo apt update
          sudo apt install openssh-server
          sudo systemctl status sshd
        
      

Resizing LXC disk image

11-01-2026

I wanted to resize my Gitty LXC container disk image from 16G to 64G (So I could version control this website (*^-^*)).

On the proxmox host, stop the container and resize the image:

        
pct stop 109
pct resize 109 rootfs 64G
        
      

If you accidentally close the shell window too soon (like me <(_ _)>), you'll get this error:

TASK ERROR: got unexpected control message:
          

The disk image will be resized, but the filesystem will still show up as the original size. To fix this, with the container still stopped, activate the logical image of the container:

        
lvchange -ay VMs/vm-109-disk-0
        
      

Then resize the filesystem:

        
e2fsck -f /dev/VMs/vm-109-disk-0
resize2fs /dev/VMs/vm-109-disk-0