Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Plugin] LXC Plugin

Featured Replies

Hi thanks for your qucik reply,

I think the broken config is for another lxc for obs which I messed up :D. The AMP one should be the standard template .

Sorry I should have deleted that LXC before I created the diognostic dump.

This is the error I get with the AMP lxc

lxc-start: AMPDorothyLXC: ../src/lxc/sync.c: sync_wait: 34 An error occurred in another process (expected sequence number 7)

This is my AMP template (just redacted uniqe names etc):

# Template used to create this container: /usr/share/lxc/templates/lxc-download

# Parameters passed to the template: --dist debian --release bookworm --arch amd64

# Template script checksum (SHA-1): 4a95b61004607fd2e89689cb76b94abf6da133d0

# Distribution configuration

lxc.include = /usr/share/lxc/config/common.conf

lxc.arch = linux64

# Container specific configuration

lxc.rootfs.path = dir:/mnt/containers/lxc/<redacted>/rootfs

lxc.uts.name = <redacted-hostname>

# Network configuration

lxc.net.0.type = veth

lxc.net.0.flags = up

lxc.net.0.link = br0

lxc.net.0.name = eth0

lxc.net.0.hwaddr = XX:XX:XX:XX:XX:XX

lxc.start.auto = 0

# Allow TUN access

lxc.cgroup2.devices.allow = c 10:200 rwm

lxc.mount.entry = /dev/net/tun dev/net/tun none bind,create=file

#container_description=Game Servers

#container_webui=http://[IP]:8080

#container_supportlink=https://support.me.pls

#container_donatelink=https://payme.now/pls

