Skip to content

Instantly share code, notes, and snippets.

@xairoo
Last active May 8, 2024 06:26
Show Gist options
  • Save xairoo/31be473dc313d4e51268d9ea1aa29dfc to your computer and use it in GitHub Desktop.
Save xairoo/31be473dc313d4e51268d9ea1aa29dfc to your computer and use it in GitHub Desktop.

Limit log size

/etc/systemd/journald.conf

[Journal]
SystemMaxUse=10M
SystemMaxFileSize=10M
SystemMaxFiles=1

Add drives to container instead of using a SMB or NFS share

122 = container ID

pct set 122 -mp0 /media/ext01,mp=/media/ext01
pct set 122 -mp1 /media/ext02,mp=/media/ext02
pct set 122 -mp2 /media/ext03,mp=/media/ext03
pct set 122 -mp3 /media/ext04,mp=/media/ext04
pct set 122 -mp4 /media/ext05,mp=/media/ext05

Fix wrong permissions:

chown nobody -R /media/ext* && chgrp nogroup -R /media/ext* && chmod 777 -R /media/ext*

Enable TUN for Proxmox LXC

Missing TUN in your Proxmox LXC?

/dev/net/tun No such file or directory

You have to edit the containers config:

nano /etc/pve/lxc/<container_id>.conf

Add this entry:

lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file

Finally reboot the LXC and TUN will be available.

Enable root login without password / passwordless login

Run this in the specific Debian LXC:

GETTY_OVERRIDE="/etc/systemd/system/[email protected]/override.conf"
mkdir -p $(dirname $GETTY_OVERRIDE)
cat <<EOF >$GETTY_OVERRIDE
  [Service]
  ExecStart=
  ExecStart=-/sbin/agetty --autologin root --noclear --keep-baud tty%I 115200,38400,9600 \$TERM
EOF
systemctl daemon-reload
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment