Permission denied opening serial USB port

493 views
Skip to first unread message

barry manilow

unread,
Jun 5, 2024, 11:21:16 AM6/5/24
to weewx-user
Just installed Weewx 5 and new install of Bookworm 32 bit on Raspberry pi 4. I'm using a USB Serial interface with my Davis Vantage Vue, which has worked perfectly for the past few years.
After completing setup I started with sudo service weewx start. 
No data appeared to be sent, so checked weewx status and got this error:

 $ sudo service weewx status
× weewx.service - WeeWX
     Loaded: loaded (/lib/systemd/system/weewx.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Wed 2024-06-05 16:07:17 BST; 53s ago
   Duration: 299ms
       Docs: https://weewx.com/docs
    Process: 1733 ExecStart=weewxd /etc/weewx/weewx.conf (code=exited, status=4)
   Main PID: 1733 (code=exited, status=4)
        CPU: 299ms

Jun 05 16:07:17 raspberrypi weewxd[1733]: CRITICAL weewx.engine:     ****                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jun 05 16:07:17 raspberrypi weewxd[1733]: CRITICAL weewx.engine:     ****    File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 244, in __init__
Jun 05 16:07:17 raspberrypi weewxd[1733]: CRITICAL weewx.engine:     ****      self.open()
Jun 05 16:07:17 raspberrypi weewxd[1733]: CRITICAL weewx.engine:     ****    File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 325, in open
Jun 05 16:07:17 raspberrypi weewxd[1733]: CRITICAL weewx.engine:     ****      raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
Jun 05 16:07:17 raspberrypi weewxd[1733]: CRITICAL weewx.engine:     ****  serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
Jun 05 16:07:17 raspberrypi weewxd[1733]: CRITICAL __main__: Unable to load driver: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
Jun 05 16:07:17 raspberrypi weewxd[1733]: CRITICAL __main__:     ****  Exiting...
Jun 05 16:07:17 raspberrypi systemd[1]: weewx.service: Main process exited, code=exited, status=4/NOPERMISSION
Jun 05 16:07:17 raspberrypi systemd[1]: weewx.service: Failed with result 'exit-code'

Something has changed with permissions I think, but no idea what.
Any ideas on what has happened? Thanks!

Pierre-Yves

unread,
Jun 5, 2024, 11:38:40 AM6/5/24
to weewx-user

vince

unread,
Jun 5, 2024, 11:58:10 AM6/5/24
to weewx-user
Did you even try to look for the answer to this very frequently asked question ?

Please use the 'search conversations within weewx-user' box at the top of the browser and look for your exact error message "serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'"

Any of the top five returned results provide the answer.   My answer from March to somebody else in https://groups.google.com/g/weewx-user/c/duGfSg6cQZ4/m/adiOz1FUAAAJ provides links to the why.

ALWAYS ALWAYS ALWAYS SEARCH FOR YOUR EXACT ERROR MESSAGE.   The odds are very very high that it has been asked and answered here before.

barry manilow

unread,
Jun 5, 2024, 12:25:59 PM6/5/24
to weewx-user
Yes, it was a permissions issue. Thanks for the info.
I checked serial/USB adapter permissions using
ls- l /dev/ttyS0
and added weewx to the dialout group
sudo usermod -aG dialout weewx
Reply all
Reply to author
Forward
0 new messages