See the Upgrade Guide section *WeeWX runs as the weewx user
<https://www.weewx.com/docs/5.0/upgrade/#weewx-runs-as-the-weewx-user>*.

On Tue, Feb 6, 2024 at 12:05 PM Mark Conner <[email protected]> wrote:

> By chance, I just read the previous message thread and was able to use
> that to fix my issue.  The issue for me centered around the change from
> running weewx as 'root' in 5.0 and before, to running as user 'weewx' in
> 5.0.1.  I added user 'weewx' to the group 'dialout' so it could access
> /dev/ttyAMA0 and everything works again.
>
> sudo usermod -a -G dialout weewx
>
> I think this change in 5.0.1 from running as 'root' to running as 'weewx'
> needs to be more strongly advertised.  This may be problematic for users
> who upgraded from v4.x and still run weewx as root.
>
> - Mark
>
> On Tuesday, February 6, 2024 at 1:45:35 PM UTC-6 Mark Conner wrote:
>
>> Hi,
>>
>> I recently tried to upgrade my weewx installation from 5.0 to 5.0.1 on my
>> Raspberry Pi 2 using 'sudo apt-get' and afterwards I was unable to start
>> weewxd.  I am reading from a Davis Vantage Pro2 with a serial logger via a
>> MeteoPi interface.  Thinking it was an upgrade problem, I downgraded to
>> 5.0.0 and still have the same issue.  Here are the weewxd related lines
>> from startup from /var/log/syslog:
>>
>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: INFO __main__: Initializing
>>> weewxd version 5.0.0
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: INFO __main__: Command
>>> line: /usr/share/weewx/weewxd.py /etc/weewx/weewx.conf
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: INFO __main__: Using Python
>>> 3.9.2 (default, Mar 12 2021, 04:06:34) #012[GCC 10.2.1 20210110]
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: INFO __main__: Located at
>>> /usr/bin/python3
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: INFO __main__: Platform
>>> Linux-6.1.21-v7+-armv7l-with-glibc2.31
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: INFO __main__: Locale:
>>> 'en_US'
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: INFO __main__: Entry path:
>>> /usr/share/weewx/weewxd.py
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: INFO __main__: WEEWX_ROOT: /
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: INFO __main__:
>>> Configuration file: /etc/weewx/weewx.conf
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: INFO __main__: User module:
>>> /etc/weewx/bin/user
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: INFO __main__: Debug: 0
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: INFO weewx.engine: Loading
>>> station type Vantage (weewx.drivers.vantage)
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: ERROR weewx.engine: Import
>>> of driver failed: [Errno 13] could not open port /dev/ttyAMA0: [Errno 13]
>>> Permission denied: '/dev/ttyAMA0' (<class
>>> 'serial.serialutil.SerialException'>)
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****  Traceback (most recent call last):
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****    File
>>> "/usr/local/lib/python3.9/dist-packages/serial/serialposix.py", line 322,
>>> in open
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****      self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY |
>>> os.O_NONBLOCK)
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****  PermissionError: [Errno 13] Permission denied: '/dev/ttyAMA0'
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****  During handling of the above exception, another exception occurred:
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****  Traceback (most recent call last):
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****    File "/usr/share/weewx/weewx/engine.py", line 115, in setupStation
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****      self.console = loader_function(config_dict, self)
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****    File "/usr/share/weewx/weewx/drivers/vantage.py", line 32, in loader
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****      return VantageService(engine, config_dict)
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****    File "/usr/share/weewx/weewx/drivers/vantage.py", line 2046, in
>>> __init__
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****      Vantage.__init__(self, **config_dict[DRIVER_NAME])
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****    File "/usr/share/weewx/weewx/drivers/vantage.py", line 536, in
>>> __init__
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****      self.port.openPort()
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****    File "/usr/share/weewx/weewx/drivers/vantage.py", line 319, in
>>> openPort
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****      self.serial_port = serial.Serial(self.port, self.baudrate,
>>> timeout=self.timeout)
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****    File "/usr/local/lib/python3.9/dist-packages/serial/serialutil.py",
>>> line 244, in __init__
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****      self.open()
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****    File
>>> "/usr/local/lib/python3.9/dist-packages/serial/serialposix.py", line 325,
>>> in open
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****      raise SerialException(msg.errno, "could not open port {}:
>>> {}".format(self._port, msg))
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL weewx.engine:
>>> ****  serial.serialutil.SerialException: [Errno 13] could not open port
>>> /dev/ttyAMA0: [Errno 13] Permission denied: '/dev/ttyAMA0'
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL __main__: Unable
>>> to load driver: [Errno 13] could not open port /dev/ttyAMA0: [Errno 13]
>>> Permission denied: '/dev/ttyAMA0'
>>> Feb  6 13:29:00 raspberrypi110 weewxd[2836]: CRITICAL __main__:     ****
>>>  Exiting...
>>
>>
>> I did not change anything myself related to /dev/ttyAMA0 in the
>> upgrade/downgrade process.  What is strange is that I can read current data
>> from the VP2 using weectl.
>>
>> pi@raspberrypi110:~ $ sudo weectl device --current
>>> Using configuration file /etc/weewx/weewx.conf
>>> Using driver weewx.drivers.vantage.
>>> Using Vantage driver version 3.6.2 (weewx.drivers.vantage)
>>> Querying the station for current weather data...
>>> 2024-02-06 13:38:37 CST (1707248317) 'barometer': '30.073',
>>> 'consBatteryVoltage': '4.71', 'dateTime': '1707248317', 'dayET': '0.0',
>>> 'dayRain': '0.0', 'extraAlarm1': '0', 'extraAlarm2': '0', 'extraAlarm3':
>>> '0', 'extraAlarm4': '0', 'extraAlarm5': '0', 'extraAlarm6': '0',
>>> 'extraAlarm7': '0', 'extraAlarm8': '0', 'extraTemp1': '35.0',
>>> 'forecastIcon': '7', 'forecastRule': '60', 'inHumidity': '38.0',
>>> 'insideAlarm': '0', 'inTemp': '69.6', 'monthET': '0.0', 'monthRain':
>>> '0.01', 'outHumidity': '74.0', 'outsideAlarm1': '0', 'outsideAlarm2': '0',
>>> 'outTemp': '50.6', 'rain': 'None', 'rainAlarm': '0', 'rainRate': '0.0',
>>> 'soilLeafAlarm1': '0', 'soilLeafAlarm2': '0', 'soilLeafAlarm3': '0',
>>> 'soilLeafAlarm4': '0', 'stormRain': '0.0', 'sunrise': '1707226320',
>>> 'sunset': '1707263280', 'txBatteryStatus': '0', 'usUnits': '1', 'windDir':
>>> '156.0', 'windSpeed': '10.0', 'windSpeed10': '6.0', 'yearET': '0.0',
>>> 'yearRain': '0.02'
>>
>>
>> Below is an ls -l of /dev/ttyAMA0
>>
>>>
>>> pi@raspberrypi110:~ $ ls -l /dev/ttyAMA0
>>> crw-rw---- 1 root dialout 204, 64 Feb  6 13:38 /dev/ttyAMA0
>>
>>
>> Original installation of weewx on this device was approximately 4.8.0.
>>
>> I have tried both a "shutdown -r" and a shutdown/power-cycle in an
>> attempt to clear the error.
>>
>> - Mark
>>
>> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/10e63192-4af5-4b23-9482-bf07a00565b6n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/10e63192-4af5-4b23-9482-bf07a00565b6n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zED0Rbg0z%2BxA8M2Z%3DwX1zutAESqaN3981syaDTRbkf-bLw%40mail.gmail.com.

Reply via email to