Debian 13 LXC Template

Hey folks,


Just wanted to share a quick fix for anyone trying to use Debian 13 LXC templates from images.linuxcontainers.org and running into this error when creating a container in Proxmox VE:


Cause:
The template you're using is missing the file /etc/network/interfaces, which Proxmox expects to be present to inject the network config (especially if you assign a static IP in the UI).

Fix:
You just need to add a minimal network config inside the template image before using it.




Step-by-step fix:​


Extract the image :
Bash:
mkdir /tmp/fixed-template
cd /tmp/fixed-template
tar -xJf /path/to/debian-13-template.tar.xz
Add missing network config:
Bash:
mkdir -p etc/network
cat <<EOF > etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
EOF
Repack the image:
Bash:
tar -cJf /path/to/debian-13-fixed.tar.xz *
Place it in your template cache (e.g. /var/lib/vz/template/cache) and use it from the GUI or with pct create.

Now you can assign a dhcp or a static IP and gateway during container creation via the Proxmox interface, and it will work perfectly.
Hope this helps others — shoutout if you're hitting the same issue!
I tried applying this solution to an LXC cloud (is it correct?) image:
https://fra1lxdmirror01.do.letsbuildthe.cloud/images/debian/trixie/amd64/cloud/20250818_05:24/rootfs.tar.xz
The container starts successfully, but network auto-configuration fails
net0: name=eth0,bridge=vmbr0,firewall=1,gw=192.168.31.1,hwaddr=BC:24:11:46:DF:1E,ip=192.168.31.13/24,type=veth

defined in /etc/pve/lxc/XXX.conf are not applied automatically when creating a new LXC from this template.
its applied dhcp
but in lxc
Code:
cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.31.13/24
        gateway 192.168.31.1
Hostname, and nameserver settings sets normally

How can I fix this?
UPD

systemd-networkd doesnt use /etc/network/interfaces
how to switch proxmox to set lxc network config over systemd-networkd?
 
Last edited:
I tried applying this solution to an LXC cloud (is it correct?) image:
https://fra1lxdmirror01.do.letsbuildthe.cloud/images/debian/trixie/amd64/cloud/20250818_05:24/rootfs.tar.xz
The container starts successfully, but network auto-configuration fails
net0: name=eth0,bridge=vmbr0,firewall=1,gw=192.168.31.1,hwaddr=BC:24:11:46:DF:1E,ip=192.168.31.13/24,type=veth

defined in /etc/pve/lxc/XXX.conf are not applied automatically when creating a new LXC from this template.
its applied dhcp
but in lxc
Code:
cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.31.13/24
        gateway 192.168.31.1
Hostname, and nameserver settings sets normally

How can I fix this?
UPD

systemd-networkd doesnt use /etc/network/interfaces
how to switch proxmox to set lxc network config over systemd-networkd?
Hi,


Yes, the issue comes from the fact that you are using the cloud variant of the Debian 13 (Trixie) template.


  • Cloud images are built to work with cloud-init and systemd-networkd.
  • Proxmox LXC does not use cloud-init (only QEMU VMs do), and its LXC networking setup is based on /etc/network/interfaces with ifupdown.
  • That’s why your container ignores the static config from Proxmox and falls back to DHCP — systemd-networkd never reads /etc/network/interfaces.

You have two options:


  1. Use the standard Debian template (non-cloud) → Proxmox injects the IP/gateway correctly into /etc/network/interfaces and it just works.
  2. If you want to stick with the cloud image, then you need to either:
    • Disable systemd-networkd and install/enable ifupdown, so Proxmox networking works as expected, or
    • Write a hookscript that translates Proxmox’s net0 config into .network files for systemd-networkd.

For most cases, using the non-cloud image is the easiest fix.
 
  • Like
Reactions: Johannes S
For reference, I had no issue updating one of my Debian 12 LXCs to Debian 13. It's not using DHCP and isn't a fresh install, but if you have a tested backup setup for your LXCs and want to upgrade it seems to be working.

I stand corrected. The Debian 13 LXC ended chewing up all the CPU allocated to it. I decided to restore from backup of the Debian 12 version. I'll look into it later once Proxmox 9 and Debian 13 have a bit more real world use. I'm waiting on some storage to setup a test Proxmox 9 environment so I'll probably just leave my LXCs on 12 until I adopt Proxmox 9.
 
Last edited:
Are Debian 13 LXCs going to be supported on Proxmox 8 as well?

As of today they don't seem to be available for download using the templates button.
 
Yikes. I think I'll wait for the official image.
I've been using https://images.linuxcontainers.org/ templates for a while, and they work flawlessly.

Trixie uses systemd for network configuration. Skip the Network tab while creating the container, as @Jepe said. If you opt for DHCP, no more settings are needed; else, add Address and Gateway parameters to /etc/systemd/network/eth0.network.

INI:
[Match]
Name=eth0

[Network]
#DHCP=true
Address=192.168.0.29/24
Gateway=192.168.0.1

[DHCPv4]
UseDomains=true

[DHCP]
ClientIdentifier=mac

You can find more references here:
https://wiki.debian.org/NetworkConfiguration
https://www.debian.org/doc/manuals/..._the_modern_network_configuration_without_gui
 
  • Like
Reactions: iprowell
hey there,
just answering to
I stand corrected. The Debian 13 LXC ended chewing up all the CPU allocated to it.
Hm, strange.
Here are three LXC with debian 12 templates. I have an updated proxmox host (trixie). I updated 2 of those 3 LXC manually from debian 12 to 13. One won't let me, for stuff running inside does not have a repo for trixie yet...still fresh I guess).
What I have not noticed yet are any changes to ressource consumption as you mention it. Here all values look quite the same under 13. Just to spread some sunshine... ;)
 
Last edited:
  • Like
Reactions: iprowell
hey there,
just answering to

Hm, strange.
Here are three LXC with debian 12 templates. I have an updated proxmox host (trixie). I updated 2 of those 3 LXC manually from debian 12 to 13. One won't let me, for stuff running inside does not have a repo for trixie yet...still fresh I guess).
What I did not notice are any changes to ressource consumption as you mention it. Here all valuables look quite the same under 13. Just to spread some sunshine... ;)
My issue might be that my PVE host is still on Proxmox 8. I'll investigate further.
 
From your Proxmox VE -

apt-get install dab
mkdir -p dab/debian-13-standard
cd dab/debian-13-standard
wget https://raw.githubusercontent.com/p...heads/master/debian-13-trixie-std-64/dab.conf
dab init
dab bootstrap
dab finalize

And now you have a debian-13-standard_13.0.20250715-1_amd64.tar.gz. Copy it to /var/lib/vz/template/cache and you are off and running.

Reference: https://pve.proxmox.com/wiki/Debian_Appliance_Builder
... and the post immediately above that linked to the dab file. Thanks, that was pretty easy.
 
Hi,
I'm very new to this... If I built the template myself now, can you tell me how it would be different from the official one, once it is released?

Or in other words, would there be any reason to wait for the official one, if IPv6 DHCP doesn't matter to me?
 
Anyone else having issues with delayed network service startup using a template built according to the aforementioned instructions?

When I install for example docker.io, the service won't start for two minutes because it waits for the following service to time out:

Code:
/etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service
 
  • Like
Reactions: virtue_al
From your Proxmox VE -

apt-get install dab
mkdir -p dab/debian-13-standard
cd dab/debian-13-standard
wget https://raw.githubusercontent.com/p...heads/master/debian-13-trixie-std-64/dab.conf
dab init
dab bootstrap
dab finalize

And now you have a debian-13-standard_13.0.20250715-1_amd64.tar.gz. Copy it to /var/lib/vz/template/cache and you are off and running.

Reference: https://pve.proxmox.com/wiki/Debian_Appliance_Builder
... and the post immediately above that linked to the dab file. Thanks, that was pretty easy.
Ah, thank you so much for the tips. It really helped!
I created a script for my homelab based on these steps.

Now I can create a new LXC based on Debian 13. It's different from Proxmox Community Scripts, but it floats the boats for me.
https://github.com/wakbijok/homelab-scripts/tree/main/proxmox

I got screen blank issue at first based on the template but all sorted out with AppArmor permission
 
Hello,

