Taking long time to launch a container

Hello,

I am running lxd 5.9 on debian 11.0 host machine. While creating a container, it is taking long time to create (seems like stuck).

root@monitor:~# lxc launch images:debian/bullseye test
Creating test

can you help me on this ?

Thanks

Could be a network issue if it’s the first time a particular image is used.

You can check what’s going on with lxc operation list but there’s a good chance you’re stuck in image download.

@stgraber thanks for the fast response

the image is already downloaded on the host

root@monitor:~# lxc image list
+-------+--------------+--------+----------------------------------------+--------------+-----------+---------+-----------------------------+
| ALIAS | FINGERPRINT  | PUBLIC |              DESCRIPTION               | ARCHITECTURE |   TYPE    |  SIZE   |         UPLOAD DATE         |
+-------+--------------+--------+----------------------------------------+--------------+-----------+---------+-----------------------------+
|       | 93d985be253b | no     | Debian bullseye amd64 (20230104_05:25) | x86_64       | CONTAINER | 83.54MB | Jan 5, 2023 at 3:29am (UTC) |
+-------+--------------+--------+----------------------------------------+--------------+-----------+---------+-----------------------------+

it taking about 3-4mins to create and delete a container.
also checking lxc operation list, seems it shows normal

root@monitor:~# lxc operation list
+--------------------------------------+------+-------------------+---------+------------+----------------------+
|                  ID                  | TYPE |    DESCRIPTION    | STATUS  | CANCELABLE |       CREATED        |
+--------------------------------------+------+-------------------+---------+------------+----------------------+
| 2e3e71df-2b7c-4d40-a7c7-e3714b7009bc | TASK | Creating instance | RUNNING | NO         | 2023/01/05 14:07 UTC |
+--------------------------------------+------+-------------------+---------+------------+----------------------+
root@monitor:~# lxc operation list
+--------------------------------------+------+-------------------+---------+------------+----------------------+
|                  ID                  | TYPE |    DESCRIPTION    | STATUS  | CANCELABLE |       CREATED        |
+--------------------------------------+------+-------------------+---------+------------+----------------------+
| 10625d7a-5475-416c-8ba5-6565790d4233 | TASK | Stopping instance | RUNNING | NO         | 2023/01/05 14:12 UTC |
+--------------------------------------+------+-------------------+---------+------------+----------------------+

Is there any method to find and troubleshoot the issue?

Thanks

Hmm, I’d probably look into the usual suspects:

  • dmesg for anything kernel related
  • ps fauxww and top to see what’s using CPU/memory when things are slow

You can also run lxc monitor --pretty in another terminal which will get you LXD debugging logs.
This may give more details as far as what’s taking so long.

Benchmark your system first to see if everything checks out (what filesystem are you using?)

#Sequential write test
sync;fio --randrepeat=1 --ioengine=libaio --direct=1 --name=test --filename=test --bs=4M --size=4G --readwrite=write --ramp_time=4 numjobs=$(nproc)

#Sequential Read test
sync;fio --randrepeat=1 --ioengine=libaio --direct=1 --name=test --filename=test --bs=4M --size=4G --readwrite=read --ramp_time=4 numjobs=$(nproc)

Run an iperf test as well while you’re at it (iperf not iperf3)

iperf -s
iperf -c localhost -P $(nproc)

then use lxd-benchmarking tool