16.05.2022 17:49, Johannes Schauer Marin Rodrigues wrote:
...
     $ qemu-img create -f qcow2 disk.qcow 4G
     $ curl --fail 
https://d-i.debian.org/daily-images/amd64/daily/netboot/debian-installer/amd64/initrd.gz
 > initrd.gz
     $ curl --fail 
https://d-i.debian.org/daily-images/amd64/daily/netboot/debian-installer/amd64/linux
 > linux
     $ /usr/bin/time -v qemu-system-x86_64 -nographic -no-reboot -enable-kvm -m 
1G -initrd initrd.gz -kernel linux -append 'console=ttyS0,9600,n8 
auto-install/enable=true debconf/priority=critical 
preseed/url=http://www.debian.org/releases/stable/example-preseed.txt 
netcfg/get_hostname=hostname netcfg/get_domain=domain 
passwd/root-password=r00tme passwd/root-password-again=r00tme 
passwd/user-fullname=user passwd/username=user passwd/user-password=insecure 
passwd/user-password-again=insecure pkgsel/run_tasksel=false 
popularity-contest:popularity-contest/participate=false 
grub-installer/bootdev=/dev/sda' -hda disk.qcow

Instead of -hda disk.qcow, I'd suggest using this:

  -drive file=disk.qcow,if=virtio,cache=unsafe

especially the cache thing, - it makes things *much* faster.  But
if you've a very fast SSD it should be okay too.

This will create a bootable disk image using debian-installer with usernames
and passwords given via preseed options. You can boot the whole thing like
this:

     $ qemu-system-x86_64 -nographic -enable-kvm -m 1G -hda disk.qcow

Log in with user:insecure, become root with password r00tme, edit
/etc/apt/sources.list replacing bullseye with unstable, run apt-get update,
then apt-get upgrade and then:

I guess it's possible to login with root directly, when on the console.
Also, the image is based on bookworm, not bullseye, but that doesn't
really matter.

     $ apt install mmdebstrap arch-test mount uidmap binfmt-support 
qemu-user-static

Then reboot the thing just to be sure and then run:

     $ mmdebstrap --arch=arm64 --variant=apt unstable /dev/null
     ...
     I: extracting archives...
     done
     I: installing essential packages...
     done
     qemu: uncaught target signal 11 (Segmentation fault) - core dumped
     E: run_chroot failed: E: env --unset=APT_CONFIG --unset=TMPDIR 
/usr/sbin/chrod
     W: listening on child socket failed:
     I: removing tempdir /tmp/mmdebstrap.nBUnpBBsox...
     E: mmdebstrap failed to run
     root@hostname:/home/user# dpkg -l | grep qemu
     ii  qemu-guest-agent               1:7.0+dfsg-7                      amd64 
  t
     ii  qemu-user-static               1:7.0+dfsg-7                      amd64 
  )

Now you have a reproducer that installed qemu-user-static on a real system and
not a chroot and we observe the same effect.

And now this is interesting.  I finally were able to reproduce the issue but
I don't think the prob is in qemu.  It is the gcc, not qemu.

When using -cpu host, the problem does not occur. Only when using the default
qemu cpu (kvm64?) it is shown.  It looks like it is the reason why it can
not be reproduced on a bare metal too (in a chroot in a real system).

This is.. wow.

/mjt

Reply via email to