I see there are a couple solutios in this thread
But here is how I install debian13 on proxmox 9


I made this shell function

Code:
ModifyDebian13ForProxmox() { f="$1"; d=$(mktemp -d); tar -xJf "$f" -C "$d" && mkdir -p "$d/etc/network" && { echo "auto lo"; echo "iface lo inet loopback"; echo ""; echo "auto eth0"; echo "iface eth0 inet dhcp"; } > "$d/etc/network/interfaces" && tar -C "$d" -cJf "$f" . && touch "$f.modified" && rm -rf "$d"; }


And you just call it on your debian install file

like this

Code:
ModifyDebian13ForProxmox /var/lib/vz/template/cache/debian-trixie-default-20250815_amd64.tar.xz

This will create the file /var/lib/vz/template/cache/debian-trixie-default-20250815_amd64.tar.xz.modified, so you can check if you've already modified it and not do it every time


And taking a step back, here is I download and do all this automatically

Code:
# these variables for the URLs and filenames
CT_template_download="https://images.linuxcontainers.org/images/debian/trixie/amd64/default/20250815_05:24/rootfs.tar.xz"
CT_template_filename="debian-trixie-default-20250815_amd64.tar.xz"
CT_template_file="local:vztmpl/$CT_template_filename"

# Only download template file if it is not already present
[ ! -f /var/lib/vz/template/cache/$CT_template_filename ] && wget "$CT_template_download" -O /var/lib/vz/template/cache/$CT_template_filename

# If filename contains trixie, and it's not already modified, then modify it
[[ "$CT_template_filename" == *trixie* ]] && [ ! -f "/var/lib/vz/template/cache/$CT_template_filename.modified" ] && ModifyDebian13ForProxmox "/var/lib/vz/template/cache/$CT_template_filename"
 
And lastly, here is my entire debian13 LXC creation script