Edited by d0us

  • Replies 899
  • Views 157.4k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • Install SSH Server in Debian based containers:     Method 1 (recommended) :   Attach to the container with "lxc-attach DebianLXC /bin/bash" (replace DebianLXC with your con

  • Is someone here interested in something like a "Button" on the create container page where a Debian Bullseye container is set up with a pretty basic Desktop environment (XFCE4) in conjunction with Tur

  • domrockt
    domrockt

    AWSOMEEEEEEE   

Posted Images

  • Author
42 minutes ago, d0us said:

This is the error I get with the AMP lxc

Is this the full output from lxc-start -F <CONTAINERNAME> (please don't forget to include the -F)

42 minutes ago, d0us said:

Sorry I should have deleted that LXC before I created the diognostic dump.

Did you by any chance change your docker network from macvlan to ipvlan or did you change any bridge network on Unraid itself to use eth0 instead of br0?

43 minutes ago, d0us said:

# Allow TUN access

lxc.cgroup2.devices.allow = c 10:200 rwm

lxc.mount.entry = /dev/net/tun dev/net/tun none bind,create=file

The above is also not default.

Did you possible issue new permissions on the LXC container directory?

Usually the containers will still work but the error message that you've posted is not much.

This is the full error:

root@me:~# lxc-start -F AMPDorothyLXC

lxc-start: AMPDorothyLXC: ../src/lxc/sync.c: sync_wait: 34 An error occurred in another process (expected sequence number 7)

lxc-start: AMPDorothyLXC: ../src/lxc/start.c: __lxc_start: 2114 Failed to spawn container "AMPDorothyLXC"

lxc-start: AMPDorothyLXC: ../src/lxc/tools/lxc_start.c: lxc_start_main: 307 The container failed to start

lxc-start: AMPDorothyLXC: ../src/lxc/tools/lxc_start.c: lxc_start_main: 312 Additional information can be obtained by setting the --logfile and --logpriority options


Did you by any chance change your docker network from macvlan to ipvlan or did you change any bridge network on Unraid itself to use eth0 instead of br0?

I haven't changed anything on my end. Everything looks bridged to br0

# Allow TUN access

lxc.cgroup2.devices.allow = c 10:200 rwm

lxc.mount.entry = /dev/net/tun dev/net/tun none bind,create=file

The above is also not default.

I added this to enable tailscale from withing the lxc.

Did you possible issue new permissions on the LXC container directory?



I created another lxc and it starts so I think permissions are correct?

When I look at the log as suggested by the prompt the error I see is this:

Permission denied - Failed to exec "/sbin/init"

Edited by d0us

  • Author
1 hour ago, d0us said:

I created another lxc and it starts so I think permissions are correct?

Nope, that doesn‘t mean that the permissions are correct.

I assume something changed the permissions in the folder or even something got deleted somehow and that‘s why the container is not working anymore.

LXC works a bit different than Docker for example, each container has it’s own rootfs and when you change permission the containers won‘t start anymore meaning that they are bricked.

There should be a big red warning on the settings page to never run the Unraid function „Fix Permission“ on the LXC share sonce this basically would break all containers.

Thanks again for looking into this.

I have fix common problems plugin? Could that have caused permission changes?

Looks like I'm out of luck then? I haven't logged into the urnaid for a couple of months and don't know what has changed since . Guess I'll nuke it and start again :(.

Thanks :)

Edited by d0us

  • Author
2 hours ago, d0us said:

I have fix common problems plugin? Could that have caused permission changes?

Usually not, Fix Common Problems won‘t change permissions on files/folders, correct @Squid

2 hours ago, d0us said:

Guess I'll nuke it and start again :(.

Sorry for that but usually it should just work if you don‘t change permissions.

I really can‘t tell what happened there, sorry.

Thanks for looking!

  • 2 weeks later...

Good evening,

is there a way to use a backup and restore it on another unraid machine? I want to move to a newer machine.

Thanks.

  • Author
9 hours ago, moses19850 said:

Good evening,

is there a way to use a backup and restore it on another unraid machine? I want to move to a newer machine.

Thanks.

This is not how it‘s intended but it is possible.

Just extract the Backup on the other machine in the LXC directory after that open the config file and make sure the paths and names are correct.

Perfect, will check it out.

Again anothe question: How can I change the icon for an lxc? I have many of them and it would be nice to distingish not only on the name, but as well on the icon?

  • Author
26 minutes ago, moses19850 said:

Again anothe question: How can I change the icon for an lxc? I have many of them and it would be nice to distingish not only on the name, but as well on the icon?

Create a directory named 'custom_icons' in your main LXC directory (that you've specified in the LXC setting) and there you can put in png files, it would be best that they are square and a maximum size from 512x512 but they can be basically be any size you want.

It is also important to name the png the exact name from the container (case sensitive):
ContainerName.png -> means that the container is named ContainerName

Hope that helps

  • 4 weeks later...

Again me,

based on the availble scripts created by @ich777 , I wanted to create my own script to automatically set up a container.

Everything is fine until I start the container.

Script:

#!/bin/bash

if [ ! -f /boot/config/plugins/lxc.plg ]; then

echo "ERROR: LXC plugin not found!"

exit 1

fi

LXC_PATH=$(cat /boot/config/plugins/lxc/lxc.conf | grep "lxc.lxcpath" | cut -d '=' -f2)

LXC_PACKAGE_NAME=testlxc

LXC_PACKAGE_DIR=${LXC_PATH}/cache/build_cache

LXC_DISTRIBUTION=debian

LXC_RELEASE=bookworm

LXC_ARCH=amd64

LXC_BUILD_ROOT=$(cd "$(dirname "$0")" && pwd)

LXC_CONT_NAME=testlxc

if echo ${LXC_PATH} | grep -q "/mnt/user" ; then

echo "ERROR: LXC path /mnt/user is not allowed!"

exit 1

fi

echo "Creating ${LXC_CONT_NAME}"

lxc-create --name ${LXC_CONT_NAME} \

--template download -- \

--dist ${LXC_DISTRIBUTION} \

--release ${LXC_RELEASE} \

--arch ${LXC_ARCH}

echo "Starting ${LXC_CONT_NAME}"

lxc-start -n ${LXC_CONT_NAME}

echo "Waiting 10 seconds for ${LXC_CONT_NAME} to become online"

sleep 10

cat >> "EOF" >/mnt/vecna/lxc/${LXC_CONT_NAME}/rootfs/tmp/"${LXC_CONT_NAME}_installer.sh"

hello world

EOF

echo "installer file created"

This is what I get as response from the terminal:

Creating testlxc

Using image from local cache

Unpacking the rootfs

---

You just created a Debian bookworm amd64 (20250918_05:24) container.

To enable SSH, run: apt install openssh-server

No default root or user password are set by LXC.

Starting testlxc

Waiting 10 seconds for testlxc to become online

After starting the container and the stated echo, the terminal stays black "forever". I killed it after couple of minutes.

Can somebody please help me?

thanks

  • Author
9 hours ago, moses19850 said:

Can somebody please help me?

Okay, this is a modified script from my create container packages script correct?

Can you please be a bit more specific what you want to do exactly?

You have definitely an issue in your cat with the quotations from EOF and therefore you "hang" at your cat command.

This would be way easier and I'm not 100% sure what you are doing here since you are trying to create a file named ${LXC_CONT_NAME}_installer.sh, please don't also forget that you have to make the file executable or run it with bash in front of it:

...
sleep 10

echo "echo \"hello world\"" > /mnt/vecna/lxc/${LXC_CONT_NAME}/rootfs/tmp/${LXC_CONT_NAME}_installer.sh
echo "installer file created"
...

However this seems rather complicated, why not do it like in my GitHub repository here.

Since I copy files from the host in the container and then loop through them.

The main issue from above are the quotations from what I see.

Hi,

thanks for your fast answer, as always.

Yes, I took one of yours.

Why I don't want to do it like in your repository, I don't want to have to many files. I want to have as less as possible files to deal with in case, I need to move. Therefore I had the idea, to let the script create the other scripts.

Thanks for the hint with the bash, but as the script was not working with the full content, I took one line to see what causes the error.

Will do it with echo as you suggested.

  • Author
4 minutes ago, moses19850 said:

Therefore I had the idea, to let the script create the other scripts.

Sure this is also possible but introduces maybe some other difficult to solve escape scenarios for characters, I also tried that myself in the beginning but I find it much more practicable to do it that way, you can also create just one "big" file, I just split the process into many different files to be able to troubleshoot quicker and to be a bit more transparent in the log what is/was done.

6 minutes ago, moses19850 said:

Thanks for the hint with the bash, but as the script was not working with the full content, I took one line to see what causes the error.

The issue is definitely your cat command since it stops there.

I fully understand this approach. I will investigate a little more, and if I'm not able to manage, for sure I need to use multiple files and in that case, your github is a good source to continue my journey

After some research I stick to cat and it works so far.

Important to know, and this I got from this link: https://stackoverflow.com/questions/2500436/how-does-cat-eof-work-in-bash

\ must be used to quote the characters \, $, and `.

With this in mind, also a line like this:

sed -i "s/\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'cookie';/\$cfg\['Servers'\]\[\$i\]\['auth_type'\] = 'config';/" $CONFIG_FILE

is no problem anymore

Maybe this helps others

  • Author
57 minutes ago, moses19850 said:

is no problem anymore

It will be probably in the future because that introduces a lot of risks if you even forget to escape one character, that's what I've meant with escape scenarios...

But if you can live with that... but always keep in mind that this can cause serious issues, I just recently had a similar issue with the Nvidia Unraid driver plugin and there I need to escape everything.

  • 2 weeks later...

Again me,

first with scripts this makes my life so much easier.

And as I have now more containers running, I came across the issue, that ip addresses are given twice on my whole network, can I change the ip address of a container? In the config I did not see anyhting.

thanks

  • Author
34 minutes ago, moses19850 said:

And as I have now more containers running, I came across the issue, that ip addresses are given twice on my whole network, can I change the ip address of a container? In the config I did not see anyhting.

I'm not 100% sure what you mean, do the IP addresses also show up doubled on the LXC page or is this just on your network?

Are you sure you didn't assign an IP in the container and in the config?

Otherwise this is most likely a network issue, do you maybe configured two interfaces for the containers?

Please always keep in mind this is most likely not related to LXC and rather it might be related to the Distribution.

I'm having no luck searching and any time I click a thread-based search result link the forum takes me to the last page of the thread, not the clicked post. :(

So apologies if it's been covered (multiple times) before and if I already knew and have forgotten:

How do we pass a local Unraid path into an LXC? In my case I want to pass the root of a pool.

  • Author
15 minutes ago, Espressomatic said:

How do we pass a local Unraid path into an LXC? In my case I want to pass the root of a pool.

I think you've posted a config where you have a mount entry included:

However this is the correct way to do it, make sure the path exists in the container in the first place otherwise it won't work:

18 minutes ago, Espressomatic said:

I'm having no luck searching and any time I click a thread-based search result link the forum takes me to the last page of the thread, not the clicked post. :(

Inside the thread click on search and there simply enter mount or mount.entry

Thanks for the super fast response! Now I can finish setting up this new Immich installation. I decided to roll it out inside LXC as I was somewhat disappointed in how it worked via Unraid's docker UI at this time.

1 hour ago, ich777 said:

Inside the thread click on search and there simply enter mount or mount.entry

I was doing this, but the problem is that the forum jumps only to the last page of the thread instead of the post in the search result (clicking most places including the body of the result). I think this is a bug in the forum software as I've just discovered that it will work when clicking the small DATE link instead.

Edited by Espressomatic

4 hours ago, ich777 said:

I'm not 100% sure what you mean, do the IP addresses also show up doubled on the LXC page or is this just on your network?

Are you sure you didn't assign an IP in the container and in the config?

Otherwise this is most likely a network issue, do you maybe configured two interfaces for the containers?

Please always keep in mind this is most likely not related to LXC and rather it might be related to the Distribution.

No the containers don't share the same IP, so you are right, it's on the whole network. And yes I'm sure, I did not assign any ip in the script. Would it be possibe to do it within the script as well? Or can I change it afterwards?

  • Author
36 minutes ago, moses19850 said:

Or can I change it afterwards?

Sure, inside the container, please keep in mind that this is basically a VM, or better speaking a full distribution in a container.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.