Can't create a container template from a container with mount points

dpatterson

New Member
Dec 2, 2023
11
0
1
I'm working on a base-line container that will be used to generate numerous containers down the road.
I got it to a point that I like and tried to convert it to a template.

The first attempt failed with TASK ERROR: Template feature is not available for '/mnt/pve/Projects`


/mnt/pve/Projects is a mount point to an SMB share that is mounted by.the Proxmox host.

My next attempt was to mark the volume (in the container config), as not replicated.
Attempting to create a template then appeared to hang. I stopped the task after about ten minutes.
I am thinking that it is trying to include the entire mount point contents in the template. Is that
what is happening? If so, that is definitely not what I want. That SMB share lives on my Mac and
contains about 75GB (and growing).

What does a container template actually contain?

How do I create a container template with the mount points, but not the data from them?
TIA
 
Code:
# /etc/pve/storage.cfg
dir: local
    path /var/lib/vz
    content iso,backup,vztmpl

zfspool: local-zfs
    pool rpool/data
    content rootdir,images
    sparse 1

zfspool: DataPool01
    pool DataPool01
    content images,rootdir
    mountpoint /DataPool01
    nodes r630-a
    sparse 1

zfspool: DataPool02
    pool DataPool02
    content images,rootdir
    mountpoint /DataPool02
    nodes r630-a
    sparse 1

cifs: Projects
    path /mnt/pve/Projects
    server macpro-2019.dpc
    share Projects
    content rootdir,images,snippets
    prune-backups keep-all=1
    username dpatterson
 
Last edited:
Text like this is best shared in a code block so the formatting is preserved.
Go to Datacenter > Storage and edit the content type of Projects to include Container template or modify the content line and add vztmpl. Also see here.
 
Last edited:
Text fixed :)

Projects in storage.cfg now includes vztmpl in the content list.
Attempting to convert the container to a template results in the TASK ERROR: Template feature is not available for '/mnt/pve/Projects` error.
 
Code:
'arch: amd64
cores: 2
features: nesting=1
hostname: Ubuntu-24-base
memory: 1024
mp0: /mnt/pve/Projects,mp=/mnt/projects,replicate=0
mp1: /mnt/pve/Projects/LinuxTools,mp=/mnt/linuxTools,replicate=0
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=BC:24:11:13:BA:8C,ip=dhcp,type=veth
ostype: ubuntu
rootfs: DataPool01:subvol-101-disk-0,size=10G
swap: 512
unprivileged: 1
 
Ah, I should have asked for that first. Sorry for wasting time by being confused. I can reproduce it now and the bind mount is the issue but unfortunately I don't know of a proper way to fix it.
I can't find much else other than this somewhat relevant forum post. Maybe you could create your own bug report about this?

One way to make it work is to use the same workaround people use to still be able to snapshot CTs with bind mounts
For example you can replace mp0 and mp1 with this
Code:
lxc.mount.entry: /mnt/pve/Projects /mnt/projects none bind,rw 0 0
lxc.mount.entry: /mnt/pve/Projects/LinuxTools /mnt/linuxTools none bind,rw 0 0
 
Last edited:
I had to do a little research to find out what the lxc.mount.entry lines are.
That works as workaround.
I'll see if I can submit a bug report.

Thanks very much
 
Oops. I spoke too soon.
Using lxc.mount.entry allowed me to convert the container to a template.
Unfortunately, creating a new container from that template results in a container without the mount points.
Drat.

That's odd. The two lxc.mount.entry lines _are_ in the config file for the new container, but they apparently didn't mount. The two mount points in the container are empty.
 
Last edited:
Well, I got it to work again. Based on another post, I removed the leading slashes from the container mount points.
From
Code:
lxc.mount.entry: /mnt/pve/Projects /mnt/projects none bind,rw 0 0
lxc.mount.entry: /mnt/pve/Projects/LinuxTools /mnt/linuxTools none bind,rw 0 0

To
Code:
lxc.mount.entry: /mnt/pve/Projects mnt/projects none bind,rw 0 0
lxc.mount.entry: /mnt/pve/Projects/LinuxTools mnt/linuxTools none bind,rw 0 0

It makes no sense to me why it worked with the slashes in the original container and not in the cloned container from the template.
 
It comes down to different syntax for different options. Sorry that was on me. The post I linked had it the right way. I probably forgot/overlooked it while editing the lines to match your old paths.
 
Last edited: