kvm monitor socket - connection refused
Hello,
We are using KVM on Debian Squeeze (QEMU 0.12.5). Yesterday, I started a virtual machine and let it run overnight. I don't recall doing anything out of the ordinary to it.
This morning, I wanted to issue some commands to it through the control socket, but socat is unable to connect to it. Usually, I am able to connect to the control socket this way.
# ls -l total 1744816 -rw-r--r-- 1 iordan iordan 4195352576 Jun 28 14:54 disk.img srwxrwxr-x 1 root root 0 Jun 28 12:35 monitor
# socat - UNIX-CONNECT:./monitor 2011/06/28 15:13:53 socat[4564] E connect(3, AF=1 "./monitor", 11): Connection refused
# kvm was run thus: kvm -runas iordan -drive file=./disk.img -enable-kvm -vnc localhost:200,vnc,password -usbdevice tablet -monitor unix:./monitor,server,nowait
# file monitor monitor: socket
Is this a known issue with this version of Qemu? Has anybody else experienced this, and if so knows why it happens?
Many thanks for any input!
Iordan Iordanov
Quoted 18 lines · Iordan Iordanov
Hello,
We are using KVM on Debian Squeeze (QEMU 0.12.5). Yesterday, I started a virtual machine and let it run overnight. I don't recall doing anything out of the ordinary to it.
This morning, I wanted to issue some commands to it through the control socket, but socat is unable to connect to it. Usually, I am able to connect to the control socket this way.
# ls -l total 1744816 -rw-r--r-- 1 iordan iordan 4195352576 Jun 28 14:54 disk.img srwxrwxr-x 1 root root 0 Jun 28 12:35 monitor # socat - UNIX-CONNECT:./monitor 2011/06/28 15:13:53 socat[4564] E connect(3, AF=1 "./monitor", 11): Connection refused
Quoted 4 lines
# kvm was run thus: kvm -runas iordan -drive file=./disk.img -enable-kvm -vnc localhost:200,vnc,password -usbdevice tablet -monitor unix:./monitor,server,nowait
The process listening on this socket no longer exist, it finished. With this command line it should stay in foreground till finished (there's no -daemonize etc), so you should see error messages if any.
Quoted 5 lines
# file monitor monitor: socketIs this a known issue with this version of Qemu? Has anybody else experienced this, and if so knows why it happens?
How about checking who is actually listening on this socket before asking?
/mjt
Quoted 4 lines · Michael Tokarev
The process listening on this socket no longer exist, it finished. With this command line it should stay in foreground till finished (there's no -daemonize etc), so you should see error messages if any.
The kvm command was backgrounded, not -daemonize(d). It was still running, and I was accessing the VM via VNC.
Quoted 2 lines
How about checking who is actually listening on this socket before asking?
I thought it's the kvm process that listens on the socket. I haven't seen other processes spun off by kvm until now. Is that not the case?
I hope this clears things up. If there is still something strange in my question, do let me know.
Cheers,
Iordan
Quoted 10 lines · Iordan Iordanov
Quoted 4 lines · Michael Tokarev
The process listening on this socket no longer exist, it finished. With this command line it should stay in foreground till finished (there's no -daemonize etc), so you should see error messages if any.
The kvm command was backgrounded, not -daemonize(d). It was still running, and I was accessing the VM via VNC.
So kvm was running at the time you tried to access the mointor.
Quoted 5 lines
Quoted 2 lines
How about checking who is actually listening on this socket before asking?
I thought it's the kvm process that listens on the socket. I haven't seen other processes spun off by kvm until now. Is that not the case?
It is the kvm process that listens on the socket, it spawns no other processes.
The only other explanation I can think of is that you tried to run two instances of kvm, and when second instance initialized it re-created the monitor socket but failed later (eg, when initin network or something else) and exited, but left the "stray" socket (JFYI, you can remove a unix-domain socket where some process is listening, and create another - that one will really be different socket, even if named the same way, -- just like you can re-create a plain file the same way).
In any way, there hasn't been any problems/bugs in that area for ages.
/mjt
Hi Michael,
Quoted 9 lines · Michael Tokarev
The only other explanation I can think of is that you tried to run two instances of kvm, and when second instance initialized it re-created the monitor socket but failed later (eg, when initin network or something else) and exited, but left the "stray" socket (JFYI, you can remove a unix-domain socket where some process is listening, and create another - that one will really be different socket, even if named the same way, -- just like you can re-create a plain file the same way).
This may have been what happened. I'll try to reproduce this scenario.
Is there no way to prevent the accidental overwriting of a monitor socket that is still being used? I.e. is there no way for kvm to realize that the socket is in use and complain?
Quoted 3 lines
In any way, there hasn't been any problems/bugs in that area for ages.
This is what I was hoping to hear! :)
Thanks!
Iordan