[Plugin] LXC Plugin


Recommended Posts

17 minutes ago, Arron_x said:

how can i install criu

Currently CRIU is not delivered with my plugin and I'm not sure if I will add it but the possibility is there.

 

You can of course run:

lxc-snapshot CONTAINERNAME

to create a snapshot from the whole container but keep in mind you have to first stop the container!

 

After that you can list the available snapshots with:

lxc-snapshot CONTAINERNAME -L

 

 

I hope that helps for now.

  • Like 1
Link to comment
5 minutes ago, ich777 said:

Currently CRIU is not delivered with my plugin and I'm not sure if I will add it but the possibility is there.

 

You can of course run:

lxc-snapshot CONTAINERNAME

to create a snapshot from the whole container but keep in mind you have to first stop the container!

 

After that you can list the available snapshots with:

lxc-snapshot CONTAINERNAME -L

 

 

I hope that helps for now.

OK

It works now ,thanks.  but still wish the plugin support checkpoints.

  • Like 1
Link to comment
  • 2 weeks later...

Added automatic installation of a Debian Bullseye container with a Desktop environment reachable through noVNC and VNC.

 

Update the plugin

  1. Go to the LXC page and click on "Add Container" and at the bottom you have now the ability to enter a Name for the container (MAC address will be generated automatically and Autostart is disabled by default):
    image.thumb.png.700c34853a53cfd639e57778522b94a2.png

     
  2. After you clicked on "Create VNC Container" you will see something like this:
    image.png.059cd049e5a004da8511465eed4c3996.png

    ATTENTION: Don't close this window or interrupt the process since it installs everything to the container from this point on.

    This Process can take a very long time depending on your internet connection, speed of your drives and general performance from your server since it has to install a full Desktop environment from scratch.

     
  3. After everything is finished the "DONE" button is displayed and it should look something like this:
    image.png.078c9c499e729b81494e5b1ad5d330ef.png
    You see now that you can reach it via noVNC through: LXCContainerIP:8080/vnc.html?autoconnect=true and through any VNC compatible client through: LXCContainerIP:5900

     
  4. Close the window with the "DONE" button and go back to your LXC page to see the IP from the newly set up container and connect to it, in my case with: 10.0.0.172:8080/vnc.html?autoconnect=true :
    image.thumb.png.8c24b7ce30eec1686349b77ef222eb42.png

     
  5. After connecting to the container you should be greeted with the Desktop:
    image.thumb.png.581907f5321d54c6da456e9f0ac7f80f.png

     
  6. I would also recommend if you plan to use noVNC to set the scaling to "Remote Resizing", click the little arrow on the left, click on the gear icon and select "Remote Resizing" to always fill the desktop to the browser screen:
    image.png.c4f77d3af674e94f2f332baf7cd868ad.png

     
  7. Now I would strongly recommend that you change the root password by opening a terminal in the Desktop environment and typ in:
    su
    ...enter the root password "Unraid" (without double quotes) and then type in:
    passwd
    ...enter the current password "Unraid" (without double quotes) and the new password twice (you will get no display output while typing, this is the default behavior).
    After that you can close the terminal.

     
  8. I would also recommend to change the default user password from your "debian" user by opening a terminal in the Desktop environment again and typ in:
    passwd
    ...enter the current password "debian" (without double quotes) and the new password twice (you will get no display output while typing, this is the default behavior).
    After that you can close the terminal.

 

 

Now what's left for you to do is set the locale, timezone and customize the container how you like... :)