Code:
# shell function to create --net variable
addnet() { CT_net_count=${CT_net_count:-0}; local net_name=$1; shift; local _CT_new_config="--net$CT_net_count name=$net_name"; local valid_params=("bridge" "firewall" "gw" "gw6" "hwaddr" "ip" "ip6" "link_down" "mtu" "rate" "tag" "trunks" "type"); while [ $# -gt 0 ]; do key=$1; value=$2; if [[ " ${valid_params[*]} " =~ " $key " ]]; then _CT_new_config="$_CT_new_config,$key=$value"; shift 2; else shift 1; fi; done; _CT_net_config="$_CT_net_config $_CT_new_config"; echo "Interface added: $_CT_new_config"; CT_net_count=$((CT_net_count + 1)); }
# shell function to create user variables
adduser() { user_ubound=$((user_ubound + 1)); local user_and_group=$1; IFS=':' read -r username group <<< "$user_and_group"; eval "user_name_${user_ubound}=\"$username\""; [ -n "$group" ] && eval "user_group_${user_ubound}=\"$group\""; shift 1; while [ $# -gt 0 ]; do case $1 in nologin) eval "user_shell_${user_ubound}='/usr/sbin/nologin'" ;; shell) shift 1; eval "user_shell_${user_ubound}=\"$1\"" ;; groups) shift 1; eval "user_groups_${user_ubound}=\"$1\"" ;; nopassword) eval "user_password_${user_ubound}=$(printf '%s' '!')" ;; password) shift 1; eval "user_password_${user_ubound}=\"$1\"" ;; lock) eval "user_lock_${user_ubound}=true" ;; *) echo "Warning: Unrecognized option '$1'" ;; esac; shift 1; done; }
createuser() { local i=$1; local username=$(eval echo "\$user_name_${i}"); local group=$(eval echo "\$user_group_${i}"); local shell=$(eval echo "\$user_shell_${i}"); local password=$(eval echo "\$user_password_${i}"); local groups=$(eval echo "\$user_groups_${i}"); local lock=$(eval echo "\$user_lock_${i}"); [ -n "$shell" ] && shell_option="-s $shell" || shell_option="-s /bin/bash"; [ -n "$group" ] && group_option="-g $group" || group_option=""; pct_exec useradd $shell_option $group_option "$username"; [ -n "$password" ] && pct_set_password "$username:$password"; [ "$password" = "!" ] && pct_exec usermod -L "$username"; [ "$lock" = "true" ] && pct_exec usermod -L "$username"; pct_exec mkdir -p "/home/$username"; [ -n "$group" ] && pct_exec chown "$username:$group" "/home/$username" || pct_exec chown "$username" "/home/$username"; [ -n "$groups" ] && pct_exec usermod -aG "$groups" "$username"; unset username group shell password groups lock; }
# shell function for create each file line variables
addfile() { file_ubound=$((file_ubound + 1)); eval "file_name_${file_ubound}=\"$1\""; [ -n "$2" ] && [[ "$2" =~ ^[0-9]+$ ]] && eval "filepermission_${file_ubound}=\"$2\""; [ -n "$3" ] && eval "fileowner_${file_ubound}=\"$3\""; unset file_line_ubound; }
addline() { file_line_ubound=$((file_line_ubound + 1)); eval "file_line_${file_line_ubound}_${file_ubound}=\"$1\""; eval "file_line_count_${file_ubound}=$file_line_ubound"; }
pct_append_text() { local file=$1; local text_or_var=$2; if [ -n "${!text_or_var}" ]; then local text=${!text_or_var}; elif [[ "$text_or_var" == file_line* ]]; then local text=$(eval echo \${$text_or_var}); else local text="$text_or_var"; fi; local command="echo \"$text\" >> \"$file\""; [ "$VERBOSE" -gt 0 ] && echo "pct exec $CT_ID -- /bin/sh -c \"$command\""; pct exec $CT_ID -- /bin/sh -c "$command"; }
pct_append_text() { local file=$1; local text_or_var=$2; if [ -n "${!text_or_var}" ]; then local text=${!text_or_var}; elif [[ "$text_or_var" == file_line* ]]; then local text=$(eval echo \${$text_or_var}); else local text="$text_or_var"; fi; local command="echo \"$text\" >> \"$file\""; [ "$VERBOSE" -gt 0 ] && echo "pct exec $CT_ID -- /bin/sh -c \"$command\""; pct exec $CT_ID -- /bin/sh -c "$command"; }
writefile() { local file_index=$1; local file_name=$(eval echo \${file_name_${file_index}}); local file_permission=$(eval echo \${filepermission_${file_index}}); local file_owner=$(eval echo \${fileowner_${file_index}}); local file_line_count=$(eval echo \${file_line_count_${file_index}}); local dir=$(dirname "$file_name"); pct_exec "mkdir -p \"$dir\""; for i in $(seq 1 $file_line_count); do local file_line_var="file_line_${i}_${file_index}"; pct_append_text "$file_name" "$file_line_var"; done; [ -n "$file_permission" ] && pct_exec "chmod $file_permission $file_name"; [ -n "$file_owner" ] && pct_exec "chown $file_owner $file_name"; }
# shell functions for adding mount points
add_mount_point() { mount_point_ubound=$((mount_point_ubound + 1)); eval "mount_point_host_${mount_point_ubound}=\"$1\""; eval "mount_point_guest_${mount_point_ubound}=\"$2\""; }
create_mount_point() { local i=$1; local host_path=$(eval echo "\$mount_point_host_${i}"); local guest_path=$(eval echo "\$mount_point_guest_${i}"); local index=$((i - 1)); echo "mp${index}: ${host_path},mp=${guest_path}" >> "$LXC_CONF_FILE"; }
# shell functions for user port binding permissions using authbind
add_port_bind() { port_bind_ubound=$((port_bind_ubound + 1)); eval "port_bind_number_${port_bind_ubound}=\"${1%%:*}\""; eval "port_bind_username_${port_bind_ubound}=\"${1##*:}\""; }
create_port_bind() { [ -z "$authbind_installed" ] && pct_install_package authbind && authbind_installed=1; local i=$1; local port_number=$(eval echo "\$port_bind_number_${i}"); local portbind_username=$(eval echo "\$port_bind_username_${i}"); [ -z "$portbind_username" ] && { echo "Error: Username is empty for port $port_number. Skipping."; return 1; }; pct_exec touch "/etc/authbind/byport/${port_number}"; pct_exec chmod 500 "/etc/authbind/byport/${port_number}"; pct_exec chown "$portbind_username" "/etc/authbind/byport/${port_number}"; unset portbind_username; }
# shell function to type pct exec commands
pct_exec() { [ "$VERBOSE" -gt 0 ] && echo "pct exec $CT_ID -- /bin/sh -c \"$*\""; pct exec $CT_ID -- /bin/sh -c "$*"; }
# set uid and gid mapping, if needed
setidmap() { LXC_CONF_FILE="${LXC_CONF_FILE:-/etc/pve/nodes/proxmox/lxc/$CT_ID.conf}"; [ -n "$CT_uid_map" ] && (read -ra uids <<< "$CT_uid_map"; if (( ${#uids[@]} == 1 )); then echo "lxc.idmap: u 0 ${uids[0]} 65536" >> "$LXC_CONF_FILE"; else echo "lxc.idmap: u 0 ${uids[0]} ${uids[1]}" >> "$LXC_CONF_FILE"; for ((i=1; i<${#uids[@]}; i++)); do echo "lxc.idmap: u ${uids[i]} ${uids[i]} 1" >> "$LXC_CONF_FILE"; echo "lxc.idmap: u $((uids[i]+1)) $((uids[0]+uids[i]+1)) $((65536-uids[i]-1))" >> "$LXC_CONF_FILE"; done; fi); [ -n "$CT_gid_map" ] && (read -ra gids <<< "$CT_gid_map"; if (( ${#gids[@]} == 1 )); then echo "lxc.idmap: g 0 ${gids[0]} 65536" >> "$LXC_CONF_FILE"; else echo "lxc.idmap: g 0 ${gids[0]} ${gids[1]}" >> "$LXC_CONF_FILE"; for ((i=1; i<${#gids[@]}; i++)); do echo "lxc.idmap: g ${gids[i]} ${gids[i]} 1" >> "$LXC_CONF_FILE"; echo "lxc.idmap: g $((gids[i]+1)) $((gids[0]+gids[i]+1)) $((65536-gids[i]-1))" >> "$LXC_CONF_FILE"; done; fi); }
pct_install_package() { local packages="$*"; case "$CT_os_type" in centos|almalinux|amazonlinux|openeuler|oracle|rockylinux|springdalelinux) install_command="yum install -y" ;; debian|devuan|kali|ubuntu|mint) install_command="apt -qq install -y" ;; alpine) install_command="apk add --quiet" ;; archlinux) install_command="pacman --noconfirm -S" ;; fedora) install_command="dnf install -y" ;; gentoo|funtoo) install_command="emerge --quiet" ;; opensuse) install_command="zypper --quiet install -y" ;; nixos) install_command="nix-env -i" ;; openwrt|busybox) install_command="opkg install" ;; voidlinux) install_command="xbps-install -y" ;; slackware) install_command="slackpkg install" ;; plamo) install_command="pkginstall" ;; alt) install_command="apt-get install -y" ;; *) echo "Error: Unknown or unsupported OS type '$CT_os_type'."; return 1 ;; esac; [ -n "$install_command" ] && pct_exec "$install_command $packages"; }
pct_update_package_manager() { case "$CT_os_type" in centos|almalinux|amazonlinux|openeuler|oracle|rockylinux|springdalelinux) pct_exec "yum -q -y update" ;; debian|devuan|kali|ubuntu|mint) pct_exec "apt -qq update" ;; alpine) pct_exec "apk update" ;; archlinux) pct_exec "pacman -Sy --noconfirm" ;; fedora) pct_exec "dnf -q -y update" ;; gentoo|funtoo) pct_exec "emerge --sync" ;; opensuse) pct_exec "zypper --gpg-auto-import-keys refresh" ;; nixos) pct_exec "nix-channel --update && nix-env -u '*'" ;; openwrt|busybox) pct_exec "opkg update" ;; voidlinux) pct_exec "xbps-install -Sy" ;; slackware) pct_exec "slackpkg update" ;; plamo) pct_exec "pkginstall --update" ;; alt) pct_exec "apt-get update" ;; *) echo "Error: Unknown or unsupported OS type '$CT_os_type'. Cannot update package manager."; return 1 ;; esac; }
#function to set link_down to 0
replace_link_down() { _CT_net_config=${_CT_net_config//link_down=1/link_down=0}; echo "Updated _CT_net_config: $_CT_net_config"; pct set "$CT_ID" $_CT_net_config; }
pct_set_password() { for user_pass in "$@"; do user=$(echo "$user_pass" | cut -d':' -f1); pass=$(echo "$user_pass" | cut -d':' -f2); pct_exec bash -c "'printf \"%s\n\" \"${user}:${pass}\" | chpasswd'"; done; }
addcommand() { pct_command_ubound=$((pct_command_ubound + 1)); eval "pct_command_${pct_command_ubound}=\"\$*\""; }
runcommand() { local i=$1; eval "pct_exec \${pct_command_${i}}"; }
add_docker_lxc_compatibility() { echo -e "lxc.apparmor.profile: unconfined\nlxc.cap.drop:\nlxc.cgroup.devices.allow: a\nlxc.mount.auto: proc:rw sys:rw\nlxc.mount.entry: /dev/fuse dev/fuse none bind,create=file" >> "$LXC_CONF_FILE"; }
ModifyDebian13ForProxmox() { f="$1"; d=$(mktemp -d); tar -xJf "$f" -C "$d" && mkdir -p "$d/etc/network" && { echo "auto lo"; echo "iface lo inet loopback"; echo ""; echo "auto eth0"; echo "iface eth0 inet dhcp"; } > "$d/etc/network/interfaces" && tar -C "$d" -cJf "$f" . && touch "$f.modified" && rm -rf "$d"; }


VERBOSE=1  # Enable verbose mode
[ "$VERBOSE" -gt 0 ] && echo "------------------------------ Creation of debian LXC container ------------------------------"
CT_ID="700"  # Adjust the container ID, doesn't have to be set
CT_hostname="debian13" #debian 13
CT_root_password="qwerty"
CT_memory="4000"
CT_cores="8"
CT_rootfs_size="64"
CT_nvidia_container="false"
CT_Docker_Enabled="true"

#add_port_bind "80:user"
CT_install_packages="screen wget htop git sudo openssh-server"

CT_enable_root_login="true"
CT_template_download="https://images.linuxcontainers.org/images/debian/trixie/amd64/default/20250815_05:24/rootfs.tar.xz"
CT_template_filename="debian-trixie-default-20250815_amd64.tar.xz"
CT_template_file="local:vztmpl/$CT_template_filename"
CT_key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8Eg5xSbsyLySMCH5K1eb8ZzLTLwPrXDmgyGh9OAi/kofhR6UrTtuVzViAxBV8i+52pgMkRFoX2q/wDKkX7bJk0HXGzs26Npz40BCOEO6hf8MlTc/Kdu288sxVKPhnMofJ1UGy4vZjy2AHoAEe0NbazoEiBNZNO+EpXAGnaxnSM2KQFDDidZydeFMaGKWPb0wYXnGeKbnjxA2rASbX2Rd515FC5ZkYVAK0KFjRV41q+xJebBDhGhgLpHynusmFINM/RdoUswD+c2lwRpdIL+yU+DIPt4J7pM6h0Tj8hTFlqIzemwKKFi4UkzL53oQFYpCK2qAHiBTHAfOdL8gcF5Kv rsa-key-20240131"
CT_key_file="/ssh_key.$CT_hostname.pub"

addnet eth0 hwaddr "D0:0D:BE:EF:14:51" ip dhcp ip6 manual firewall 0 bridge vmbr0 #link_down 1 # LAN interface (eth0)

#adduser user nopassword nologin

# Only download template file if it is not already present
[ ! -f /var/lib/vz/template/cache/$CT_template_filename ] && wget "$CT_template_download" -O /var/lib/vz/template/cache/$CT_template_filename
[[ "$CT_template_filename" == *trixie* ]] && [ ! -f "/var/lib/vz/template/cache/$CT_template_filename.modified" ] && ModifyDebian13ForProxmox "/var/lib/vz/template/cache/$CT_template_filename"

# Set the right OS Type
case "$CT_template_filename" in *almalinux*|*amazonlinux*|*centos*|*openeuler*|*oracle*|*rockylinux*|*springdalelinux*) CT_os_type="centos" ;; *alpine*) CT_os_type="alpine" ;; *alt*|*busybox*|*plamo*|*slackware*|*voidlinux*|*openwrt*) CT_os_type="unmanaged" ;; *archlinux*) CT_os_type="archlinux" ;; *debian*|*devuan*|*kali*) CT_os_type="debian" ;; *fedora*) CT_os_type="fedora" ;; *funtoo*|*gentoo*) CT_os_type="gentoo" ;; *mint*) CT_os_type="ubuntu" ;; *nixos*) CT_os_type="nixos" ;; *opensuse*) CT_os_type="opensuse" ;; *ubuntu*) CT_os_type="ubuntu" ;; *) CT_os_type="unmanaged" ;; esac
# Obtain the next CT_ID if not already set
: ${CT_ID:=100}; CT_ID=$((CT_ID < 100 ? 100 : CT_ID)); existing_ids=$(pct list | awk 'NR>1 {print $1}' | sort -n); while echo "$existing_ids" | grep -qw "$CT_ID"; do CT_ID=$((CT_ID + 1)); done
# Writing the public key to a file, as pct requires
echo "$CT_key" > $CT_key_file

# Create the container
echo ""; echo Creating LXC Container for $CT_template_filename

[ "$VERBOSE" -gt 0 ] && echo "pct create $CT_ID $CT_template_file --arch amd64 --cores $CT_cores --memory $CT_memory --hostname $CT_hostname $_CT_net_config --rootfs local-lvm:$CT_rootfs_size --features nesting=1 --ostype $CT_os_type"

pct create $CT_ID $CT_template_file --arch amd64 --cores $CT_cores --memory $CT_memory --hostname $CT_hostname $_CT_net_config --rootfs local-lvm:$CT_rootfs_size --features nesting=1 --ostype $CT_os_type

# delete key file
rm $CT_key_file

# Define the LXC configuration file path
LXC_CONF_FILE="/etc/pve/nodes/$(hostname)/lxc/$CT_ID.conf"

# to set console to shell mode
echo "cmode: shell" >> "$LXC_CONF_FILE"

#remapping users and group ids if CT_uid_map or CT_gid_map are set
#setidmap

# to add the mount points
#for i in $(seq 1 $mount_point_ubound); do create_mount_point $i; done

# Start the container
pct start $CT_ID

#Wait until container is finished booting
while [[ $(pct status $CT_ID) != *"running"* ]]; do echo "Waiting for container $CT_ID to start..."; sleep 2; done; echo "Container $CT_ID is running."

