OpenWrt/LEDE Project

  • Status Unconfirmed
  • Percent Complete
    0%
  • Task Type Bug Report
  • Category Base system
  • Assigned To No-one
  • Operating System All
  • Severity Medium
  • Priority Very Low
  • Reported Version openwrt-19.07
  • Due in Version Undecided
  • Due Date Undecided
  • Private
Attached to Project: OpenWrt/LEDE Project
Opened by Peter Geis - 01.06.2020

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

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 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.

Peter Geis commented on 01.06.2020 15:54

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       
SkateWarp commented on 08.09.2020 21:33

I'm having this issue too.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing