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

alpine stop does not delete PID file, so alpine list reports stopped VM as "Running" #66

Closed
maxzinkus opened this issue Feb 26, 2023 · 6 comments

Comments

@maxzinkus
Copy link
Collaborator

When running alpine stop:

cmd/stop.go:24 calls host/stop.go:8 which in turn calls qemu/ops.go:166.

However, none of these delete the alpine.pid file which they check for. Therefore, the alpine CLI displays the status of the stopped incorrectly VM as Running.

Easy fix, just delete the file if it exists after a successful stop in whichever of these locations makes the most sense. Likely either qemu/ops.go or host/stop.go.

@maxzinkus
Copy link
Collaborator Author

It may also behoove you to add a -f "force" stop option which sends sigkill instead of sigterm.

@maxzinkus
Copy link
Collaborator Author

Closing this issue because it stopped happening. I'm not sure why it stopped because nothing in macpine is set to delete the PID file. Does qemu delete the PID file when the process is termd?

@jdriselvato
Copy link

jdriselvato commented Mar 1, 2023

I'm having this now happen to me. I exited the vm, did alpine stop simplistic-background and still see it running

$ alpine list
NAME                      OS         STATUS      SSH    PORTS          ARCH       PID       
simplistic-background     alpine     Running     22     5900,30000     x86_64     63090   

The weird thing is, now ssh hangs.

edit:

Additionally, I ran

$ killall -9 alpine
[1]+  Killed: 9               alpine start simplistic-background

and it's still running:

$ alpine list
NAME                      OS         STATUS      SSH    PORTS          ARCH       PID       
simplistic-background     alpine     Running     22     5900,30000     x86_64     63090

then run

$ alpine stop simplistic-background
2023/02/28 19:48:09 os: process already finished

but list still shows it running.

@maxzinkus
Copy link
Collaborator Author

This is a qemu thing. alpine stop your VMs, pgrep qemu-system to make sure none are running, rm ~/.macpine/simplistic-background/alpine.pid to clean up the old PIDfile, and you should be good to go.

@jdriselvato
Copy link

jdriselvato commented Mar 1, 2023

That worked, I'll have to save those commands for later.

alias killalpine="pgrep qemu-system; rm ~/.macpine/simplistic-background/alpine.pid

Thanks for letting me know.

@maxzinkus
Copy link
Collaborator Author

pgrep string just lists any running process IDs whose name matches string. The important part was the rm, and that was specific to your vm name simplistic-background. ~/.macpine contains one folder per VM, each with its name.

idroz added a commit that referenced this issue Mar 14, 2023
idroz added a commit that referenced this issue Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants