I'm using a USB-modem to connect a virtual machine with the internet. So host and guest do not share the same IP/network. I emulate by qemu-kvm, device forwarding works great with *-usb -usbdevice host:1c9e:9603*. The VM uses Ubuntu 10.04, Host 11.10.

Unfortunately the modem unmounts after ~3 days. Obviously, from now on no connection can be established. After the VM reboots, a connection is possible again.

nmcli can be used to establish an internet connection and check whether its still active. But how do I remount the device/modem with a small bash script?

The syslog below shows how the device unplugs after being ~3 days in use:

pppd[1369]: LCP terminated by peer
pppd[1369]: Connect time 1104.9 minutes.
pppd[1369]: Sent 1279 bytes, received 790 bytes.
kernel: [66423.705380] device ppp0 left promiscuous mode

pppd[1369]: Modem hangup
pppd[1369]: Connection terminated.

avahi-daemon[424]: Withdrawing workstation service for ppp0.
modem-manager[483]: <info>  (ttyUSB2) closing serial port...

NetworkManager[431]:    SCPlugin-Ifupdown: devices removed (path: /sys/devices/virtual/net/ppp0, iface: ppp0)
NetworkManager[431]: <info> (ttyUSB2): now unmanaged
NetworkManager[431]: <info> (ttyUSB2): device state change: 8 -> 1 (reason 36)
NetworkManager[431]: <info> (ttyUSB2): deactivating device (reason: 36).
NetworkManager[431]: <warn> could not read ppp stats: No such device
NetworkManager[431]: <info> (ttyUSB2): cleaning up...
NetworkManager[431]: <info> (ttyUSB2): taking down device.
NetworkManager[431]: <info> Unmanaged Device found; state CONNECTED forced. (see http://bugs.launchpad.net/bugs/191889)

nm-dispatcher.action: Error in get_property: Method "Get" with signature "ss" on interface "org.freedesktop.DBus.Properties" doesn't exist#012
modem-manager[483]: <info>  (ttyUSB2) serial port closed
modem-manager[483]: <info>  Modem /org/freedesktop/ModemManager/Modems/0: state changed (connected -> disconnecting)
modemqemu-kvm-manager[483]: <info>  Modem /org/freedesktop/ModemManager/Modems/0: state changed (disconnecting -> connected)

pppd[1369]: Exit.
NetworkManager[431]: <info> disconnect failed: (32) The serial port is not open.

I am afraid, that restarting these USB-daemons on the VM will not be enough - as I will have to tell the qemuKVM-Manager to forward the device once again. But that would be the second step.

  • 1
    Are you saying that the USB device disappears from the guest after 3 days? If so, it's a bug, and it could easily be on either side. Like the USB device could encounter an error condition, perform a bus reset, and that reset takes it offline. All you're seeing from the VM + passthrough is the device in unavailable. My gut tells me this may be a USB powersave issue, or a flaky USB device. This old external USR serial modems are good for something, rock solid reliability, and real serial ports usually don't have bus reset problems. – ppetraki Mar 29 '12 at 13:26

I have tried this http://marc.info/?l=linux-usb&m=121459435621262&w=2 c-programm to reset usb.

$ cc usbreset.c -o usbreset
$ lsusb
Bus 002 Device 003: ID 0fe9:9010 DVICO
$ chmod +x usbreset
$ sudo ./usbreset /dev/bus/usb/002/003

The UMTS Modem disappears for ~20 secs and appears again in the VM. Fortunately, it is redirected automatically by the qemu manager!

The problem is still NOT solved, as after 3 days even this usb reset will not allow me to establish a well-functioning connection.

A reboot of the VM is my last resort...


The modem does not disappear from the network manager, its still there, no connection can be established though.

  • Remember, this is just a serial port. In your VM you should be able to find it in /dev as a plan ttySn or ttyUSBSn device. If you can't chat with it with minicom, kermit, or wvdial, it doesn't matter what NM thinks as it might be working with a stale handle. You need to verify that the serial device is actually responding, open it with minicom and enter AT and press enter, if you don't see an OK then you have more troubleshooting to do. See tldp.org/HOWTO/html_single/Modem-HOWTO/#s8 – ppetraki Apr 12 '12 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.