(Please use the command "su" from above to become root so that you don't need sudo in front of the commands)

 

 

Please note that this is not a custom image or something like that, it installs the base LXC Debian Bullseye image from the LXC container repository and installs everything from scratch after that through Debian & GitHub repositories.

  • Like 2
Link to comment
11 minutes ago, Joly0 said:

Hey, was curious if its possible to use an nvidia gpu in the debian vnc container?

Haven't tried this yet, first I would like to get Intel iGPUs to work in the containers.

 

But don't expect this to happen in the next two months because, well, real life is a bi*** sometimes... :D

Link to comment
2 minutes ago, ich777 said:

Haven't tried this yet, first I would like to get Intel iGPUs to work in the containers.

 

But don't expect this to happen in the next two months because, well, real life is a bi*** sometimes... :D

I dont have an Intel iGPU but i guess alot of people would appreciate this feature.

 

I can totally agree on the second part, just take your time 😄

Edited by Joly0
  • Like 1
Link to comment
1 hour ago, juan11perez said:

I've set up per the instructions but when I try to create a container or create vnc container i get

'Something went wrong!'.  nothing further

Which path have you choose for your containers in the LXC settings?

 

I think the plugin can't write to the path that you've specified since this message is displayed when something went wrong while downloading and installing the container.

Link to comment
1 hour ago, juan11perez said:

I've set up /mnt/cache/lxc

Maybe a dumb question, but have you installed a cache drive and on what Unraid version are you?
 

Have you yet tried to install a container from the terminal?

 

You‘ll find how to do that in the LXC tab and after that click on Guide.

Link to comment
10 hours ago, juan11perez said:

Good day. Thank you for this component.

I've set up per the instructions but when I try to create a container or create vnc container i get

'Something went wrong!'.  nothing further

 

the script wants your array as install path, i cant use it on my dedicated ssd cache either. 

Its Unraid after all :D

 

Link to comment
2 hours ago, ich777 said:

Maybe a dumb question, but have you installed a cache drive and on what Unraid version are you?
 

Have you yet tried to install a container from the terminal?

 

You‘ll find how to do that in the LXC tab and after that click on Guide.

 

 

Yes, the cache in /mnt/cache is in my cache pool devices

I run unraid 6.10.2

 

I just tried via terminal and got this:

 

root@Unraid:/mnt/cache# lxc-create --name Debian --template download -- --dist debian --release bullseye --arch amd64
Downloading the image index
Downloading the rootfs
Downloading the metadata
mkdir: cannot create directory ‘//var/cache/lxc’: File exists
lxc-create: Debian: lxccontainer.c: create_run_template: 1627 Failed to create container from template
lxc-create: Debian: tools/lxc_create.c: main: 317 Failed to create container Debian

 

i checked /var/cache/lxc and got this:

 

root@Unraid:/var/cache# ls
cracklib/  ldconfig/  libvirt/  lxc@  samba/

 

 

I removed lxc@ (it said it had an invalid link)

 

Attempted creating again from GUI and now no error

 

And it works. container is running!!

 

Thank you

 

Edited by juan11perez
  • Like 1
Link to comment
51 minutes ago, juan11perez said:

I removed lxc@ (it said it had an invalid link)

This is a really weird issue that you are experiencing... have to go through the plugin code again if there is anything that causes this but I don't think this ever happened yet to another user so far...

Link to comment

First of all, thanks for the work you put in here. LXC is something I've actually been missing a little bit and that's why I'm just happy that it's being built.

 

I am currently having problems with the root user.

 

When changing the password I get "passwd: password updated successfully" but a login via SSH (PermitRootLogin Yes) and "su, su root, su -" from the "debian" or self created user is not possible.

 

Also the login with the default password (VNC Container) does not work.

 

I use the default settings and the container debian bullseye.

 

I deleted LXC plugin to be on the safe side, removed the LXC folder, rebooted and reinstalled it. Unfortunately, no change.

 

The path has not been changed. Read and write permissions are also untouched.

 

Do you know what could be the reason?

Link to comment
16 minutes ago, Kulisch said:

When changing the password I get "passwd: password updated successfully" but a login via SSH (PermitRootLogin Yes) and "su, su root, su -" from the "debian" or self created user is not possible.

I've now tried it from a terminal inside the container:

image.png.a30dd994d031dac8218ac012dc987c77.png

 

This screenshot was taken from the VNC Desktop, opened a terminal, typed in "su", typed in the default password "Unraid", typed in "passwd" changed the password to something different, logged out from the root shell, typed in "su" again and the new password for root.

 

Do you made sure that you restarted sshd with "systemctl restart sshd" and also edit the file /etc/ssh/sshd_config like this:

image.png.da6e0a801994070203cc83800686348e.png

 

After that I'm able to log in from a foreign machine with the root user and the above changed password:

image.png.2b78fb52aa19be3749d461963162c930.png

 

 

16 minutes ago, Kulisch said:

I deleted LXC plugin to be on the safe side, removed the LXC folder, rebooted and reinstalled it. Unfortunately, no change.

This shouldn't be needed, should be enough to destroy the container.

 

 

EDIT: Forgot to say that everything is working too for the default user "debian".

Link to comment
34 minutes ago, ich777 said:

Do you made sure that you restarted sshd with "systemctl restart sshd" and also edit the file /etc/ssh/sshd_config like this:

Thanks for the quick response. Did it before reinstalling LXC and didn't work. Now the login with ssh -l root works (I guess that was my fault). But switching user (su) still doesn't work. 

 

Changed the password to "12345" for root (for testing of course).

 

image.png.d00474afb5a9632e9505c2402d549612.png

 

and now login with debian is possible but changing the mentioned test password shows this error:

 

image.png.37aa5344321f8dd2085de4e2cf37c011.png

 

Do I have to create a user with specific arguments? Did it like you instructed on the first post in this topic.

 

image.png.e345ac8dd25befba94de56c120bb830e.png

Edited by Kulisch
Link to comment
5 minutes ago, Kulisch said:

Now the login with ssh -l root works (I guess that was my fault). But switching user (su) still doesn't work.

From what I see you are using WSL or am I wrong? Do you have any special distribution installed for WSL or is this the default one?

You should be also able to connect to your server with: "ssh [email protected]" and if you've enabled ssh for the root user "ssh [email protected]"

 

Oh sorry I display the wrong password for the user debian it's actually "debian" (without double quotes) and not Unraid, will fix that ASAP.

 

Anyways if you get the token authentication error then the password is wrong, log into your root user and try:

passwd kulisch

with this you don't have to enter the old password.

 

But keep in mind it is not intended for now to change the default user "debian" to another user since this will need a lot more steps than simply creating a new user.

For now this is more a PoC to show the possibilities.

Link to comment
58 minutes ago, juan11perez said:

when possible, can you share your homeassitant script?

Yes, give me some time and I will add it too but this is a little bit more complicated.

 

Please also keep in mind that the automatic installation is more a PoC to show what is actually possible.

Link to comment
46 minutes ago, ich777 said:

From what I see you are using WSL or am I wrong?

For SSH Access I use the software "Windows Terminal". The Session is Powershell. SSH Client ist Installed (Windows 10). That shouldn't matter in this case.

 

image.png.87685ad98c210f2ed9485b3a9bc529ae.png

 

As you see the user was created in the same software.

 

I created the user, set 12345 as password in the webterminal of Unraid, but result is the same. 

 

image.png.7f3fe6d6b99bae3e3ceb9372efd02e6d.png

 

 Just to make this clear, every account has the same password right now. 

 

Works:

SSH Access with every Account (root, qlisch, kulisch, debian)

switching from root to user

changing password as root for every user

 

Don't work:

switching from user to root

switching from user to another user (tested: debian -> qlisch, kulisch -> debian)

changing password as user

 

The mentioned user are created per SSH and per webterminal Unraid.

 

46 minutes ago, ich777 said:

Anyways if you get the token authentication error then the password is wrong, log into your root user and try:

passwd kulisch

with this you don't have to enter the old password.

 

image.png.5c1b66782a80bed84d67265d14b3b27b.png

 

Still wanting current password.

 

Passwords are correctly typed in every time. You can see it because I successfully logged in per SSH with password prompt. (see previous post)

Edited by Kulisch
Link to comment
18 minutes ago, Kulisch said:

I created the user, set 12345 as password in the webterminal of Unraid, but result is the same. 

Something seems wrong or don't know what is different on your system:

grafik.png.307f3fae2ab7e447c2aba6422f9ea1fe.png

 

Please keep in mind I do this all from inside the VNC container.

 

I've now also tried it from a windows terminal (please ignore the authentication failure on the root user for the first time, typed in the wrong password... :D ) :

grafik.png.e9224cf231d1a0cfe3b93e57e665d1cd.png

 

 

 

Also tested this from a non VNC container here (of course I set the root password first) :

grafik.png.da419cc2037a5ced6d9a1bfb96b952bc.png

 

26 minutes ago, Kulisch said:

Still wanting current password.

This is just normal since you are changing it from the user shell and not the root shell, if you change a password from the root shell from a user it doesn't ask for the current password.

 

 

 

Please keep in mind when you trying this on a non VNC container that no passwords are set by default, not even for the root user.

Something must be wrong somehow on your end, I've did the exact same steps as you did with slightly different commands.

 

As you can see from my screenshots everything is working just fine...

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.