Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template LOCAL is broken -- patch is here #4436

Closed
0bi-w6n-K3nobi opened this issue Apr 20, 2024 · 1 comment · Fixed by #4450
Closed

Template LOCAL is broken -- patch is here #4436

0bi-w6n-K3nobi opened this issue Apr 20, 2024 · 1 comment · Fixed by #4450

Comments

@0bi-w6n-K3nobi
Copy link

Hi.

I was trying create a fedora 40 beta with DistroBuilder tool.
Initially, I did think that problem is distro be Beta.
I did try again with files was previously generated, which have already worked.
Well... the problem did same!
I used something like:

lxc-create -n fedora -t local -- --metadata meta.tar.xz --fstree rootfs.tar.xz

and I receive the follow error:

lxc-create: fedora: ../src/lxc/parse.c: lxc_file_for_each_line_mmap: 78 No such file or directory - Failed to open file "LXC_TEMPLATE_CONFIG/common.conf"
lxc-create: fedora: ../src/lxc/parse.c: lxc_file_for_each_line_mmap: 129 Failed to parse config file "/var/lib/lxc/fedora/config" at line "lxc.include = LXC_TEMPLATE_CONFIG/common.conf"
lxc-create: fedora: ../src/lxc/tools/lxc_create.c: lxc_create_main: 318 Failed to create container fedora

After some tests and sometime after, so I did remember that templates are Shell scripts...
The problem was generated by set TEMPLATES_FILES before to set LXC_PATH!
I did make some tests... and create the follow patch:

--- a/usr/share/lxc/templates/lxc-local 2024-04-12 21:00:00.000000000 -0300
+++ b/usr/share/lxc/templates/lxc-local  2024-04-20 16:34:32.173400930 -0300
@@ -18,7 +18,8 @@
 COMPAT_LEVEL=5

 EXCLUDES=""
-TEMPLATE_FILES="${LXC_PATH}/config"
+# TEMPLATE_FILES="${LXC_PATH}/config;${LXC_ROOTFS}/etc/hostname;${LXC_ROOTFS}/etc/hosts"
+#  Set only after to define LC_PATH and LXC_ROOTFS ...


 # Make sure the usual locations are in PATH
@@ -93,6 +94,8 @@
   esac
 done

+TEMPLATE_FILES="${LXC_PATH}/config;${LXC_ROOTFS}/etc/hostname;${LXC_ROOTFS}/etc/hosts"
+
 # Check for required binaries
 for bin in tar xz; do
   if ! command -V "${bin}" >/dev/null 2>&1; then

Well... I took the opportunity to adjust too LXC_NAME at /etc/hosts and /etc/hostname at container.

I hoped to helped you.

@0bi-w6n-K3nobi
Copy link
Author

Yeah... Version LXC 6.0 from Repo Copr ganto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant