qemu-discuss
[Top][All Lists]
Advanced

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

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


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

Hello,

I download an Raspberry Pi OS image, the kernel from https://github.com/dhruvvyas90/qemu-rpi-kernel and then want to configure the system using `expect`. I run the script below, called bootstrap, by calling `time (unzip -o 2021-01-11-raspios-buster-armhf.zip && date && ./bootstrap) `. The output of calling the script ends with

rocessing triggers for gnome-menus (3.31.4-3) ...
Processing triggers for systemd (241-7~deb10u5+rpi1) ...
Processing triggers for desktop-file-utils (0.23-4) ...
root@raspberrypi:/home/pi# echo 'FallbackNTP=0.bg.pool.ntp.org 1.bg.pool.ntp.org 2.bg.pool.ntp.org 3.bg.pool.ntp.org' >> /etc/systemd/timesyncd.conf
root@raspberrypi:/home/pi# cat > /etc/xdg/lxsession/LXDE-pi/autostart << EOF
@lxpanel --profile LXDE-pi @pcmanfm --desktop --profile LXDE-pi #@unclutter -idle 10 @xset s off @xset -dpms @xset s noblank /usr/bin/chromium-browser --no-sandbox --no-first-run --kiosk
EOF
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.

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
expect "login: "
send "pi\n"
expect "Password: "
send "raspberry\n"
send "sudo bash\n"
expect "# "
send "sed -i '1 sK^{\$K{ \"homepage\":\"$URL\",\"session\":{\"restore_on_startup\": 4, \"startup_urls\":\[\"$URL\"\]},K' /usr/lib/chromium-browser/master_preferences\n"
expect "# "
# interact
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 "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 unclutter\n"
expect "Setting up unclutter "
expect "# "
send "apt-get purge -y thonny lxplug-bluetooth vlc cups 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\n"
expect "Removing thonny"
expect "# "
send "apt-get autoremove --purge -y\n"
expect "Reading package lists..."
expect "# "
send "apt-get upgrade -y\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 "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




reply via email to

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