qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: qemu + expect + Raspberry Pi = sudden stop of accepting commands


From: Dilyan Palauzov
Subject: Re: qemu + expect + Raspberry Pi = sudden stop of accepting commands
Date: Fri, 22 Jan 2021 20:02:26 +0000
User-agent: Horde Application Framework 5

Hello Philippe,

thanks for your answer.

I wrote the expect script some days ago and I have not used older versions.

Setting `export DEBIAN_FRONTEND=noninteractive` does not help.

I start

time (unzip -o 2021-01-11-raspios-buster-armhf.zip && date && ./bootstrap&& echo $? && date)


When I run the script below, without the `interact` command, the last lines are:
-----------
EOF
root@raspberrypi:/home/pi# echo Q1
Q1
root@raspberrypi:/home/pi# apt-get clean
root@raspberrypi:/home/pi# echo Q2
Q2
root@raspberrypi:/home/pi# cat /dev/zero > zero.file
cat: write error: No space left on device
root@raspberrypi:/home/pi# sync
root@raspberrypi:/home/pi# echo Q3
Q3
root@raspberrypi:/home/pi# 0
Fri Jan 22 09:24:12 PM EET 2021

real    25m19.685s
user    0m31.094s
sys     0m4.049s

------------
So why is `echo $0` executed within the VM and why does the VM terminate after all? Calling `sudo poweroff` causes kernel panic, but on the output above there is no kernel panic.

When I uncomment the 'interact' line, and rerun


time (unzip -o 2021-01-11-raspios-buster-armhf.zip && date && ./bootstrap&& echo $? && date)

the last output is:
----------------
cat: write error: No space left on device
root@raspberrypi:/home/pi# sync
root@raspberrypi:/home/pi# echo Q3
Q3
root@raspberrypi:/home/pi# rm zero.file
root@raspberrypi:/home/pi# sync
root@raspberrypi:/home/pi# sleep 3
root@raspberrypi:/home/pi#
----------------

Do you have any ideas?

Kind regards
  Dilyan

-------------- bootstrap -----------------
#!/usr/bin/expect -f
#TODO Set WIRELESS LAN COUNTRY
set IMG "2021-01-11-raspios-buster-armhf.img"
set lang "bg_BG"
set TZ "Europe/Sofia"
set URL "https://abc.de/t?h";
set NTP_SERVERS "0.bg.pool.ntp.org 1.bg.pool.ntp.org 2.bg.pool.ntp.org 3.bg.pool.ntp.org"
set timeout -1
spawn qemu-system-arm -dtb ./versatile-pb-buster.dtb -kernel ./kernel-qemu-4.19.50-buster -cpu arm1176 -m 256 -M versatilepb -append "root=/dev/sda2 rootfstype=ext4 rw" -drive driver=raw,file=$IMG,index=0,media=disk -nographic
#-netdev user,id=net0,hostfwd=tcp::10022-:22
expect "login: "
send "pi\n"
expect "Password: "
send "raspberry\n"
send "sudo bash\n"
send "export DEBIAN_FRONTEND=noninteractive\n"
send "swapoff -a\n"
send "sed -i '1 sK^{\$K{ \"homepage\":\"$URL\",\"session\":{\"restore_on_startup\": 4, \"startup_urls\":\[\"$URL\"\]},K' /usr/lib/chromium-browser/master_preferences\n"
send "systemctl stop systemd-journal-flush systemd-journald\n"
send "rm -r /etc/xdg/autostart/piwiz.desktop /etc/xdg/autostart/print-applet.desktop /etc/xdg/autostart/pulseaudio.desktop /etc/xdg/lxsession/LXDE-pi/autostart /usr/share/rpd-wallpaper/\[a-sw\]* /home/pi/Bookshelf /run/log/journal\n"
send "timedatectl set-timezone $TZ\n"
send "systemctl disable systemd-journal-flush nfs-client.target systemd-journald apt-daily-upgrade.timer apt-daily.timer remote-fs.target\n"
expect "# "
send "sed -i 's/#\ $lang.UTF-8 UTF-8/$lang.UTF-8 UTF-8/' /etc/locale.gen\n"
send "echo \"$URL\" > /home/pi/Desktop/URL.txt\n"
send "locale-gen\n"
expect "Generation complete."
send "update-locale LANG=$lang.UTF-8 LC_ALL=$lang.UTF-8 LANGUAGE=$lang.UTF-8\n"
#expect "# "
send "apt-get update\n"
send "apt-get install -V unclutter\n"
expect "Setting up unclutter "
expect "# "
send "apt-get purge -V -y --autoremove thonny lxplug-bluetooth vlc cups cups-common cups-daemon ffmpeg gdb git gcc binutils pulseaudio make manpages dillo galculator geany strace man-db aspell ghostscript gpicview rp-bookshelf gstreamer1.0-alsa gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-x gstreamer1.0-omx gstreamer1.0-libav xarchiver system-config-printer rsyslog logrotate rfkill cron bluez blt groff-base gvfs luajit cifs-utils debian-reference-common dh-python\n"
expect "Removing thonny"
expect "# "
#send "apt-get autoremove --purge -y -V\n"
# expect "Reading package lists..."
# expect "# "
send "apt-get upgrade -y -V\n"
expect -re "The following packages will be upgraded:|0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded."
expect "# "
send "echo 'FallbackNTP=$NTP_SERVERS' >> /etc/systemd/timesyncd.conf\n"
expect "# "
send "cat > /etc/xdg/lxsession/LXDE-pi/autostart << EOF\n"
send "@lxpanel --profile LXDE-pi\n"
send "@pcmanfm --desktop --profile LXDE-pi\n"
send "#@unclutter -idle 10\n"
send "@xset s off\n"
send "@xset -dpms\n"
send "@xset s noblank\n"
send "/usr/bin/chromium-browser --no-sandbox --no-first-run --kiosk\n"
send "EOF\n"
send "echo Q1\n"
expect "Q1"
expect "# "
send "apt-get clean\n"
send "echo Q2\n"
expect "Q2"
expect "# "
send "cat /dev/zero > zero.file\n"
send "sync\n"
send "echo Q3\n"
expect "Q3"
expect "# "
send "rm zero.file\n"
#expect "# "
send "sync\n"
send "sleep 3\n"
interact
#send "poweroff\n"






















