Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#3142 - QEMU on arm64 cannot shut down OpenWRT 19.07 #7892

Open
openwrt-bot opened this issue Jun 1, 2020 · 3 comments
Open

FS#3142 - QEMU on arm64 cannot shut down OpenWRT 19.07 #7892

openwrt-bot opened this issue Jun 1, 2020 · 3 comments
Labels
flyspray release/19.07 pull request/issue targeted (also) for OpenWrt 19.07 release

Comments

@openwrt-bot
Copy link

pgwipeout:

Supply the following if possible:

  • Device problem occurs on - arm64 QEMU Virtual Machine
  • Software versions of OpenWrt/LEDE release, packages, etc. - 19.07.3
  • Steps to reproduce -
    Boot OpenWRT as per the instructions at [[https://openwrt.org/docs/guide-user/virtualization/qemu|OpenWRT QEMU Documentation]] on an arm64 virtual machine.

When hosted in a QEMU virtual machine on arm64 (aarch64), OpenWRT is unable to shut down.
QEMU supports two shutdown methods on arm64, ACPI and QEMU Guest Agent

ACPI on arm64 requires UEFI support, which is not enabled in the armvirt-64 kernel.

QEMU Guest Agent has a package for OpenWRT but the package is broken due to the base implementation of OpenWRT.
QEMU Guest Agent forks a process that calls /sbin/shutdown with several flags when ordered to shut down.
/sbin/shutdown does not exist in the base system.
The flags passed are not compatible with /sbin/poweroff.

This is solved with a simple script:
/sbin/shutdown:
#!/bin/sh
/sbin/poweroff

Ideally support for armvirt-64 should move to uefi, since that is the expected supported method of booting a arm64 virtual machine.
This would require the addition of CONFIG_EFI_STUB to the armvirt-64 kernel config.
It would also require changing the armvirt-64 packaging to include the kernel efi image in the root file system, and/or add a bootloader such as grub.

@openwrt-bot
Copy link
Author

pgwipeout:

Cleaned up the script and fixed all variations of the shutdown command.

#!/bin/sh

/bin/echo $4 > /dev/console

if [ $2 == "-P" ]
then
echo "Shutting down with poweroff" > /dev/console
/sbin/poweroff
elif [ $2 == "-r" ]
then
echo "Shutting down with reboot" > /dev/console
/sbin/reboot
elif [ $2 == "-H" ]
then
echo "Shutting down with halt" > /dev/console
/sbin/halt
fi

@openwrt-bot
Copy link
Author

SkateWarp:

I'm having this issue too.

@aparcar aparcar added the release/19.07 pull request/issue targeted (also) for OpenWrt 19.07 release label Feb 22, 2022
@shvetsnikita
Copy link

This is no longer reproducible with armsr target on 23.05.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray release/19.07 pull request/issue targeted (also) for OpenWrt 19.07 release
Projects
None yet
Development

No branches or pull requests

3 participants