arighi / virtme-ng

Quickly build and run kernels inside a virtualized snapshot of your live system
GNU General Public License v2.0
417 stars 45 forks source link

Add note in MOTD how to shut down VM (pass `-f` to `poweroff`) #81

Closed paulmenzel closed 7 months ago

paulmenzel commented 7 months ago
$ vng -r .
[…]
[    3.591220] ip (622) used greatest stack depth: 12400 bytes left
          _      _
   __   _(_)_ __| |_ _ __ ___   ___       _ __   __ _
   \ \ / / |  __| __|  _   _ \ / _ \_____|  _ \ / _  |
    \ V /| | |  | |_| | | | | |  __/_____| | | | (_| |
     \_/ |_|_|   \__|_| |_| |_|\___|     |_| |_|\__  |
                                                |___/
   kernel version: 6.8.0-rc5-virtme x86_64

pmenzel@virtme-ng:/$ poweroff
poweroff: must be superuser.
pmenzel@virtme-ng:/$ su
Password:
su: Authentication failure
pmenzel@virtme-ng:/$ sudo -s
root@virtme-ng:/# poweroff
WARNING: could not determine runlevel - doing soft poweroff
  (it's better to use shutdown instead of poweroff from the command line)
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
Failed to talk to init daemon.
root@virtme-ng:/# poweroff -f
[   31.024267] ACPI: PM: Preparing to enter system sleep state S5
[   31.024814] kvm: exiting hardware virtualization
[   31.025462] reboot: Power down

I remembered, that poweroff has to be called -f if systemd is not running. A note about this would be nice.

Power off machine with poweroff -f if no init manager is runnig

Of course, it’s just a suggestion from my today’s experience with virtme-ng. If you think otherwise, feel free to close the issue.

arighi commented 7 months ago

You can also simply exit from the shell (like CTRL+d or just type exit) to get back to the host. Maybe adding a simple hint like (CTRL+d to exit) would be enough? It seems cleaner than suggesting to use poweroff -f...

paulmenzel commented 7 months ago

Oh, even better. Yes, that would have helped me.

arighi commented 7 months ago

ack, I'll add that and will also apply the other change to improve the help of --run. Thanks for the suggestions!