[Plugin] LXC Plugin


Recommended Posts

3 hours ago, Flummi said:

I installed Unraid 6.10.2 rc2 and I look forward to "webgui: add LXC terminal support (for LXC Plugin)" :D

Will be added Soon™ in a very basic form, maybe today... :D

Don't expect too much, it will be very basic (connects to the sh shell but you can change that by typing in bash or whatever shell you want to execute).

Link to comment

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 TurboVNC and noVNC so that you can connect to the container via a WebBrowser or a VNC Client?

  • Like 1
  • Upvote 4
Link to comment
6 hours ago, ich777 said:

Will be added Soon™ in a very basic form, maybe today... :D

Don't expect too much, it will be very basic (connects to the sh shell but you can change that by typing in bash or whatever shell you want to execute).

Btw, just updated to the latest rc and found a "bug". I wrote about that on the official unraid server already, but i though it would be useful information here aswell. Ill just copy/paste it here:

Not sure if this is an Unraid issue (6.10.2 RC2) or an issue with the LXC plugin, though i post it here first. This RC added an LXC Terminal Button, though this button assumes /bin/sh for the containers. If i install eg a debian container and use that function, in the new terminal window i cant use autocomplete or see the current path

Link to comment
39 minutes ago, Joly0 said:

Btw, just updated to the latest rc and found a "bug". I wrote about that on the official unraid server already, but i though it would be useful information here aswell. Ill just copy/paste it here:

This is not a bug from Unraid, please remove this bug post.

Limetech only added the ability for my plugin to open up a WebTerminal this was not possible before and this bug is only related to my plugin and has nothing to do with Unraid itself.

 

42 minutes ago, Joly0 said:

Not sure if this is an Unraid issue (6.10.2 RC2) or an issue with the LXC plugin, though i post it here first. This RC added an LXC Terminal Button, though this button assumes /bin/sh for the containers. If i install eg a debian container and use that function, in the new terminal window i cant use autocomplete or see the current path

Pleas read this post:

 

Simply type in:

bash

 

 

You have to understand that I can't simply connect to the bash shell because not every container has a bash shell (Alpine for example has no bash shell by default) and it would fail if I set the standard shell to /bin/bash

This is only a temporary solution and will be worked on but for now you have to connect to the shell and then type in bash or you change the default shell for the root user, this would also be a possibility.

 

17 minutes ago, Joly0 said:

Oh, and it looks like there is another issue aswell

This is just because the sh shell uses another coding as the Unraid shell, simply type in bash as mentioned above.

Link to comment

Thanks for the answer, i knew i could type bash there, though i am used to being able to define the bash which is used, i didnt found an option for that an assumed its done automatically, which isnt the case apparently. So i thought this is a bug, which it isnt, it just isnt implemented yet.

 

Regarding the coding of the unraid shell and the sh shell i didnt knew that, good to know for the future, thanks for the explanation :)

  • Like 1
Link to comment
4 minutes ago, Joly0 said:

Thanks for the answer, i knew i could type bash there, though i am used to being able to define the bash which is used, i didnt found an option for that an assumed its done automatically, which isnt the case apparently. So i thought this is a bug, which it isnt, it just isnt implemented yet.

Yes, exactly, this plugin is currently in development and features will be added over time like mentioned in the first post.

I've updated the plugin today because my PR was accepted yesterday that quickly that I had to implement it like it is now, I will maybe add a drop down or something like that so that you can choose which shell you want to connect to, but I'm not too sure about that now. I'm currently on a short vacation and this will take some time.

 

5 minutes ago, Joly0 said:

Regarding the coding of the unraid shell and the sh shell i didnt knew that, good to know for the future, thanks for the explanation :)

Yes, the coding in the LXC containers is different that's why it looks a little awkward, you can theoretically change that in the LXC container but you don't have to by using simply bash, fish, or whatever is the shell of your choice.

 

I'm also open to ideas and feature requests but it can take some time since I'm really busy currently (like always... :D ).

Link to comment
8 hours ago, ich777 said:

Don't expect too much, it will be very basic (connects to the sh shell but you can change that by typing in bash or whatever shell you want to execute).

I just want to let you know it went straight into bash in gentoo.

It's basic, but enough. :)

  • Like 1
Link to comment

While we are at it regarding feature requests.

I am facing the issue explained here https://lists.linuxcontainers.org/pipermail/lxc-users/2016-March/011277.html

The solution using su root works no problem, though its inconvenient. The option using the lxc config command looks better, though i cant use that because the command is missing. Would be great to be able to set the locale in a future update.

But no hurry, using su root is ok. Take your time and enjoy your vacation

Link to comment
8 hours ago, ich777 said:

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 TurboVNC and noVNC so that you can connect to the container via a WebBrowser or a VNC Client?


Sounds good for me i would be Interested in it! Maybe it can be used to get closer to the Turnkey LXC Templates later that would be Awesome!

Link to comment
27 minutes ago, Joly0 said:

While we are at it regarding feature requests.

I am facing the issue explained here

Have you yet tried to set the locales in your container if yes, how dod you try it?

 

27 minutes ago, Joly0 said:

The solution using su root works no problem, though its inconvenient. The option using the lxc config command looks better, though i cant use that because the command is missing.

Please read the first post again.

LXD is not included in the package because it will add more complexity and you can basically do everything without it.

Link to comment
32 minutes ago, Magges said:

Maybe it can be used to get closer to the Turnkey LXC Templates later that would be Awesome!

I think it would be great to do sich things throught the CA App rather than through the plugin itself, this will be only integrated for testing.

 

I have already made two scripts.

The first will install a full (minimal) Desktop Environment and the second one will install Homeassistant Core to a fresh installed Bullseye container, these two scripts are more a PoC and for testing, but the work perfectly fine. 😁

  • Upvote 1
Link to comment
3 minutes ago, ich777 said:

Have you yet tried to set the locales in your container if yes, how dod you try it?

Yes, i have tried that alraedy. Using this command for example dpkg-reconfigure locales && locale-gen or this command update-locale LANG=en_US.utf8.

Though even after rebooting the container, the locale command still shows posix for everything. Using su root followed by locale shows the correct locale settings which i have defined with the dpkg-reconfigure locales command

3 minutes ago, ich777 said:

Please read the first post again.

LXD is not included in the package because it will add more complexity and you can basically do everything without it.

Yes, i know that LXD is not included, i just meant, that it would be great to have an option like that, which works.

Link to comment

Though i just tested with a new container. Using just locale there shows posix for everything, using su root followed by locale shows the correct locale settings, without the need to use the dpkg-reconfigure command. So i guess this is just a bug

Link to comment
11 minutes ago, Joly0 said:

Though even after rebooting the container, the locale command still shows posix for everything. Using su root followed by locale shows the correct locale settings which i have defined with the dpkg-reconfigure locales command

Wouldn‘t it be better to crate a non root user and log into that account? Depending on what you are want to do that‘s not what you want to do…

 

11 minutes ago, Joly0 said:

Yes, i know that LXD is not included, i just meant, that it would be great to have an option like that, which works.

I have to look into what LXD does to change the language in the container, but from what I saw my container changed to the right locales when I changed it, have to look into this again.

 

7 minutes ago, Joly0 said:

Though i just tested with a new container. Using just locale there shows posix for everything, using su root followed by locale shows the correct locale settings, without the need to use the dpkg-reconfigure command. So i guess this is just a bug

What happens when you try the following from your Unraid Terminal with this command:

lxc-attach CONTAINERNAME su root


Edit:

lxc-attach CONTAINERNAME su

 

  • Like 1
Link to comment
1 minute ago, ich777 said:

Wouldn‘t it be better to crate a non root user and log into that account? Depending on what you are want to do that‘s not what you want to do…

Thats right, though i just faced this issue while trying to install cubecoders AMP in an LXC Container. AMP needs the right locale settings for its setup and the setup needs to be run by root user.

1 minute ago, ich777 said:

I have to look into what LXD does to change the language in the container, but from what I saw my container changed to the right locales when I changed it, have to look into this again.

Hm, i am just testing various things and reporting them back, and this behaviour is something i noticed, so i thought, maybe its better to report this 😅

2 minutes ago, ich777 said:

What happens when you try the following from your Unraid Terminal with this command:

lxc-attach CONTAINERNAME su root

Using this command works. Using locale afterwards shows the correct locale settings for the container.

  • Like 1
Link to comment
7 hours ago, jmztaylor said:

Would it be crazy to just symlink the folder to inside the rootfs folder somwhere?

Yes!

 

7 hours ago, jmztaylor said:

So how would be the best way to use a unraid share inside of the LXC container.

If you want to share anything with the container you have to keep in mind that you maybe mess up your permissions on that share if you don't created the appropriate user and group and assign the user in the container to this user and group, so I would recommend that you set up a test share to do this.

 

The steps would be:

  1. Start up the container and create the directory where the files should be mounted (in this example "/hostshare" with the command "mkdir -p /hostshare")
  2. Stop the container
  3. Create a share on Unraid (in this example we will use "lxcshare" with the path "/mnt/user/lxcshare")
  4. Set the permissions from this share to 777 with "chmod -R 777 /mnt/user/lxcshare"
  5. Open up your config file for the container (you'll find the path by clicking on the container name in the first line)
  6. Add this line: "lxc.mount.entry = /mnt/user/lxcshare hostshare none rw,bind 0.0" (without double quotes) and save the file
  7. Start the container again and navigate to /hostshare

 

Depending on how you set up the container and users you maybe can skip a few steps or have to do other things to make it work, but the above is the most basic test scenario which will work with for almost any configuration.

  • Like 2
Link to comment

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.