canonical / lxd

Powerful system container and virtual machine manager
https://canonical.com/lxd
GNU Affero General Public License v3.0
4.38k stars 931 forks source link

Fail to launch any container #10503

Closed muzammil-iftikhar closed 2 years ago

muzammil-iftikhar commented 2 years ago

Issue description

I am unable to launch/start any container with a same error every time.

Error: Failed to run: /usr/bin/lxd forkstart selected-panda /var/lib/lxd/containers /var/log/lxd/selected-panda/lxc.conf:
Try `lxc info --show-log local:selected-panda` for more info

Required information

# Steps to reproduce

` lxc launch ubuntu:20.04`
`lxc start selected-panda`

# Information to attach

lxc info --show-log selected-panda

Name: selected-panda Status: STOPPED Type: container Architecture: x86_64 Created: 2022/06/03 03:48 PKT Last Used: 2022/06/03 04:01 PKT

Log:

lxc selected-panda 20220602230156.839 ERROR conf - conf.c:lxc_map_ids:3668 - newuidmap failed to write mapping "": newuidmap 70171 0 1000000 1000000000 lxc selected-panda 20220602230156.839 ERROR start - start.c:lxc_spawn:1791 - Failed to set up id mapping. lxc selected-panda 20220602230156.839 ERROR lxccontainer - lxccontainer.c:wait_on_daemonized_start:877 - Received container state "ABORTING" instead of "RUNNING" lxc selected-panda 20220602230156.840 ERROR start - start.c:__lxc_start:2074 - Failed to spawn container "selected-panda" lxc selected-panda 20220602230156.841 WARN start - start.c:lxc_abort:1039 - No such process - Failed to send SIGKILL via pidfd 17 for process 70171 lxc 20220602230201.871 ERROR af_unix - af_unix.c:lxc_abstract_unix_recv_fds_iov:218 - Connection reset by peer - Failed to receive response lxc 20220602230201.871 ERROR commands - commands.c:lxc_cmd_rsp_recv_fds:127 - Failed to receive file descriptors for command "get_state"

cat /var/log/lxd/lxd.log

time="2022-06-03T03:00:30+05:00" level=warning msg=" - Couldn't find the CGroup hugetlb controller, hugepage limits will be ignored" time="2022-06-03T03:00:30+05:00" level=warning msg=" - Couldn't find the CGroup network priority controller, network priority will be ignored" time="2022-06-03T03:00:30+05:00" level=warning msg="Instance type not operational" driver=qemu err="QEMU command not available for CPU architecture" type=virtual-machine time="2022-06-03T03:25:24+05:00" level=error msg="Failed starting container" action=start created="2022-06-02 22:25:14.836441533 +0000 UTC" ephemeral=false instance=meet-fowl instanceType=container project=default stateful=false used="1970-01-01 00:00:00 +0000 UTC" time="2022-06-03T03:33:52+05:00" level=error msg="Failed starting container" action=start created="2022-06-02 22:25:14.836441533 +0000 UTC" ephemeral=false instance=meet-fowl instanceType=container project=default stateful=false used="2022-06-02 22:25:19.420341917 +0000 UTC" time="2022-06-03T03:36:05+05:00" level=error msg="Failed starting container" action=start created="2022-06-02 22:25:14.836441533 +0000 UTC" ephemeral=false instance=meet-fowl instanceType=container project=default stateful=false used="2022-06-02 22:33:47.113256035 +0000 UTC" time="2022-06-03T03:48:11+05:00" level=error msg="Failed starting container" action=start created="2022-06-02 22:48:01.346918967 +0000 UTC" ephemeral=false instance=selected-panda instanceType=container project=default stateful=false used="1970-01-01 00:00:00 +0000 UTC" time="2022-06-03T04:02:01+05:00" level=error msg="Failed starting container" action=start created="2022-06-02 22:48:01.346918967 +0000 UTC" ephemeral=false instance=selected-panda instanceType=container project=default stateful=false used="2022-06-02 22:48:06.321352824 +0000 UTC"

stgraber commented 2 years ago

lxc selected-panda 20220602230156.839 ERROR conf - conf.c:lxc_map_ids:3668 - newuidmap failed to write mapping "": newuidmap 70171 0 1000000 1000000000

This suggests you're using a native package (not the snap) and that your system has misconfigured /etc/subuid or /etc/subgid files (those aren't processed when using the snap).

Make sure that both /etc/subuid and /etc/subgid have a single map for the root user, that the map is the same in uid and gid and that it is made of at least 65536 uids and gids. Then restart the LXD daemon (it reads the files at startup) and things should work better.

muzammil-iftikhar commented 2 years ago

thanks @stgraber. For anyone stumbling upon this thread in future with similar issue, please follow this thread on how to exactly achieve what's suggested by stgraber. https://wiki.archlinux.org/title/Linux_Containers#Enable_support_to_run_unprivilegedcontainers(optional)