/r/LXC

Photograph via snooOG

LXC stands for Linux containers and is a open source Linux container project in development since 2009. LXC provides lightweight OS containers, tools for container management and a wide choice of container OS templates.

LXC is supported in the vanilla Linux kernel and works out of the box on most Linux distributions.

LXC is developed by Daniel Lezcano, Stéphane Graber(Ubuntu) and Serge Hallyn(Ubuntu) and a team of open source developers.

Join the LXD/LXC user's mailer group to communicate with Devs & others regarding support questions.

LXC stands for Linux containers and is a open source Linux container project in development since 2009. LXC provides lightweight OS containers, tools for container management and a wide choice of container OS templates.

LXC is supported in the vanilla Linux kernel and works out of the box on most Linux distributions.

LXC is developed by Daniel Lezcano, Stéphane Graber (Ubuntu) and Serge Hallyn and a team of open source developers.

/r/LXC

1,737 Subscribers

1

Lxc help with installing images

So I'm running openwrt on x86_64, and have successfully increased my image size to 32gb, and i believe i have installed all options needed to run lxc containers, but I am having difficulty launching them. It feels like it is not downloading the full image, because it completes very quickly when I click create, and when I press start, it stays with a red status.

I am looking to run some variant of Debian, preferably Ubuntu, so i can run a Unifi server on the same hardware as my routing platform. I have tried several different images from the images.linuxcontainers.org list, and fell like I'm missing something. thanks for your help.

0 Comments
2024/03/31
23:03 UTC

0

Flandre

0 Comments
2024/02/09
19:47 UTC

0

MLSFAW

0 Comments
2024/02/05
18:22 UTC

1

Containers Become Unreachable After a Period of Time

I have some Ubuntu 20 LXC containers running on an Ubuntu 22 host. When they are up and running, the LXC containers can be reached from any other host across the network without issue but, after a couple of days or so, the LXC containers become unreachable across the network (Except for the LXCs' host which can still reach into them without any problem). The only way I can get the LXC containers to become reachable from other hosts again is by stopping and starting the LXC containers again.

I don't know enough about networking to be able to figure out what causes their network connectivity to be lost or where to look in any log files to get to the bottom if it all.

Any ideas what may cause this?

My LXC containers are configured like this:

config:
  user.network-config: |
    version: 2
    ethernets:
        eth0:
            dhcp4: false
            addresses:
            - {{ server_ip }}/32
            nameservers:
                addresses:
                - 8.8.8.8
                search: []
            routes:
            -   to: 0.0.0.0/0
                via: 169.254.0.1
                on-link: true
description: Server Routed Profile
devices:
  eth0:
    ipv4.address: {{ server_ip }}
    nictype: routed
    parent: wlo1
    type: nic
  root:
    path: /
    pool: dataPool
    type: disk
name: dataProfile

4 Comments
2023/12/04
10:11 UTC

1

LXC container can't get manual IP

Hi there,

I'm trying to set a manual IP but nothing work.

In /var/lib/lxc/debian_ansible/config :

lxc.net.0.ipv4.address = 10.0.3.100/24
lxc.net.0.ipv4.gateway = auto

Even try with dnsmasq.conf:

dhcp-host=debian_ansible,10.0.3.100

Even after restarting lxc-net service, restarting container, or rebooting, the containers didn't want to take the 10.0.3.100 IP

sudo lxc-info --version
5.0.2

I'll be very glad if someone can help me

Thanks by advance

1 Comment
2023/11/26
18:15 UTC

0

Rpi4 + Pimox + LXC + OpenMediaVault

I installed Proxmox on my Raspberry Pi 4 and created an LXC Debian container with an OpenMediaVault instance. Now everything is working, but how can I connect my physical hard drive by USB 3.0 to OMV? I want to mount the device and not only a mount point.

> ls -al /dev/sd*

brw-rw---- 1 root disk 8, 0 Nov  3 02:03 /dev/sda
brw-rw---- 1 root disk 8, 1 Nov  3 02:03 /dev/sda1

> lsblk -l

NAME      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda         8:0    0 931.5G  0 disk 
sda1        8:1    0 931.5G  0 part /mnt/myharddisk

> ls -al /dev/disk/by-uuid/ | grep sda*
lrwxrwxrwx 1 root root  10 Nov  3 02:03 5b1a451e-c349-4e91-b125-38ee04fb73d1 -> ../../sda1

LXC Container Configuration

> cat /etc/pve/lxc/103.conf 

arch: arm64
cores: 2
hostname: omvnas
memory: 1024
net0: name=eth0,bridge=vmbr0,firewall=1,gw=192.168.1.1,hwaddr=8A:FE:12:38:67:58,ip=192.168.1.102/24,type=veth
ostype: debian
rootfs: local:103/vm-103-disk-0.raw,size=8G
swap: 128
lxc.mount.auto: cgroup:rw
lxc.mount.auto: proc:rw
lxc.mount.auto: sys:rw
lxc.cgroup.devices.allow: b 8:0 rwm
lxc.cgroup.devices.allow: b 8:1 rwm
lxc.autodev: 1
lxc.hook.autodev: /var/lib/lxc/103/mount-hook.sh
lxc.mount.entry: /mnt/myharddrive media/myharddrive none bind,create=dir,optional 0 0

> cat /var/lib/lxc/103/mount-hook.sh
#!/bin/sh
mknod -m 777 ${LXC_ROOTFS_MOUNT}/dev/sda b 8 0
mknod -m 777 ${LXC_ROOTFS_MOUNT}/dev/sda1 b 8 1

Result

pct start 103 --debug

but obtain in to shell

ERROR utils - ../src/lxc/utils.c:safe_mount:1221 - No such file or directory - Failed to mount "/mnt/myharddrive" onto "/usr/lib/aarch64-linux-gnu/lxc/rootfs/media/myharddrive"

Instead into OMV -> Storage -> Disks obtain this message : https://ibb.co/C5MwKts

Anyone have experience mounting a physical hard drive in an LXC container?

4 Comments
2023/11/03
02:55 UTC

2

Wiki and Github for "linux-router" which can be used for both Containers and VMs.

I ran across Github - linux-router.

The Wiki says:

Set Linux as router in one command. Able to provide Internet, or create a WiFi hotspot.Supports transparent proxy (redsocks). Also useful for routing VM/Containers.

It wraps iptables*,* dnsmasq etc. stuff. Use in one command, Restore in one command or by control-c (or even by closing terminal window).

If you read thru the USAGE section - n**otice both LXC and LXD configuration commands are provided!

linux-container config for LXC

https://preview.redd.it/4yy4rwy520rb1.png?width=1053&format=png&auto=webp&s=b099ca55b4f4b34a82d4d00c94f8ce8f74784f32

Use as a transparent proxy for LXD but without using Profile

https://preview.redd.it/x8hzped820rb1.png?width=1060&format=png&auto=webp&s=6c61bd93175fe1574793bcdb5e6b37a4795f8583

0 Comments
2023/09/28
13:40 UTC

2

Frigate on a Proxmox LXC

0 Comments
2023/08/22
11:46 UTC

2

StableDiffusion-XL Bot for Discord using Linux Containers (LXC) and an Nvida GPU (Cuda).

0 Comments
2023/08/16
12:23 UTC

2

lxc-router might be useful with LXC Containers

Thought this might be useful to a some LXC users.

Gary Will developed a bash script named linux-router (one of his github repositories)

See how lxc-router might be used with LXC Containers here:
Using linux-router Bash script, implement a transparent proxy for LXC (github by gary will)

Gary also created detailed linux-router documentation which is very useful to read for a Linux user because of other non-LXC use-cases for linux-router!

0 Comments
2023/07/28
17:27 UTC

1

Pointing lxc to new storage pool location

I had to replace a drive in computer, and now the drive names have changed. Lxc thinks its storage is still at /dev/nmve3 whereas it's now at /dev/nvme2.

Is there a way to point my container to the right place without erasing the contents my old drive?

Thanks!

3 Comments
2023/07/28
12:53 UTC

1

LXC images download

0 Comments
2023/07/04
20:11 UTC

1

lxc: ssh login

Hi,
I receiving this error message:
WARNING: UNPROTECTED PRIVATE KEY FILE!
Permissions 0640 for '/home/..../.ssh/id_rsa.pub' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/home/..../.ssh/id_rsa.pub": bad permissions
ubuntu@gui: Permission denied (publickey).

Do you know how I can fix this issue ?

Thanks in advance!

4 Comments
2023/06/05
15:00 UTC

1

Anyone had luck with Bareos on a LXC?

Pretty much the title,really like Bareos and I would love to find a way to make it work on a LXC

1 Comment
2023/03/13
19:35 UTC

2

Automounted directory as subdir of shared disk not visible/usuable

I have a container with a shared folder:

devices:
  data:
    path: /fs
    source: /srv/data
    type: disk

In the shared directory /srv/data, there is a subdirectory /srv/data/confidential, which is an automounted, LUKS-encrypted volume.

At least on the host, not in the container. As I see, the LXC container mounts the data share as /dev/mapper/vg0-data, not as its directory path /srv/data. This effectively hides the crypted volume in the container.

I experimented with separate shares and bind mounts, but they all do not play with systemd automount.

ChatGPT suggests setting the lxc.mount.auto option to None, does that make sense?

0 Comments
2023/01/25
13:14 UTC

0

Is there a wikipedia LXC container out there ?

Would also love a chatbot and home assistance with internal voice recognition fully self-contained, maybe something built fully on ssh ?

0 Comments
2023/01/08
03:08 UTC

1

replacing my two redmine/wireguard turnkey servers with a single computing unit

I have previously installed and used these two "turnkey" ISOs on various computer systems:

This time I'd like to integrate both of them to run on a single computer. So I got this:

https://www.turnkeylinux.org/lxc

It's already running on another computer, but I'm not sure how to get those two TurnKey packages onto it. Can someone guide me through it?

2 Comments
2023/01/07
22:21 UTC

1

Are the distros running in Crostini containers(so less latency) or are them virtualized(more latency)?

0 Comments
2022/11/23
10:29 UTC

1

Can not passthrough USB device to an unprivileged LXC container

Hi every body.

I want to pass my kindle to a container where I'm running the Calibre. This container is unprivileged and its config looks like this:

# Distribution configuration
lxc.include = /usr/share/lxc/config/common.conf
lxc.include = /usr/share/lxc/config/userns.conf
lxc.arch = x86_64

# Container specific configuration
lxc.idmap = u 0 100000 1000
lxc.idmap = u 1000 1000 1
lxc.idmap = u 1001 101001 64535
lxc.idmap = g 0 100000 1000
lxc.idmap = g 1000 1000 1
lxc.idmap = g 1001 101001 64535
lxc.rootfs.path = dir:/var/lib/lxc/apps/rootfs
lxc.uts.name = apps

# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:36:37:1a

# Mount host directories
lxc.mount.entry = /home/user/Documents/Zotero /var/lib/lxc/apps/rootfs/home/user/Docu
ments/Zotero none bind 0 0

So In order to pass the USB (Kindle) I added the following lines to the config based on the results of the lsub command

lxc.cgroup.devices.allow = c 189:* rwm
lxc.mount.entry = /dev/bus/usb/003 dev/bus/usb/003 none bind,optional,create=dir

After starting the container and ssh to it the lsusb command returned

Bus 003 Device 026: ID 1949:0004 Lab126, Inc. Amazon Kindle 3/4/Paperwhite

and the ls -la /dev/bus/usb command returned

drwxr-xr-x  2 nobody nobody      200 Nov 11 20:10 .
drwxr-xr-x  3 root   root         60 Nov 11 20:10 ..
crw-rw-r--  1 nobody nobody 189, 256 Nov 11 20:10 001
crw-rw-r--  1 nobody nobody 189, 257 Nov 11 20:10 002
crw-rw-r--  1 nobody nobody 189, 258 Nov 11 20:10 003
crw-rw-r--+ 1 nobody nobody 189, 259 Nov 11 20:10 004
crw-rw-r--  1 nobody nobody 189, 260 Nov 11 20:10 005
crw-rw-r--  1 nobody nobody 189, 277 Nov 11 20:10 022
crw-rw-rw-  1 nobody nobody 189, 278 Nov 11 20:10 023
crw-rw-r--  1 nobody nobody 189, 279 Nov 11 20:10 024

Of course calibre cannot detect the device,

Then I tried to add a udev rule to the host machine under /etc/udev/rules.d/80-kindle-usb-passthrough.rules which is the following:

 SUBSYSTEM=="usb", ATTR{idProduct}=="0004", ATTR{idVendor}=="1949", MODE:="0666", OWNER="root"

finally I ran

 sudo udevadm control --reload
 sudo udevadm trigger

restarted the container and unplugged/plugged the Kindle but Calibre still couldn't detect the device and also I'm getting nobody nobody under the /dev/bus/usb

Finally I changed the udev rule to that:

SUBSYSTEM=="usb", ATTR{idProduct}=="0004", ATTR{idVendor}=="1949", MODE:="0777", OWNER="100000", GROUP="100000"

and then within the container the ls -la /dev/bus/usb command returned

drwxr-xr-x  2 nobody nobody      200 Nov 12 16:45 .
drwxr-xr-x  3 root   root         60 Nov 12 16:46 ..
crw-rw-r--  1 nobody nobody 189, 256 Nov 12 16:45 001
crw-rw-r--  1 nobody nobody 189, 257 Nov 12 16:45 002
crw-rw-r--  1 nobody nobody 189, 258 Nov 12 16:45 003
crw-rw-r--+ 1 nobody nobody 189, 259 Nov 12 16:45 004
crw-rw-r--  1 nobody nobody 189, 260 Nov 12 16:45 005
crw-rw-r--  1 nobody nobody 189, 261 Nov 12 16:45 006
crw-rw-r--  1 nobody nobody 189, 263 Nov 12 16:45 008
crwxrwxrwx  1 root   root   189, 268 Nov 12 16:45 013 <-- This is the Kindle

BUT the calibre still cannot access it. I, then used calibre's debug feature for devices and got this error stack.

Any ideas are welcome

0 Comments
2022/11/12
16:58 UTC

Back To Top