Weewx v5 fresh install Errno 13

335 views
Skip to first unread message

Paul Shepherd

unread,
Jan 30, 2024, 10:03:48 AMJan 30
to weewx-user
Hi

I have seen reports of usb permissions / errno 13 on installs of weewx 5.0

After a fresh install of weewx 5.0 via apt-get on Mint 21.3 xfce I got this error in syslog:

Jan 29 19:38:35 antec300 systemd[1]: Started WeeWX.
Jan 29 19:38:35 antec300 weewxd[2917]: INFO __main__: Initializing weewxd version 5.0.0
Jan 29 19:38:35 antec300 weewxd[2917]: INFO __main__: Command line: /usr/share/weewx/weewxd.py /etc/weewx/weewx.conf
Jan 29 19:38:35 antec300 weewxd[2917]: INFO __main__: Using Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Jan 29 19:38:35 antec300 weewxd[2917]: INFO __main__: Located at /usr/bin/python3
Jan 29 19:38:35 antec300 weewxd[2917]: INFO __main__: Platform Linux-5.15.0-91-generic-x86_64-with-glibc2.35
Jan 29 19:38:35 antec300 weewxd[2917]: INFO __main__: Locale: 'en_GB.UTF-8'
Jan 29 19:38:35 antec300 weewxd[2917]: INFO __main__: Entry path: /usr/share/weewx/weewxd.py
Jan 29 19:38:35 antec300 weewxd[2917]: INFO __main__: WEEWX_ROOT: /etc/weewx
Jan 29 19:38:35 antec300 weewxd[2917]: INFO __main__: Configuration file: /etc/weewx/weewx.conf
Jan 29 19:38:35 antec300 weewxd[2917]: INFO __main__: User module: /etc/weewx/bin/user
Jan 29 19:38:35 antec300 weewxd[2917]: INFO __main__: Debug: 0
Jan 29 19:38:35 antec300 weewxd[2917]: INFO weewx.engine: Loading station type Vantage (weewx.drivers.vantage)
Jan 29 19:38:35 antec300 weewxd[2917]: ERROR weewx.engine: Import of driver failed: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0' (<class 'serial.serialutil.SerialException'>)
Jan 29 19:38:35 antec300 weewxd[2917]: CRITICAL weewx.engine:     ****  Traceback (most recent call last):
...

I solved this by adding a udev rule:

# make Vantage accessible to weewx user
SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea61", GROUP="dialout", MODE="0666"

Hope this might help someone else.

Thanks for a great program and excellent documentation.

paul

matthew wall

unread,
Jan 30, 2024, 10:20:34 AMJan 30
to weewx-user
On Tuesday, January 30, 2024 at 10:03:48 AM UTC-5 pshep...@gmail.com wrote:
I have seen reports of usb permissions / errno 13 on installs of weewx 5.0

I solved this by adding a udev rule:

# make Vantage accessible to weewx user
SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea61", GROUP="dialout", MODE="0666"

paul,

thank you for reporting this.

where did you put your udev rule?

please check the contents of /usr/lib/udev/rules.d/60-weewx.rules

please post the vantage rule from that file.

in your rule, the 'GROUP="dialout"' does nothing, since you also set mode to 0666 (read-write world).

for future reference: 
/usr/lib/udev/rules.d is where packages put rules
/etc/udev/rules.d is where a system administrator puts rulues
that way things in /etc/udev can override things in /usr/lib/udev, while being immune to upgrades.  upgrades are allowed to walk all over /usr/lib/udev, but they are not allowed to touch /etc without prompting or notifying the user.

m

Tom Keffer

unread,
Jan 30, 2024, 10:36:47 AMJan 30
to weewx...@googlegroups.com
Paul, take a look at Issue #917 and see if that solves your problem.

Short answer: check the contents of /etc/default/weewx and make sure it points to Python 3.6 or greater.

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/7294c7e9-95bb-43d4-91b0-ca5fa511a421n%40googlegroups.com.

matthew wall

unread,
Jan 30, 2024, 10:55:24 AMJan 30
to weewx-user
On Tuesday, January 30, 2024 at 10:36:47 AM UTC-5 tke...@gmail.com wrote:
Paul, take a look at Issue #917 and see if that solves your problem.

Short answer: check the contents of /etc/default/weewx and make sure it points to Python 3.6 or greater.

tom, i think you confused issues.  the python2/python3 affects the dpkg version check.  

this issue is about the udev file.  there was a problem with the redhat/suse scriptlet that has been fixed:


the issue in this thread appears to use debian-based install, so something else is going on here.

m

Tom Keffer

unread,
Jan 30, 2024, 1:51:01 PMJan 30
to weewx...@googlegroups.com
Oops. I put it under the wrong thread!

Apologies.

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

Paul Shepherd

unread,
Jan 31, 2024, 3:29:36 AMJan 31
to weewx-user
Hi Matthew

Thanks for the information about the various udev folders which helps me understand their interaction.

I created a file /etc/udev/50-localusb.rules and inserted the rule. Also, inherited from Linux Mint 20.1 running Weewx 4.8, I also have the following line in /etc/udev/descriptive-names.rules

ATTRS{serial}=="1344794749", ATTRS{manufacturer}=="Silicon Labs", SYMLINK+="DavisVP"

and that SYMLINK is created.

/usr/lib/udev/rules.d/60-weewx.rules contains 10+ lines for different stations and includes the following for Vantage:

# davis vantage via usb-serial
SUBSYSTEM=="tty",ATTRS{idVendor}=="10c4",ATTRS{idProduct}=="ea60",MODE="0664",GROUP="weewx",SYMLINK+="vantage"
SUBSYSTEM=="tty",ATTRS{idVendor}=="10c4",ATTR{idProduct}=="ea61",MODE="0664",GROUP="weewx",SYMLINK+="vantage"


The vantage SYMLINK is not being created.

Not sure if I should leave 'as is' or edit 60-weewx.rules and remove 50-localusb.rules

Paul

matthew wall

unread,
Jan 31, 2024, 11:09:41 AMJan 31
to weewx-user
On Wednesday, January 31, 2024 at 3:29:36 AM UTC-5 pshep...@gmail.com wrote:
Hi Matthew

Thanks for the information about the various udev folders which helps me understand their interaction.

I created a file /etc/udev/50-localusb.rules and inserted the rule. Also, inherited from Linux Mint 20.1 running Weewx 4.8, I also have the following line in /etc/udev/descriptive-names.rules

ATTRS{serial}=="1344794749", ATTRS{manufacturer}=="Silicon Labs", SYMLINK+="DavisVP"

and that SYMLINK is created.

/usr/lib/udev/rules.d/60-weewx.rules contains 10+ lines for different stations and includes the following for Vantage:

# davis vantage via usb-serial
SUBSYSTEM=="tty",ATTRS{idVendor}=="10c4",ATTRS{idProduct}=="ea60",MODE="0664",GROUP="weewx",SYMLINK+="vantage"
SUBSYSTEM=="tty",ATTRS{idVendor}=="10c4",ATTR{idProduct}=="ea61",MODE="0664",GROUP="weewx",SYMLINK+="vantage"


The vantage SYMLINK is not being created.

Not sure if I should leave 'as is' or edit 60-weewx.rules and remove 50-localusb.rules

you can keep your 50-localusb.rules.  you might want to consolidate the vpro rule in localusb.rules with the vpro rule in descriptive-names.rules.  or not.  depends on how you like to manage things.  and your weewx.conf must already refer to 'DavisVP'...

if you modify /usr/lib/udev/rules.d/60-weewx.rules, it will be overwritten when you next upgrade weewx, so just leave it.

on your system, is there a /dev/vantage that is a symlink to the usb-serial adapter?  if so, that indicates the weewx.rules in /usr/lib/udev is working.

m

Joseph Verreau

unread,
Feb 10, 2024, 3:05:41 PMFeb 10
to weewx-user
hmm.  this seems to be my issue on installing 5.0.0 following erasing 4.10.  On my own I tried adding weewx user to the wheel group and to sudoers file.  I tried what Matt and Paul were discussing about rule changes and yet I still get the "ERROR weewx.engine: Import of driver failed: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied:"  When I run as root from command line all seems to be good.
Should I do a full report with journal log?

Joe Verreau KMIOKEMO13
Okemos, MI 

Joseph Verreau

unread,
Feb 10, 2024, 3:22:52 PMFeb 10
to weewx-user
p.s. just noticed I'm not getting a symlink for the DavisVP rule but I haven't rebooted since I added that local rule.

Joe Verreau

Joseph Verreau

unread,
Feb 10, 2024, 3:36:30 PMFeb 10
to weewx-user
p.p.s I just noticed that I didn't have the subsystem prefix on my rule.  So my entry in 50-localusb.rules is:
SUBSYSTEM=="tty",ATTRS{serial}=="1344794749", ATTRS{manufacturer}=="Silicon Labs", SYMLINK+="DavisVP"
and I rebooted; altho I still don't have a symlink for /dev/DavisVP
all the same my station is back online, submitting reports to all three configured weather services

Jason Patton

unread,
Feb 19, 2024, 8:47:48 PMFeb 19
to weewx-user
Hello All,
  After trying to pick-up the pieces of a borked upgrade, I just encountered the same 'could not open port /dev/ttyUSB0'.  Entirely possible that I've missed documentation somewhere, but is would seem that weewx, is now running as usr:grp weewx:weewx (which is where the upgrade script borked, setting user permissions)?  My fix was amending permissions on: '/dev/ttyUSB0' to: root:weewx, and weewx started fine.  Until, it tried to write the HTML, where weewx no-longer had permissions.  Upon granting weewx permission to that folder / sub-folders, all seems well.  Thoughts, anyone?

Best regards, Jason.

vince

unread,
Feb 20, 2024, 1:10:27 AMFeb 20
to weewx-user
Is it working now ? What thoughts are you looking for in particular ?

Jason Patton

unread,
Feb 20, 2024, 6:38:46 PMFeb 20
to weewx-user
Hi Vince, et al,
  Yes, all working well.  I was looking at it, from a device permissions point-of-view.  Software weewx, for some reason, no-longer had rights to, in my case /dev/ttyUSB0 (which has been working for 11 years).  Ownership of the device were set to root:dialout (as are the serial ports).  I saw that weewx was running as user weewx (hmm, don't recall that...).  User weewx was a member of group weewx, so amended the device ownership to: root:weewx.

Cheers, Jason.

vince

unread,
Feb 20, 2024, 6:46:22 PMFeb 20
to weewx-user
Good it’s working. Weewx used to run as root so a lot of permission problems didn’t happen previously.

With the switch to running as a unprivileged user, you need to ensure that user can attach to peripherals (your case) or listening ports (some interceptor and sdr users) as well as hook it into your webserver properly. So it’s a little heavier lift in some situations.

For your situation with /dev/ttyUSB0 adding the user weewx runs as to group dialout usually  fixes the issue on a raspi but it really depends on your os and which customizations have been done to it.,.

Reply all
Reply to author
Forward
0 new messages