[GH-ISSUE #10281] Create container ignore local templates #2219

Closed
opened 2026-02-26 12:51:42 +03:00 by kerem · 2 comments
Owner

Originally created by @dmyger on GitHub (Dec 24, 2025).
Original GitHub issue: https://github.com/community-scripts/ProxmoxVE/issues/10281

Have you read and understood the above guidelines?

yes

🔎 Did you run the script with verbose mode enabled?

Yes, verbose mode was enabled and the output is included below

📜 What is the name of the script you are using?

Any. It does not matter.

📂 What was the exact command used to execute the script?

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/alpine.sh)"

⚙️ What settings are you using?

  • Default Settings
  • Advanced Settings

🖥️ Which Linux distribution are you using?

Debian 12

📈 Which Proxmox version are you on?

pve-manager/8.4.1/2a5fa54a8503f96d (running kernel: 6.8.12-10-pve)

📝 Provide a clear and concise description of the issue.

When creating a container, local templates are ignored and the online version is always taken.
Moreover, this template is definitely present locally.

🔄 Steps to reproduce the issue.

Run any script. Just for example:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/alpine.sh)"

Paste the full error output (if available).

    ___    __      _
   /   |  / /___  (_)___  ___
  / /| | / / __ \/ / __ \/ _ \
 / ___ |/ / /_/ / / / / /  __/
/_/  |_/_/ .___/_/_/ /_/\___/
        /_/
  ⚙️  Using Default Settings on node nas
  💡  PVE Version 8.4.1 (Kernel: 6.8.12-10-pve)
  🆔  Container ID: 123
  🖥️  Operating System: alpine (3.22)
  📦  Container Type: Unprivileged
  💾  Disk Size: 1 GB
  🧠  CPU Cores: 1
  🛠️  RAM Size: 512 MiB
  🚀  Creating a Alpine LXC using the above default settings

  ✔️   Storage local (Free: 60.5GB  Used: 26.7GB) [Template]
  ✔️   Storage WD6T (Free: 2.8TB  Used: 2.5TB) [Container]
  ✔️   Storage 'WD6T' (zfspool) validated
  ✔️   Template storage 'local' validated
  ✔️   Template search completed
  ✔️   Template alpine-3.22-default_20250617_amd64.tar.xz [online]
  ✔️   LXC Container 123 was successfully created.

🖼️ Additional context (optional).

Issue in the line Template alpine-3.22-default_20250617_amd64.tar.xz [online].
Expected: [local]

I researched the code and found that the file ProxmoxVE/misc/build.func contains the function create_lxc_container() with a section called “Template discovery & validation” where local templates are searched for. When values are filled in for the LOCAL_TEMPLATES variable, there is a problem with the patterns.

The key action here is following code (for case of alpine-3.22):

pveam list local | awk -v search="^alpine-3.22" -v pattern="-default_" '$1 ~ search && $1 ~ pattern {print 
$1}'

You are trying to find ^alpine-3.22 - and it's the wrong regexp. (!!)

Command pveam list local has output like following:

NAME                                                         SIZE  
local:vztmpl/alpine-3.21-default_20241217_amd64.tar.xz       3.01MB
local:vztmpl/alpine-3.22-default_20250617_amd64.tar.xz       3.12MB
local:vztmpl/debian-12-standard_12.12-1_amd64.tar.zst        118.00MB
local:vztmpl/debian-13-standard_13.1-2_amd64.tar.zst         123.70MB
local:vztmpl/ubuntu-24.04-standard_24.04-2_amd64.tar.zst     135.03MB

So awk will put in $1 the first field of it - local:vztmpl/alpine-3.22-default_20250617_amd64.tar.xz and it does not match the expected pattern.

For this reason, local templates for containers are completely ignored, and the template from the Internet is always used. This problem does not depend on the script being run.

I encountered this problem when I tried to use my own templates to reduce deployment time. But the create_lxc_container() function simply cannot find them due to the problem described above.

Originally created by @dmyger on GitHub (Dec 24, 2025). Original GitHub issue: https://github.com/community-scripts/ProxmoxVE/issues/10281 ### ✅ Have you read and understood the above guidelines? yes ### 🔎 Did you run the script with verbose mode enabled? Yes, verbose mode was enabled and the output is included below ### 📜 What is the name of the script you are using? Any. It does not matter. ### 📂 What was the exact command used to execute the script? bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/alpine.sh)" ### ⚙️ What settings are you using? - [x] Default Settings - [ ] Advanced Settings ### 🖥️ Which Linux distribution are you using? Debian 12 ### 📈 Which Proxmox version are you on? pve-manager/8.4.1/2a5fa54a8503f96d (running kernel: 6.8.12-10-pve) ### 📝 Provide a clear and concise description of the issue. When creating a container, local templates are **ignored** and the online version is always taken. Moreover, this template is definitely present locally. ### 🔄 Steps to reproduce the issue. Run any script. Just for example: ```sh bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/alpine.sh)" ``` ### ❌ Paste the full error output (if available). ``` ___ __ _ / | / /___ (_)___ ___ / /| | / / __ \/ / __ \/ _ \ / ___ |/ / /_/ / / / / / __/ /_/ |_/_/ .___/_/_/ /_/\___/ /_/ ⚙️ Using Default Settings on node nas 💡 PVE Version 8.4.1 (Kernel: 6.8.12-10-pve) 🆔 Container ID: 123 🖥️ Operating System: alpine (3.22) 📦 Container Type: Unprivileged 💾 Disk Size: 1 GB 🧠 CPU Cores: 1 🛠️ RAM Size: 512 MiB 🚀 Creating a Alpine LXC using the above default settings ✔️ Storage local (Free: 60.5GB Used: 26.7GB) [Template] ✔️ Storage WD6T (Free: 2.8TB Used: 2.5TB) [Container] ✔️ Storage 'WD6T' (zfspool) validated ✔️ Template storage 'local' validated ✔️ Template search completed ✔️ Template alpine-3.22-default_20250617_amd64.tar.xz [online] ✔️ LXC Container 123 was successfully created. ``` ### 🖼️ Additional context (optional). Issue in the line `Template alpine-3.22-default_20250617_amd64.tar.xz [online]`. Expected: `[local]` I researched the code and found that the file `ProxmoxVE/misc/build.func` contains the function `create_lxc_container()` with a section called _“Template discovery & validation”_ where local templates are searched for. When values are filled in for the `LOCAL_TEMPLATES` variable, there is a problem with the patterns. The key action here is following code (*for case of `alpine-3.22`*): ```sh pveam list local | awk -v search="^alpine-3.22" -v pattern="-default_" '$1 ~ search && $1 ~ pattern {print $1}' ``` You are trying to find `^alpine-3.22` - and it's the wrong `regexp`. (!!) Command `pveam list local` has output like following: ``` NAME SIZE local:vztmpl/alpine-3.21-default_20241217_amd64.tar.xz 3.01MB local:vztmpl/alpine-3.22-default_20250617_amd64.tar.xz 3.12MB local:vztmpl/debian-12-standard_12.12-1_amd64.tar.zst 118.00MB local:vztmpl/debian-13-standard_13.1-2_amd64.tar.zst 123.70MB local:vztmpl/ubuntu-24.04-standard_24.04-2_amd64.tar.zst 135.03MB ``` So `awk` will put in `$1` the first field of it - `local:vztmpl/alpine-3.22-default_20250617_amd64.tar.xz` and it does not match the expected pattern. For this reason, local templates for containers are completely ignored, and the template from the Internet is always used. This problem does not depend on the script being run. I encountered this problem when I tried to use my own templates to reduce deployment time. But the `create_lxc_container()` function simply cannot find them due to the problem described above.
kerem 2026-02-26 12:51:42 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@MickLesk commented on GitHub (Dec 24, 2025):

Fixed, but to be honest, setting up and analyzing your issue took more time than fixing the two places in the source code. I would like to point out that this is a community project and PRs with bug fixes can be created at any time.

<!-- gh-comment-id:3689460829 --> @MickLesk commented on GitHub (Dec 24, 2025): Fixed, but to be honest, setting up and analyzing your issue took more time than fixing the two places in the source code. I would like to point out that this is a community project and PRs with bug fixes can be created at any time.
Author
Owner

@dmyger commented on GitHub (Dec 24, 2025):

this is a community project and PRs with bug fixes can be created at any time

Overall, you are correct.
However, I do not have a complete understanding of your development plans. And I only have one Proxmox, which is far from the latest version. So my decision may not be entirely correct.

<!-- gh-comment-id:3689564461 --> @dmyger commented on GitHub (Dec 24, 2025): > this is a community project and PRs with bug fixes can be created at any time Overall, you are correct. However, I do not have a complete understanding of your development plans. And I only have one `Proxmox`, which is far from the latest version. So my decision may not be entirely correct.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ProxmoxVE#2219
No description provided.