Can someone point me to a how-to on how to use LXC and Virtual Machine Manager? I’m new to LXC so I kind of don’t know exactly how it works. In the GUI, I chose “operating system container”, then the next screen is OS root directory, which I entered “/” and it booted. When I installed the app I wanted to install (plex) it installed on the host machine.
Is there a reason you want to use lxc over virtual machines?
My opinion is if you want to learn more about them than build and set it up from command line. I have messed with lxc a bit and someone else on this form has some more extensive work from them. @Vitalius seems to know some more than me.
There is a thread where a few of us discussed lxc and some links to helpful tutorials if I remember correctly.
Not turning you away from it just want some further insight so I can help you more.
It asked you for the root of the container. Of course the root of your host is /, why would VMM even have to ask that? So you actually did install plex into the container, but you were really just using your host as container.
You first have to create a directory that will act as the container’s root and put all of the container’s files into it. Then run VMM and point it to that directory. I’m pretty sure VMM tells you this on container creation.
I suggest learning about containers, how they operate and the file system hierarchy of Linux. There are many good talks/presentations on YouTube.
I don’t know what GUI or whatever you are using. But to give you the quick rundown: Containers have a root directory on your hosts file system. Remember your hosts file system always starts with “/”. When running a container (LXC, Jails, Zones) LXC in your case, a directory must be created on the host (such as “/containers/lxc/ubuntu”) to house the file system the container needs. What you have done is made the containers root directory the same as your hosts.
EDIT: Reply mistake sorry.
May as well reply now
Containers do not carry the overhead of full hardware level virtualisation. Containers have the native performance and at least in the case of Zones not LXC might actually be be more secure lol. Also to be more clear the container appears almost like a full linux instance however it is not a VM. Inside of the container it would also be like running on the host of course with some restrictions for security.
Yeah, I haven’t used virtual machine manager, but the advantages of LXCs are they’re faster and vastly more resource efficient than VMs.
For example, look at my pihole LXC. It’s using only 235MB RAM and 194MB of disk space, and yet it behaves like a real separate host. It has its own IP, you can SSH into it, you can apt install whatever you want, and it has complete resource separation from the host. I can take a snapshot in 2 seconds, SSH in, rm -rf /, then restore the snapshot and it’s right back where it was. LXCs are awesome.
I like LXC more than docker for home lab stuff because they work like VMs, you aren’t reliant on some maintainer to update the container on docker-hub. It’s also much, much easier to get LXCs to DHCP IPs via MACVLAN so they show up on your LAN. Possible on docker also but kind of a pain in the ass.
Of course the downside is you need to update the containers yourself, but I just setup automatic updates and it’s all good.
I’ll be honest I’m not a big fan of LXC on its own with just Virt-manager. It is very painful and a bit limited.
As others have said you need to specify a folder where the root file system you want for the container to be is per container to then run of. Cause you just did / you told the container to use the rootfs of the host instead.
You could just do from the terminal/SSH:
cd /
mkdir rootfs
To make a folder in the the root of the host called rootfs to then point your container at but you still need to popular that folder with the necessary files for it to be a viable root file system and that can vary depending on what distro you want to run a container of as to the right process.
Honestly I would recommend looking at LXD on Ubuntu. It is built on top of LXC but fixes a lot and is a much more straightforward experience to get a container to just work. Plus Ubuntu s documentation is quite good to get you up and running quickly when you are just starting out. You can just pull a complete base image down and let it handle setting up root file systems and so on.
LXD works on Opensuse as well. I tried it out and set up a couple of containers and it was easy and worked well.
Opensuse LXD installation info are here: