podman: Error: qemu exited unexpectedly with exit code 1, stderr: qemu-system-x86_64: cannot create PID file: Cannot lock pid file: Resource temporarily unavailable

podman fails to start

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

Error: qemu exited unexpectedly with exit code 1, stderr: qemu-system-x86_64: cannot create PID file: Cannot lock pid file: Resource temporarily unavailable

Steps to reproduce the issue:

  1. Stop machine.

  2. Start machine.

  3. Machine starts or not starts very unpredictably.

Describe the results you received:

Error: qemu exited unexpectedly with exit code 1, stderr: qemu-system-x86_64: cannot create PID file: Cannot lock pid file: Resource temporarily unavailable

Describe the results you expected: Stuff to work? More descriptive error messages?

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

podman version
Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM
Error: unable to connect to Podman. failed to create sshClient: connection to bastion host (ssh://core@localhost:50422/run/user/502/podman/podman.sock) failed: dial tcp [::1]:50422: connect: connection refused

Output of podman info:

podman info
Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM
Error: unable to connect to Podman. failed to create sshClient: connection to bastion host (ssh://core@localhost:50422/run/user/502/podman/podman.sock) failed: dial tcp [::1]:50422: connect: connection refused

Package info (e.g. output of rpm -q podman or apt list podman or brew info podman):

==> podman: stable 4.2.1 (bottled), HEAD
Tool for managing OCI containers and pods
https://podman.io/
/usr/local/Cellar/podman/4.2.1 (178 files, 48.5MB) *
  Poured from bottle on 2022-09-15 at 22:39:56
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/podman.rb
License: Apache-2.0
==> Dependencies
Build: go-md2man ✘, go@1.18 ✘
Required: qemu ✔
==> Options
--HEAD
        Install HEAD version
==> Caveats
zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Analytics
install: 24,813 (30 days), 64,356 (90 days), 211,186 (365 days)
install-on-request: 24,012 (30 days), 62,808 (90 days), 209,311 (365 days)
build-error: 1 (30 days)

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

No

Additional environment details (AWS, VirtualBox, physical, etc.): mac

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 8
  • Comments: 28 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I had this same issue today, what I did to “solve” it is to kill the qemu process with a kill -9 PID command. Then, I run the podman machine start command and it started successfully.

if your qemu is upgraded, try remove podman machine and initialize again

podman machine rm
podman machine init

Today I also got into this problem. I tried to start podman machine and it gave me exit status 255. Next try was unsuccessfully and the podman machine start process just hanged and I killed it with ctrl-c. Third time I got the error mentioned in this issue (Error: qemu exited unexpectedly with exit code 1). After killing the /opt/homebrew/bin/qemu-system-aarch64 process from my machine, I could once again start podman machine.

The session with my shell:

% podman machine start                                                                                                                                            
Starting machine "podman-machine-default"                                                                                                                                                     
Waiting for VM ...                                                                             
Mounting volume... /Users/oherrala:/Users/oherrala                                             
Error: exit status 255

% podman machine start                                             
Starting machine "podman-machine-default"                                                      
Waiting for VM ... 

<I kept waiting and waiting and waiting, then hit CTRL-C to end the waiting>
^C

% podman machine start
Starting machine "podman-machine-default"                                                      
Waiting for VM ...                                                                             
Error: qemu exited unexpectedly with exit code 1, stderr: qemu-system-aarch64: cannot create PID file: Cannot lock pid file: Resource temporarily unavailable

% ps auxwww|grep podman
% kill 63230

% podman machine start 
Starting machine "podman-machine-default"
Waiting for VM ...
Mounting volume... /Users/oherrala:/Users/oherrala

This machine is currently configured in rootless mode. If your containers
require root permissions (e.g. ports < 1024), or if you run into compatibility
issues with non-podman clients, you can switch using the following command: 

        podman machine set --rootful

API forwarding listening on: /var/run/docker.sock
Docker API clients default to this address. You do not need to set DOCKER_HOST.

Machine "podman-machine-default" started successfully

I ran into this issue as well today with:

  • podman version 4.6.0
  • QEMU emulator version 8.0.3 (qemu-system-x86_64 )

Here is a oneliner to solve the issue:

ps -edf | grep qemu-system | grep -v grep | awk '{print $2}' | xargs -I{} kill -9 {}; podman machine stop

You may then run podman machine start and keep rolling

It was a failed shutdown for me. Thanks @oherrala! More simply

% ps auxwww|grep podman
% kill 63230
% podman machine start

It was solved when I restarted the computer. You can restart your computer. I have no idea about the problem.

Same problem M1

I have the same problem on latest macOS

Just also run into this issue on an M1 Macbook. Started with podman not being able to do anything. The virtual machine did not react. Stopping the machine with “podman machine stop” did hang forever. Afterwards i killed the qemu process and started the machine again. Not very user friendly.

Any chance podman can detect a non-responsive vm? This would help a lot. Happens every x days after resuming from suspend unfortunately.