----- Message from Philippe Mathieu-Daudé <f4bug@amsat.org> ---------
   Date: Fri, 22 Jan 2021 15:26:10 +0100
   From: Philippe Mathieu-Daudé <f4bug@amsat.org>
Subject: Re: qemu + expect + Raspberry Pi = sudden stop of accepting commands
     To: Dilyan Palauzov <Dilyan.Palauzov@aegee.org>, qemu-discuss@nongnu.org


Hi Dilyan,

On 1/22/21 2:01 PM, Dilyan Palauzov wrote:
Hello,

...

root@raspberrypi:/home/pi# echo Q1
Q1
root@raspberrypi:/home/pi# apt-get clean
root@raspberrypi:/home/pi#
real    23m20.381s
user    0m29.330s
sys     0m3.832s
---------------

Thus the last commands from the expect script are not executed.

Why are the last commands from the expect script not executed any why
does qemu terminate?  I use version 5.1.0 coming with Fedora.

Was your script working before on an earlier version?

Any help will be highly appreciated, as I could not figure this out
myself for several days.

Kind regards
  Дилян



-------------- bootstrap script ----------
#!/usr/bin/expect -f
#TODO Set WIRELESS LAN COUNTRY
set IMG "2021-01-11-raspios-buster-armhf.img"
set lang "bg_BG"
set TZ "Europe/Sofia"
set URL "https://www.abc.de/t?h";
set NTP_SERVERS "0.bg.pool.ntp.org 1.bg.pool.ntp.org 2.bg.pool.ntp.org
3.bg.pool.ntp.org"
set timeout -1
spawn qemu-system-arm -dtb ./versatile-pb-buster.dtb  -kernel
./kernel-qemu-4.19.50-buster -cpu arm1176 -m 256 -M versatilepb -append
"root=/dev/sda2 rootfstype=ext4 rw"  -drive
driver=raw,file=$IMG,index=0,media=disk -nographic
#-netdev user,id=net0,hostfwd=tcp::10022-:22
...

send "cat > /etc/xdg/lxsession/LXDE-pi/autostart << EOF\n"
send "@lxpanel --profile LXDE-pi\n"
send "@pcmanfm --desktop --profile LXDE-pi\n"
send "#@unclutter -idle 10\n"
send "@xset s off\n"
send "@xset -dpms\n"
send "@xset s noblank\n"
send "/usr/bin/chromium-browser --no-sandbox --no-first-run --kiosk\n"
send "EOF\n"
send "echo Q1\n"
expect "Q1"
expect "# "
send "apt-get clean\n"

My guess is apt-get is consuming the following console input.

First it is recommended to set DEBIAN_FRONTEND=noninteractive,
second you need to be sure your command is finished before
going on.

send "cat /dev/zero > zero.file\n"
send "sync\n"
send "rm zero.file\n"
expect "# "
send "sync\n"
send "sleep 3\n"
send "poweroff\n"

#set background image
#set plymouth image during boot
#disable bluetooth, if enabled
#disable/configure wlan

I don't think this is a QEMU problem ;)

Regards,

Phil.


----- End message from Philippe Mathieu-Daudé <f4bug@amsat.org> -----






reply via email to

[Prev in Thread] Current Thread [Next in Thread]