Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
LXD/LXC doesn't want to work, ID mapping
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
philmb
n00b
n00b


Joined: 13 Feb 2020
Posts: 10

PostPosted: Sat Sep 07, 2024 2:09 pm    Post subject: LXD/LXC doesn't want to work, ID mapping Reply with quote

I installed LXD using the guide https://wiki.gentoo.org/wiki/LXD
When I want to launch a container, it does not work.

Quote:
phil@localhost ~ $ sudo lxc list
+--------+---------+------+------+-----------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+--------+---------+------+------+-----------+-----------+
| devuan | STOPPED | | | CONTAINER | 0 |
+--------+---------+------+------+-----------+-----------+
phil@localhost ~ $ sudo lxc start devuan
Error: Failed to run: /usr/bin/lxd forkstart devuan /var/lib/lxd/containers /var/log/lxd/devuan/lxc.conf: exit status 1
Try `lxc info --show-log devuan` for more info
phil@localhost ~ $ lxc info --show-log devuan
Name: devuan
Status: STOPPED
Type: container
Architecture: x86_64
Created: 2024/09/07 21:02 +07
Last Used: 2024/09/07 21:07 +07

Log:

lxc devuan 20240907140716.948 ERROR idmap_utils - ../lxc-6.0.0/src/lxc/idmap_utils.c:lxc_map_ids:245 - newuidmap failed to write mapping "newuidmap: uid range [0-1000000000) -> [1000000-1001000000) not allowed": newuidmap 11903 0 1000000 1000000000
lxc devuan 20240907140716.948 ERROR start - ../lxc-6.0.0/src/lxc/start.c:lxc_spawn:1795 - Failed to set up id mapping.
lxc devuan 20240907140716.948 ERROR lxccontainer - ../lxc-6.0.0/src/lxc/lxccontainer.c:wait_on_daemonized_start:838 - Received container state "ABORTING" instead of "RUNNING"
lxc devuan 20240907140716.949 ERROR start - ../lxc-6.0.0/src/lxc/start.c:__lxc_start:2114 - Failed to spawn container "devuan"
lxc devuan 20240907140716.949 WARN start - ../lxc-6.0.0/src/lxc/start.c:lxc_abort:1038 - No such process - Failed to send SIGKILL via pidfd 17 for process 11903
lxc 20240907140717.123 ERROR af_unix - ../lxc-6.0.0/src/lxc/af_unix.c:lxc_abstract_unix_recv_fds_iov:218 - Connection reset by peer - Failed to receive response
lxc 20240907140717.123 ERROR commands - ../lxc-6.0.0/src/lxc/commands.c:lxc_cmd_rsp_recv_fds:128 - Failed to receive file descriptors for command "get_init_pid"

phil@localhost ~ $


I did some reading on Google about the id mapping stuff, but I don't understand anything, what is a newuidmap?. It might as well be ancient greek.
What do I need to do to run a container on Gentoo?
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3909

PostPosted: Sun Sep 08, 2024 2:48 pm    Post subject: Reply with quote

Can you plz post
Code:

cat /etc/sub{uid,gid}
cat /etc/lxc/default.conf

Also before getting too engaged with lxd you might wish to consider incus instead.
Plz see
https://discuss.linuxcontainers.org/t/lxd-has-been-re-licensed-and-is-now-under-a-cla/18454/3
_________________
:)
Back to top
View user's profile Send private message
philmb
n00b
n00b


Joined: 13 Feb 2020
Posts: 10

PostPosted: Wed Sep 11, 2024 8:36 pm    Post subject: Reply with quote

alamahant wrote:
Can you plz post
Code:

cat /etc/sub{uid,gid}
cat /etc/lxc/default.conf

Also before getting too engaged with lxd you might wish to consider incus instead.
Plz see
https://discuss.linuxcontainers.org/t/lxd-has-been-re-licensed-and-is-now-under-a-cla/18454/3


Greetings. Here is the data

Code:
 $ cat /etc/sub{uid,gid}
phil:100000:65536
lxd:100000:65536
phil:100000:65536
lxd:100000:65536
 $ cat /etc/lxc/default.conf
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:xx:xx:xx
lxc.idmap = u 0 100000 65536
lxc.idmap = g 0 100000 65536
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3909

PostPosted: Thu Sep 12, 2024 8:18 am    Post subject: Reply with quote

This is how they should look
Code:

cat /etc/sub{uid,gid} ===>>>

lxd:1000000:1000000000
root:1000000:1000000000
<your-user>:1001000000:1000000

lxd:1000000:1000000000
root:1000000:1000000000
<your-user>:1001000000:1000000


Also in /etc/lxc/default.conf plz remove
Code:

lxc.idmap = u 0 100000 65536
lxc.idmap = g 0 100000 65536

Plz see
https://wiki.gentoo.org/wiki/Subuid_subgid
Also plz see
Quote:

Authorize a non-privileged user
All members of the lxd group can use any of the available containers, irrespective of who created the container.

root #usermod --append --groups lxd larry
This will allow a non-root user to interact with the control socket which is owned by the lxd UNIX group.
For the group change to take effect, users need to log out and log back in again.

_________________
:)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum