0

I am trying to work with raw GPS data from a USB GPS receiver (Delorme LT-20) through /dev/ttyUSB0/.

My program had been working, but today I get this error:

could not open port /dev/ttyUSB0: [Errno 16] Device or resource busy: '/dev/ttyUSB0'

The program is pretty simple:

import serial
ser = serial.Serial('/dev/ttyUSB0')

How do I fix this?

7
  • 1
    To rule out the obvious and assuming you made no other changes did you reboot. Dec 19, 2016 at 5:49
  • What does lsof say?
    – Bex
    Dec 19, 2016 at 8:08
  • 1
    This never gets old. Dec 19, 2016 at 10:48
  • Steve Robillard- No changes, reboot, power-down & restart, unplug & reinsert the USB device. no change. It had been working during my earlier experiments. Dec 19, 2016 at 15:18
  • Bex- lsof output is here: dropbox.com/s/cqiw9s74n4ah832/lsof.txt?dl=0 I don't see tty or USB anywhere, but I did try gpsd a few days back- could there be a daemon running? (If yes, how do I kill it?) Dec 19, 2016 at 15:30

1 Answer 1

1

I know that this is a rather old question, but since I had the same problem I wanted to share my solution (apart from turning it off and on again, which also helped): list the processes which are using the resource and kill them.

Two options are available for this:

$ fuser /dev/ttyUSB0

If that returns nothing, try

$ sudo lsof /dev/ttyUSB0

Then issue a kill using the PID contained in the return-value of the above listed commands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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