×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Ekos: [WARNING] Port /dev/ttyUSB0 is already used by another driver or process.

  • Posts: 224
  • Thank you received: 8
2023-12-14T03:11:15: [WARNING] Port /dev/ttyUSB0 is already used by another driver or process.

Frequently I see this message when connecting my mount in Ekos. I never know why, it often seems erroneous. I am aware of no other process using this device. I have turned auto-connect off so I can manually set the port and the "system port". (Related question, why must I always set the port AND the "system port"? And what IS the "system port", anyway?)

When this happens, the only remedy I know of is to reboot the Pi. There may be remedies I don't know about. Is there a linux utility that lets me see what processes are using each port so that I can kill those processes?

So, time to reboot the Pi. Looking forward to a better answer from someone.
4 months 2 weeks ago #97624

Please Log in or Create an account to join the conversation.

  • Posts: 224
  • Thank you received: 8
Answering one of my own questions above, the way to find the process holding the port is given here . This enables me to find the process without rebooting and then kill it.

In my case that was:
sudo ls -l /proc/[0-9]*/fd/* |grep /dev/ttyUSB0                                                                                  
[sudo] password for astronaut: 
ls: cannot access '/proc/2122/fd/10': No such file or directory
ls: cannot access '/proc/2122/fd/12': No such file or directory
lrwx------ 1 astronaut astronaut 64 Dec 13 21:57 /proc/1381/fd/3 -> /dev/ttyUSB0

Then just
kill -9 1381

I would still like to know why the process is still alive in the first place.
4 months 2 weeks ago #97625

Please Log in or Create an account to join the conversation.

  • Posts: 155
  • Thank you received: 107
Hey Steve, hard to tell what exactly is causing the problem but seems something within ekos wants to use exclusively that port.

Next time when you find the PID you may try to run ps aux | grep {here the pid} and report back the process name so we can have a better idea.
I think this is relative to your specific setup tho.
4 months 2 weeks ago #97631

Please Log in or Create an account to join the conversation.

  • Posts: 362
  • Thank you received: 114
It is better use sudo lsof /dev/ttyUSB0. Programs that can grab these serial ports is GPS daemon. In the past there was even brltty grabbing these ports. You may want to remove such package.
The following user(s) said Thank You: Steve Cohen
4 months 2 weeks ago #97632

Please Log in or Create an account to join the conversation.

  • Posts: 224
  • Thank you received: 8
Thanks for the lsof tip. Why is it better?

I’m pretty sure you’re right that GPS is the problem. I attach one to my pi, more for its real time clock than for GPS, which I don’t really need because my setup doesn’t move usually. This is why I don’t auto connect after starting INDI. I always have to select the port first. But GPS connects as /dev/ttyACM0, not /dev/ttyUSB0, so I’m not sure where the confusion is coming from.

Wishlist item for INDI: save the ports in the config so I don’t have to select them every time.

And let me reiterate another INDI question. Why is there both “port” and “system port” setting on the mount configuration page?
4 months 2 weeks ago #97633

Please Log in or Create an account to join the conversation.

  • Posts: 118
  • Thank you received: 19
Steve,

If you only need date & time I use one of these shop.macetech.com/products/chronopi-v1-0...ompatible-rtc-module

I've tried it with Astro Arch & it works well. It keeps time even if the pi is not connected to anything

Here's the start of the Astro Arch thread on it indilib.org/forum/astro-arch/12964-astro....html?start=12#92225

Cheers

Alan
4 months 2 weeks ago #97635

Please Log in or Create an account to join the conversation.

  • Posts: 61
  • Thank you received: 27
Hi Steve,

The port conflict problem with GPS comes from GPSD. When systemd launches its services (daemon), it will assign the point /dev/ttyUSB0 to the GPS if in the file /etc/default/gpsd there is USBAUTO="true"

Change the USBAUTO value to false.

My gpsd file:

#Default settings for gpsd.
START_DAEMON="true"
GPSD_OPTIONS="-n"
DEVICES="/dev/ttyACM0"
USBAUTO="false"

Concerning the ports, in the mount configuration page, could you give us a screenshot?
The following user(s) said Thank You: Steve Cohen
4 months 2 weeks ago #97636

Please Log in or Create an account to join the conversation.

  • Posts: 224
  • Thank you received: 8
I've modified my /etc/default/gpsd file as you suggested. Was that the file you meant?
It had no effect on the screens I see when starting Ekos, but we will see if it affects the amount of times I see this error.
Here are the screens. The first is before configuration, the second is after configuration.

4 months 2 weeks ago #97638
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 263
  • Thank you received: 66
There is another possibility if you happen to have Network Manager running. The Modem Manager service will auto connect to serial ports because it thinks they are modems.

You can disable modem manager with this.

systemctl disable ModemManager.service
systemctl stop ModemManager.service
Last edit: 4 months 2 weeks ago by Aaron Morris.
4 months 2 weeks ago #97639

Please Log in or Create an account to join the conversation.

  • Posts: 224
  • Thank you received: 8
I never did anything with ModemManager. Is it part of the default AstroArch distribution?
4 months 2 weeks ago #97640

Please Log in or Create an account to join the conversation.

  • Posts: 224
  • Thank you received: 8
Stephane, one problem with your solution is that then the GPS doesn't work, or more accurately, it doesn't work in a fashion that I've been used to.

I'm used to manually starting gpsd with gpsd /dev/ttyACM0 and then running this little python script that I found here. I'd have preferred a totally automated solution but gave up on finding one, for now. At some point you actually do have to go look at some stars, right? Well, with USBAUTO set to false, the script fails to find the GPS output. But it's actually there, somewhere, as running the utility cgps shows.

So I've temporarily reverted to the USBAUTO=true, which at least works with my previous setup, although sometimes causing the port conflict. Unless someone knows how to make this work with the USB dongle, I may go for the RTC-only solution that Alan Archer mentions.
4 months 2 weeks ago #97643

Please Log in or Create an account to join the conversation.

  • Posts: 61
  • Thank you received: 27
As Aaron rightly says, the best is to deactivate ModemManager which is on AstroArch so that it does not interfere with the GPS.

systemctl disable ModemManager.service
systemctl stop ModemManager.service

On ArchLinux with GPS, the ideal is to use chrony to retrieve time information to apply it to the system. To do this, you must modify the /etc/chrony.conf file. Then launch the service.
wiki.archlinux.org/title/Chrony

sudo pacman -S chrony

nano /etc/chrony.conf

refclock SHM 0 offset 0.5 delay 0.2 refid NMEA
driftfile /var/lib/chrony/drift

systemctl enable chronyd
systemctl start chronyd

The PI clock will be updated by chrony after the GPS is synchronized. You can monitor the GPS status with gpsmon -n in a console or better by launching xgps. You must have installed the cairo package before using xgp.
The following user(s) said Thank You: Steve Cohen
4 months 2 weeks ago #97644

Please Log in or Create an account to join the conversation.

Moderators: Mattia
Time to create page: 0.769 seconds