0

I'm totally new in these enviroments but I'm trying to learn. I installed proxmox on a single SSD, then attached one HDD(/dev/sdb) to the system for media storage. The basic idea was to create one container for Plex app and one for rtorrent app. I would like to share the same space(disk) between these containers.

On the host I mounted /dev/sdb1 to /mnt/mediastorage, and created a user called "mediastorage"(110:117) and add access to this space. Both of the containers I added this(/mnt/mediastorage) to /mediastorage mount point.Like this:

mp0: /mnt/mediastorage/,mp=/mediastorage

After that,I tried to grant access for these files for plex(107:115) user in the "plex" container:

lxc.idmap: u 0 100000 107
lxc.idmap: u 107 110 1
lxc.idmap: u 108 100125 64410
lxc.idmap: g 0 100000 115
lxc.idmap: g 115 117 1
lxc.idmap: g 116 100136 64399

On the host I did this:

root@proxmox:~# cat /etc/subuid
root:100000:65536
root:110:1
root@proxmox:~# cat /etc/subgid
root:100000:65536
root:117:1

Later, I created the other container, where created a user called rtorrent(107:115) and did the same config like the "plex" container.

There was a moment where everything seemd fine but after a reboot(host) incomprehensive things happened like this: Previous thread where it started

Noticed that at the "plex" container, appeared a new entry in the /etc/passwd file:

mediastorage:x:108:116:...etc

/etc/group:

mediastorage:x:116:

-these were not there earlier and the container was in shutdown state.

root@plex:/# ls -al /home
total 12
drwxr-xr-x  3 root   root    4096 Jan 23 20:57 .
drwxr-xr-x 23 root   root    4096 Jan 24 22:42 ..
drwxr-xr-x  2 nobody nogroup 4096 Jan 23 20:57 mediastorage

Can somebody explain it what happened here please? How can I achieve my main idea?(share storage between the containers) Is it possible in this way?

EDIT1: Reinstalled the container, first mounted the /mediastorage than installed plex than add uid mapping to the container's config.(Somewhere I read that maxbe it will work).Now the storage works but the plex service can't start because of permission issues. From the host -- lxc container's disk mounted as /mnt/lxc102:

/mnt/lxc102/etc/passwd:
plex:x:107:115::/var/lib/plexmediaserver:/bin/bash
/mnt/lxc102/etc/group:
plex:x:115:
ls -al /mnt/lxc102:
drwxr-xr-x  2 100000 100000  4096 Jan 25 23:22 mediastorage
ls -al /mnt/lxc102/var/lib:
drwxr-xr-x  3 100107 100115 4096 Jan 25 23:25 plexmediaserver

On the container, the plexmediaserver directory listed as nobody:nogroup again.

6
  • Your settings are too complex for me. But for all these files, you should list them from the host, using ls -n rather than from the container: you will then get the real host uid, rather than always get the "overflow uid/gid" 65534:65534. Then you might do some (difficult) calculations to get an idea. Obviously the hosts uids don't map (anymore?) into the container uids.
    – A.B
    Commented Jan 25, 2020 at 12:17
  • Somewhere I read, that I should mount the partition first then create the user.Now the /mediastorage looks like this: drwxr-xr-x 2 100000 100000 4096 Jan 25 23:22 mediastorage (and mounted as plex user so it has acces for it) but one of the "plex" users library: drwxr-xr-x 3 100107 100115 4096 Jan 25 23:25 plexmediaserver from the host.
    – toma3757
    Commented Jan 26, 2020 at 10:31
  • Those 100107:100115 should probably be 110:117 . Are you sure the mappings are actually set as you intend on the running containers? from the host find a process running in a container (run a sleep command from it if it's too difficult) and check with cat /proc/PID/uid_map etc . You must understand how the mappings work so you can do many tests and experiments. There's no way to solve it here on UL because there are too many unknowns
    – A.B
    Commented Jan 26, 2020 at 12:21
  • Sorry for the late answer. Output of the sleep: (cat /proc/9990/uid_map) 0 100000 107 ... 107 110 1 ... 108 100108 64530 ... So this is totally wrong if i understand well.
    – toma3757
    Commented Jan 28, 2020 at 19:42
  • 1
    The container looks ok. That means something else (an other container?) had wrong settings, or there's a bug. Of course if there's a bug there's nothing much to do, except try to pin point it.
    – A.B
    Commented Jan 28, 2020 at 21:41

1 Answer 1

0

I ran into the same problem and I solved it by adding unprivileged: 0 in the /etc/pve/lxc/???.conf file (where ??? is the ID of your lxc container).

2
  • This fixed the issue for me! Thanks! Commented Oct 24, 2021 at 4:00
  • 1
    While i understand that this works, it's a huge security issue... your container runs as root..
    – Peter
    Commented Aug 25, 2022 at 18:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .