[systemd-devel] systemd-nspawn image
Lennart Poettering
lennart at poettering.net
Wed Apr 12 09:05:27 UTC 2017
On Tue, 11.04.17 17:22, poma (pomidorabelisima at gmail.com) wrote:
> Hello
>
> The title doesn't quite work;
>
> # qemu-img --version
> qemu-img version 2.6.2 (qemu-2.6.2-7.fc24), Copyright (c) 2004-2008 Fabrice Bellard
>
> # qemu-img convert fedora25.qcow2 fedora25.raw
>
> # file fedora25.*
> fedora25.qcow2: QEMU QCOW Image (v3), 21474836480 bytes
> fedora25.raw: DOS/MBR boot sector
>
> # fdisk -l fedora25.raw
> Disk fedora25.raw: 20 GiB, 21474836480 bytes, 41943040 sectors
> Units: sectors of 1 * 512 = 512 bytes
> Sector size (logical/physical): 512 bytes / 512 bytes
> I/O size (minimum/optimal): 512 bytes / 512 bytes
> Disklabel type: dos
> Disk identifier: 0x13bd2a55
>
> Device Boot Start End Sectors Size Id Type
> fedora25.raw1 * 2048 2099199 2097152 1G 83 Linux
> fedora25.raw2 2099200 6293503 4194304 2G 82 Linux swap / Solaris
> fedora25.raw3 6293504 41943039 35649536 17G 83 Linux
>
> # systemd-nspawn --version
> systemd 229
> +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN
>
> # systemd-nspawn --machine Fedora25 --image fedora25.raw
> Spawning container Fedora25 on /indian/cocos/fedora25.raw.
> Press ^] three times within 1s to kill container.
> Timezone Indian/Cocos does not exist in container, not updating container timezone.
> execv() failed: No such file or directory
> Container Fedora25 failed with error code 1.
>
> What could be a brake?
I am not sure what kind of image that is, but have you checked it
contains a proper /bin/sh and everything? Try "strace -o log -f
-s500 systemd-nspawn ..." to see the binaries it ries to execv() and
can't find...
If you invoke npsawn with those parameters it will execute a shell in
the container, but that shell must be installed as /bin/sh in its
image. And that doesn't appear to be the case for you...
Note that nspawn doesn't really support MBR parition tables with
multiple bootable Linux partitions anyway, because we don't know which
one would be the root partition of that. This is explicitly documented
btw, in the "--image=" bit of the man page.
My educated guess is that partition 1 of your image is a boot
partition, and it is marked with the MBR bootable flag. nspawn uses
that as root partition, but can't find /bin/sh hence.
Use an image with GPT partition table, or an image containing a single
MBR partition marked "bootable" of type 83, or even an image
containing not partition at all and just a file system.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list