sleep 5

pct_update_package_manager

# Install additional packages if specified
[ -n "$CT_install_packages" ] && pct_install_package $CT_install_packages

# Enable root login via ssh
[ "$CT_enable_root_login" = "true" ] && pct_exec "sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config"
# Enable login with password
[ -n "$CT_root_password" ] && pct_exec "sed -i 's/^#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config"
[ -n "$CT_root_password" ] && pct_set_password "root:$CT_root_password"
pct_exec systemctl restart sshd

# create extra users
[ -n "$user_ubound" ] && for i in $(seq 1 $user_ubound); do createuser $i; done

# write all the files into the container
[ -n "$file_ubound" ] && for i in $(seq 1 $file_ubound); do writefile $i; done

# allow port binding by users if needed
[ -n "$port_bind_ubound" ] && for i in $(seq 1 $port_bind_ubound); do create_port_bind $i; done

# install nvidia container toolkit if requested
[ "$CT_nvidia_container" = "true" ] && install_nvidia_container_toolkit

# run the commands specified with addcommand
[ -n "$pct_command_ubound" ] && for i in $(seq 1 $pct_command_ubound); do runcommand $i; done

[ "$CT_Docker_Enabled" = "true" ] && add_docker_lxc_compatibility


Pasting that AS IS into the proxmox shell, creates a debian 13 LXC

---> You should change password and login key <---

This allows ssh root login

There a few extra commands you can use to customize your install, they are

addnet
adduser
addfile
addline
add_mount_point
add_port_bind
addcommand
 
Last edited:
  • Like
Reactions: rellek74