[systemd-devel] nspawn and Qemu compatibility?

Andrei Borzenkov arvidjaar at gmail.com
Fri Apr 3 21:41:44 PDT 2015


В Fri, 3 Apr 2015 14:14:18 -0700
Alison Chaiken <alison at she-devel.com> пишет:

> I've been using Qemu to cross-compile packages and root filesystems
> for a while and thought I'd try nspawn instead.    While I sometimes
> want a full GUI desktop in the walled-off environment, mostly console
> is enough, and for that nspawn sounds more efficient.
> 
> Here's the base sequence:
> 
> Install
> ==========
> qemu-img create -f raw /opt/debian.raw 50G
> qemu-system-x86_64  -machine accel=kvm --enable-kvm --cdrom
> /opt/debian.iso -boot d -hda /opt/debian.raw -m 4096 -net
> nic,model=e1000  -net user,hostfwd=tcp:127.0.0.1:6666-:22 -name debian
> -localtime -no-reboot
> 
> Boot as Qemu
> ===============
> qemu-system-x86_64 -enable-kvm -boot c -hda /opt/debian.raw -m 4096
> -usb -net nic,model=e1000  -net user,hostfwd=tcp:127.0.0.1:6666-:22
> -name debian -localtime -machine accel=kvm -chardev
> spicevmc,id=charchannel1,name=vdagent -chardev pty,id=charconsole0
> (inside Qemu) systemctl poweroff
> 
> Login with nspawn
> ===============
> mount -t auto -o ro,loop,offset=1048576 /opt/debian.raw /mnt/loop
> [offset moves past /boot partition to linux ext4]
> systemd-nspawn -D /mnt/loop
> exit
> umount /mnt/loop
> 
> So far, all smiles.    However, when I try the same "Boot as Qemu"
> instructions again, the kernel comes up, but then "Reading hard disk .
> . . " appears, and then nothing.     So I guess that using
> systemd-nspawn has somehow corrupted the filesystem, although I'm not
> sure *why* that would happen.    Is there some reason that switching
> between nspawn and Qemu should fail, or that nspawn would have a
> problem with a loop mount?   Should I invoke nspawn differently?
> 

Did you check if loop device was unconfigured? Just to exclude the
obvious.


More information about the systemd-devel mailing list