Cannot start container made from image created from lxd-p2c

Okay, can you show ls -lh /mnt/lib/systemd/systemd as well as file /mnt/lib/systemd/systemd and ldd /mnt/lib/systemd/systemd?

@stgraber ok, here it is:

root@hcpplcc1:/# ls -lh /mnt/rootfs/lib/systemd/systemd
-rwxr-xr-x 1 1000000 1000000 1.6M Aug 26 10:20 /mnt/rootfs/lib/systemd/systemd

root@hcpplcc1:/# file /mnt/rootfs/lib/systemd/systemd
/mnt/rootfs/lib/systemd/systemd: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=230acb059171dc7c19b9318d5ef5feb2c6f4e568, stripped

root@hcpplcc1:/# ldd /mnt/rootfs/lib/systemd/systemd
        linux-vdso.so.1 (0x00007ffe6c7d3000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6976b30000)
        libsystemd-shared-237.so => not found
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f6976b25000)
        libseccomp.so.2 => /lib/x86_64-linux-gnu/libseccomp.so.2 (0x00007f6976b03000)
        libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f6976ad8000)
        libmount.so.1 => /lib/x86_64-linux-gnu/libmount.so.1 (0x00007f6976a78000)
        libblkid.so.1 => /lib/x86_64-linux-gnu/libblkid.so.1 (0x00007f6976a1f000)
        libpam.so.0 => /lib/x86_64-linux-gnu/libpam.so.0 (0x00007f6976a0d000)
        libaudit.so.1 => /lib/x86_64-linux-gnu/libaudit.so.1 (0x00007f69769e1000)
        libkmod.so.2 => /lib/x86_64-linux-gnu/libkmod.so.2 (0x00007f69769c6000)
        libapparmor.so.1 => /lib/x86_64-linux-gnu/libapparmor.so.1 (0x00007f69769b1000)
        libacl.so.1 => /lib/x86_64-linux-gnu/libacl.so.1 (0x00007f69769a6000)
        libcryptsetup.so.12 => /lib/x86_64-linux-gnu/libcryptsetup.so.12 (0x00007f6976934000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f69770bc000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6976911000)
        libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f6976881000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f697687b000)
        libcap-ng.so.0 => /lib/x86_64-linux-gnu/libcap-ng.so.0 (0x00007f6976873000)
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f6976848000)
        libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f6976572000)
        libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f6976569000)
        libdevmapper.so.1.02.1 => /lib/x86_64-linux-gnu/libdevmapper.so.1.02.1 (0x00007f69764fe000)
        libargon2.so.1 => /lib/x86_64-linux-gnu/libargon2.so.1 (0x00007f69764f4000)
        libjson-c.so.4 => /lib/x86_64-linux-gnu/libjson-c.so.4 (0x00007f69764e2000)
        libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f69764b3000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6976364000)

Ok, that all looks plausibly correct :slight_smile:

Can you try:

  • chroot /mnt/rootfs /sbin/init

Here is the result:

root@hcpplcc1:~# chroot /mnt/rootfs /sbin/init
/sbin/init: error while loading shared libraries: libip4tc.so.0: cannot open shared object file: No such file or directory

ok, so that’s the problem, you’re missing a library that systemd needs apparently.

How is that possible? systemd is running fine on the system that was cloned.

The system that was cloned uses LVM2 and individual filesystems for /, /var, /opt, /home, /usr, and more. Is it doing something in the clone that would prevent it from traversing the whole tree correctly?

What is the next step given systemd works on the cloned system?

Does /var, /usr, … look empty in that container (/mnt/…)?

/var, /tmp are empty. /usr, /sbin, /etc are full.

That’s odd… Anyway to answer your original question, when dealing with multiple mounts, they should all be passed to lxd-p2c.

Usage:
  lxd-p2c <target URL> <container name> <filesystem root> [<filesystem mounts>...] [flags]

So this expects a call like lxd-p2c URL NAME / /var /opt /home /usr so the rsync transfer will include those mountpoints too.

I will try to recreate the image and see if that helps. Thanks