When creating your own lxc template, proxmox refuses to make new virtual machines based on its new ones:

Using default stripesize 64.00 KiB. Logical volume "vm-100-disk-1" created. mke2fs 1.44.3 (10-July-2018) Discardindone Creating filesystem with 2097152 4k blocks and 524288 inodes Filesystem UUID: 5d45a865-bfc5-4368-8b88-710a39856a3d Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 Allocating group tabdone Writing inode tabdone Creating journal (16384 blocks): done Multiple mount protection is enabled with update interval 5 seconds. Writing superblocks and filesystem accounting informatdone extracting archive '/var/lib/vz/template/cache/snap-test-03-2018-08-04.tar.gz' Total bytes read: 407459840 (389MiB, 86MiB/s) Architecture detection failed: open '/bin/sh' failed: No such file or directory Falling back to amd64. Use `pct set VMID --arch ARCH` to change. Logical volume "vm-100-disk-1" successfully removed TASK ERROR: unable to detect OS distribution 

When using templates with https://linuxcontainers.org/ - everything is fine.

    1 answer 1

    The problem is wrong (in relation to proxmox anyway) tips on the Internet.

    1. No one advises adding a dash package to the template that provides /bin/sh
    2. When compressing, DO NOT pack /var/lib/lxc/<имя контейнера> . You need to pack /var/lib/lxc/<имя контейнера>/rootfs . In the resulting archive created via tar -czvf MUST NOT be the rootfs folder and the config file. ONLY root.

    Approximate (but working) script for packing:

     #!/bin/bash CONTAINER_NAME="test-05" lxc-create -t ubuntu --name "$CONTAINER_NAME" -- --arch "amd64" --release "bionic" --packages "dash,coreutils,python-apt,ssh,mc,nano,htop,tmux" --mirror http://mirror.yandex.ru/ubuntu cd /var/lib/lxc/"$CONTAINER_NAME" rm -r ./rootfs/var/cache/apt/archives/* rm -r ./rootfs/var/lib/apt/lists/* rm -r ./rootfs/var/log/* rm -r ./rootfs/proc/* rm -r ./rootfs/sys/* rm -r ./rootfs/tmp/* rm -r ./rootfs/var/tmp/* cd ./rootfs tar -czvf "$HOME"/"$CONTAINER_NAME"_"$(date +%F_%H-%M-%S)".tar.gz ./