Upgraded to V5 - will not run automaticly

395 views
Skip to first unread message

G7LTT

unread,
May 5, 2024, 3:39:03 PM5/5/24
to weewx-user
So I upgraded to V5.0.4 from 4.whatever and it looked like everything went ok. But then about an hour later I noticed that the web pages were not being updated.  Off to the logs I go - nothing in the logs.

Hmmnnn. OK, time to run it manually at the command line to see if it spews anything out. Nope, works perfectly. I can leave "weewxd" running for hours without any error. And the pages get updated/uploaded etc etc etc. What gives?

I am running Weewx in an LXC container on Proxmox in my homelab system. I have the Ambient WS2000 API installed (rather than talk to the station it collects the station data from Ambient themselves). 

V4 was running as expected in daemon mode. It would survive a reboot/restart of the machine and the container. V5? Not so much. But there are no entries in the log files for it which is making me suspicious.

Any ideas?

  

vince

unread,
May 5, 2024, 4:53:16 PM5/5/24
to weewx-user
We can't read minds.   Need to see actual logs with debug=1 set in weewx.conf and ideally your weewx.conf file as well.

The usual error tends to be permissions accessing the hardware or the network itself.   Considering you're running a somewhat unusual setup you might want to provide a way for folks to try to look at what you might be missing within your container image.


G7LTT

unread,
May 6, 2024, 6:41:42 PM5/6/24
to weewx-user
And that's one of the issues. No logs are being written. /var/log/syslog has nothing and neither does/var/log/weewx/weexd.log. The debug=1 setting is set.

This was working just fine under V4 so I can't believe its to do with things like perms.

"running a somewhat unusual setup"? I assume you have no other users runing weewx in a container? Makes total sense to do it that way when you think about it. Even on an RPi. Why waste a whole machine on such a trivial task?

I'll take another swing at it. see if I can't get some logging going.

Mark

Tom Keffer

unread,
May 6, 2024, 7:02:57 PM5/6/24
to weewx...@googlegroups.com
A major change between V4 and V5 is daemon and file ownerships. By default, V5 runs as user "weewx", not "root."

Be sure to check the Upgrade Guide!


--
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/0a125bbf-e4ca-429a-a7ea-6af232e67bb7n%40googlegroups.com.

G7LTT

unread,
May 6, 2024, 7:06:34 PM5/6/24
to weewx-user
Seems "permissions" were indeed the issue? Found this in the journal ...

ay 06 22:57:01 WeeWX weewxd[3570]: INFO weewx.restx: AWEKAS: Published record 2024-05-06 22:55:00 UTC (1715036100)
May 06 22:57:00 WeeWX weewxd[3570]: INFO weewx.reportengine: Copied 0 files to /var/www/html/
May 06 22:57:00 WeeWX weewxd[3570]: INFO weewx.imagegenerator: Generated 0 images for report StandardReport in 0.04 seconds
May 06 22:57:00 WeeWX weewxd[3570]: ERROR weewx.imagegenerator: Unable to save to file '/var/www/html/dayuv.png' [Errno 13] Permiss>
May 06 22:57:00 WeeWX weewxd[3570]: ERROR weewx.imagegenerator: Unable to save to file '/var/www/html/dayradiation.png' [Errno 13] >
May 06 22:57:00 WeeWX weewxd[3570]: ERROR weewx.imagegenerator: Unable to save to file '/var/www/html/daywindvec.png' [Errno 13] Pe>
May 06 22:57:00 WeeWX weewxd[3570]: ERROR weewx.imagegenerator: Unable to save to file '/var/www/html/daywinddir.png' [Errno 13] Pe>
May 06 22:57:00 WeeWX weewxd[3570]: ERROR weewx.imagegenerator: Unable to save to file '/var/www/html/dayinside.png' [Errno 13] Per>
May 06 22:57:00 WeeWX weewxd[3570]: ERROR weewx.imagegenerator: Unable to save to file '/var/www/html/daywind.png' [Errno 13] Permi>
May 06 22:57:00 WeeWX weewxd[3570]: ERROR weewx.imagegenerator: Unable to save to file '/var/www/html/dayrx.png' [Errno 13] Permiss>
May 06 22:57:00 WeeWX weewxd[3570]: ERROR weewx.imagegenerator: Unable to save to file '/var/www/html/dayrain.png' [Errno 13] Permi>
May 06 22:57:00 WeeWX weewxd[3570]: ERROR weewx.imagegenerator: Unable to save to file '/var/www/html/dayhumidity.png' [Errno 13] P>
May 06 22:57:00 WeeWX weewxd[3570]: ERROR weewx.imagegenerator: Unable to save to file '/var/www/html/daytempchill.png' [Errno 13] >
May 06 22:57:00 WeeWX weewxd[3570]: ERROR weewx.imagegenerator: Unable to save to file '/var/www/html/daytempdew.png' [Errno 13] Pe>
May 06 22:57:00 WeeWX weewxd[3570]: ERROR weewx.imagegenerator: Unable to save to file '/var/www/html/daybarometer.png' [Errno 13] >
May 06 22:57:00 WeeWX weewxd[3570]: PermissionError: [Errno 13] Permission denied: '/var/www/html/NOAA/NOAA-2024-05.txt.tmp'
May 06 22:57:00 WeeWX weewxd[3570]:          ^^^^^^^^^^^^^^^^^^^^^^^^
May 06 22:57:00 WeeWX weewxd[3570]:     with open(tmpname, mode='wb') as fd:
May 06 22:57:00 WeeWX weewxd[3570]:   File "/usr/share/weewx/weewx/cheetahgenerator.py", line 371, in generate

But yet not in there in the console. I guess something changed in versions with the user? 

G7LTT

unread,
May 6, 2024, 7:08:02 PM5/6/24
to weewx-user
Aha!

JINX!!

We responded with more-or-less the same thing at the same time.

Looking now at users perms etc.

G7LTT

unread,
May 6, 2024, 7:20:47 PM5/6/24
to weewx-user
Yep, that was it. User perms. chmod'd /var/html/www/ files to weewx:weewx and its working as expected now.

Thanks!!!

If you are at all interested I can write up how to do this on an LXC container. Its trivial really, Not at all unlike doing it on a "normal" machine. Prolly the dame for Docker too (but I have no Docker experience)?

Mark

vince

unread,
May 6, 2024, 8:31:51 PM5/6/24
to weewx-user
No, I was referring to LXC in proxmox. Lots of folks do vanilla docker. Glad you got it working.

A start to finish writeup for building a LXC setup would be a nice thing if you have time. If you do it, just assume proxmox is already installled and ready to use, Thanks!

G7LTT

unread,
May 7, 2024, 8:25:29 PM5/7/24
to weewx-user
It was a slow day at work :)

See attached

WeeWX on Proxmox.pdf

Graham Eddy

unread,
May 7, 2024, 11:30:30 PM5/7/24
to WeeWX User
as the doc hinted, putting proxmox itself aside, install/run weewx in LXC unprivileged container is the same as running it outside a container, with the benefit of it not being able to trample on rest of host

the tricky parts are where the container walls are visible, the two principal cases being
 * direct access to a device file
 * mapping uid/gid inside container to outside

i run a number of unprivileged containers on proxmox server ballina, each with their own IP addresses, including ns1 running dnsmasq, broker running mosquitto and wx running weewx.
wx runs several instances (stations) of weewx, all sharing same venv. the weewx station vantage is, you guessed it, a vp2 running off usb/serial port, so we have a device file. the host device file has to be mapped into the container as a device file.
(note that i use usual weewx pattern - user weewx in group dialout, device file group-owned by dialout)

some proxmox magic i should mention for the config below to make sense: a uid/gid of nnn inside a container appears as 100,000+nnn on host outside container

graham@ballina:~$ cat /etc/udev/rules.d/99-usb-serial.rules 

#99-usb-serial.rules####################################################


########################################################################

# two serial ports on one USB FTDI adapter.

# owned by 'wx' container wherein:

#   * wx.dialout is gid 100020

########################################################################

SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", GROUP="100020", MODE="0660"

#not required to distinguish ports######################################


graham@ballina:~$ sudo cat /etc/pve/lxc/105.conf

#weewx server

#

#| mappings | host view                   | container view              |

#| %3A---     | %3A---                        | %3A---                        |

#| tty      | /dev/ttyUSB0 660 - (100020) | /dev/aqua 660 - dialout(20) |

#| tty      | /dev/ttyUSB1 660 - (100020) | /dev/vp2 660 - dialout(20)  |

arch: amd64

cores: 1

features: nesting=1

hostname: wx

memory: 512

net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=b2:8d:88:67:d1:bf,ip=dhcp,type=veth

onboot: 1

ostype: debian

rootfs: local-lvm:vm-105-disk-0,size=8G

swap: 512

unprivileged: 1

lxc.cgroup2.devices.allow: c 188:* rwm

lxc.mount.entry: /dev/ttyUSB0 dev/aqua none bind,optional,create=file

lxc.mount.entry: /dev/ttyUSB1 dev/vp2 none bind,optional,create=file


the last few lines of the container config file are too advanced for the helpful proxmox GUI so need to be added by hand.
user weewx in container wx sees device /dev/vp2

proxmox is excellent for partitioning a host into many servers and minimising “breakouts”. containers are extremely resource efficient (e.g. share host’s kernel image). virtual machines are also supported but they are resource monsters.
last time i checked, proxmox on RPi is unstable - do not use RPi as the metal. i am using an apple mac mini from 2012, no hardware add-ons.
cheers
⊣GE⊢

Graham Eddy

unread,
May 8, 2024, 12:11:27 AM5/8/24
to WeeWX User
proxmox - looking from inside the wx container mentioned in previous email.
(note that i am running satellite mailer daemon in the container too.)

(venv) graham@wx:~$ ps -ef

UID          PID    PPID  C STIME TTY          TIME CMD

root           1       0  0 Feb20 ?        00:00:31 /lib/systemd/systemd --syste

root          48       1  0 Feb20 ?        00:36:34 /lib/systemd/systemd-journal

root          99       1  0 Feb20 ?        00:00:00 dhclient -4 -v -i -pf /run/d

systemd+     103       1  0 Feb20 ?        00:00:05 /lib/systemd/systemd-network

root         132       1  0 Feb20 ?        00:00:08 /usr/sbin/cron -f

message+     133       1  0 Feb20 ?        00:00:04 /usr/bin/dbus-daemon --syste

root         139       1  0 Feb20 ?        00:00:07 /lib/systemd/systemd-logind

root         163       1  0 Feb20 pts/0    00:00:00 /sbin/agetty -o -p -- \u --n

root         164       1  0 Feb20 pts/1    00:00:00 /sbin/agetty -o -p -- \u --n

root         165       1  0 Feb20 pts/2    00:00:00 /sbin/agetty -o -p -- \u --n

root         216       1  0 Feb20 ?        00:00:00 sshd: /usr/sbin/sshd -D [lis

root         309       1  0 Feb20 ?        00:00:17 /usr/lib/postfix/sbin/master

weewx     154403       1  1 Apr09 ?        07:00:53 /home/weewx/venv/bin/python3

weewx     154443       1  1 Apr09 ?        07:00:10 /home/weewx/venv/bin/python3

weewx     233257       1  1 May04 ?        01:27:47 /home/weewx/venv/bin/python3

postfix   246511     309  0 04:02 ?        00:00:00 qmgr -l -t unix -u

postfix   248348     309  0 12:19 ?        00:00:00 pickup -l -t unix -u -c

root      248664     216  0 13:45 ?        00:00:00 sshd: graham [priv]

graham    248668       1  0 13:45 ?        00:00:00 /lib/systemd/systemd --user

graham    248669  248668  0 13:45 ?        00:00:00 (sd-pam)

graham    248678  248664  0 13:45 ?        00:00:00 sshd: graham@pts/3

graham    248679  248678  0 13:45 pts/3    00:00:00 -bash

graham    248682  248679  0 13:45 pts/3    00:00:00 ps -ef


(venv) graham@wx:~$ ls -l /dev

total 0

crw-rw---- 1 nobody dialout 188, 0 Feb 20 00:38 aqua

crwx------ 1 root   tty     136, 0 May  4 10:50 console

lrwxrwxrwx 1 root   root        11 Feb 20 00:40 core -> /proc/kcore

lrwxrwxrwx 1 root   root        13 Feb 20 00:40 fd -> /proc/self/fd

crw-rw-rw- 1 nobody nogroup   1, 7 Feb 20 00:38 full

lrwxrwxrwx 1 root   root        12 Feb 20 00:41 initctl -> /run/initctl

lrwxrwxrwx 1 root   root        28 Feb 20 00:41 log -> /run/systemd/journal/dev-log

drwxrwxrwt 2 nobody nogroup     40 Feb 20 00:40 mqueue

crw-rw-rw- 1 nobody nogroup   1, 3 Feb 20 00:38 null

crw-rw-rw- 1 root   root      5, 2 May  8 13:54 ptmx

drwxr-xr-x 2 root   root         0 Feb 20 00:40 pts

crw-rw-rw- 1 nobody nogroup   1, 8 Feb 20 00:38 random

drwxrwxrwt 2 root   root        40 Feb 20 00:40 shm

lrwxrwxrwx 1 root   root        15 Feb 20 00:40 stderr -> /proc/self/fd/2

lrwxrwxrwx 1 root   root        15 Feb 20 00:40 stdin -> /proc/self/fd/0

lrwxrwxrwx 1 root   root        15 Feb 20 00:40 stdout -> /proc/self/fd/1

crw-rw-rw- 1 nobody nogroup   5, 0 May  8 12:00 tty

crw--w---- 1 root   tty     136, 1 Feb 20 00:41 tty1

crw--w---- 1 root   tty     136, 2 Feb 20 00:41 tty2

crw-rw-rw- 1 nobody nogroup   1, 9 Feb 20 00:38 urandom

crw-rw---- 1 nobody dialout 188, 1 May  8 13:50 vp2

crw-rw-rw- 1 nobody nogroup   1, 5 Feb 20 00:38 zero


and there is no hint i am running 10 other containers beside it.

i should have mentioned earlier that the memory specified for a container is the max allowed - it actually consumes only as much as it needs (with the kernel image being shared). even with all those other containers running, let alone the host’s own requirements, right now the host's resources are hardly used:

graham@ballina:~$ free -m

               total        used        free      shared  buff/cache   available

Mem:            7809        1853         546          11        5748        5956

Swap:           7807         516        7291

graham@ballina:~$ uptime

 14:04:35 up 78 days, 14:26,  1 user,  load average: 0.00, 0.04, 0.10


cheers
⊣GE⊢

G7LTT

unread,
May 8, 2024, 12:30:38 AM5/8/24
to weewx-user
Ah. I see. You are USB based in your hardware. I did not think of that. I run an Ambient WS2000 so the API tool calls out to the Ambient web site and sucks back my data (which the display unit has kindly uploaded). I'll add an "add a USB port" section
Message has been deleted

G7LTT

unread,
May 8, 2024, 7:25:53 AM5/8/24
to weewx-user
Updated to add USB device to the container.
WeeWX in an LXC container on Proxmox V0.2.pdf

Graham Eddy

unread,
May 8, 2024, 7:42:00 AM5/8/24
to WeeWX User
i suggest testing before publishing..
that won’t work without the permissions towards end of my lxc/105.conf file
⊣GE⊢

vince

unread,
May 8, 2024, 8:10:30 PM5/8/24
to weewx-user
I have to admit being a little confused.  A container running multiple processes that you can ssh into isn't a container, it's a virtual machine.

Graham Eddy

unread,
May 8, 2024, 10:36:55 PM5/8/24
to WeeWX User
probably terminology. an LXC ‘container' is not the same as a docker ‘container'.
as i understand it, a docker container is a functional blob dropped onto a machine that talks to the machine through docker API.
an LXC container, on the other hand, is just a slice of the operating system namespace, all the slices sitting side by side as peers.
a VM is more like a docker container where the functional blob is a processor emulator, with a low-level API to hardware abstraction.
an LXC container and a VM, both being "mini machines", are usually provisioned with network interfaces etc otherwise they aren’t much use.
proxmox supports LXC containers and VMs, either of which could run docker inside.
the precise details don't matter here.
cheers
⊣GE⊢

--
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 R Anderson

unread,
May 9, 2024, 9:21:16 AM5/9/24
to weewx...@googlegroups.com
Vince,
Your confusion is probably caused by the enormous popularity of Docker. At this point most of us hear the word Container and only think of Docker. This is also a huge reason why LXC Containers are nowhere near as popular as Docker containers , no one knows they exist, let alone what they are.  
LXC Containers are system containers
Docker Containers are Application containers
There are generally at least two types of containers: Application containers, and System containers
There's a good blog post from Ubuntu that explains it much better than I can.

Brief excerpt from the blog post:

" Application vs system containers
Application containers (such as Docker) are containers running a single process per container. They run stateless types of workloads so that you can ramp up and down as needed – create new containers and delete them at any time. Usually, you don’t need to care about the lifecycle of those containers, as they are meant to be ephemeral.

The other type of containers, system containers, are much closer to a virtual or a physical machine. They run a full operating system inside them, and you manage them exactly as you would a virtual or a physical machine. That means you can install packages inside them, you can manage services, define backup policies, monitoring, and all other aspects as you usually would with a virtual machine. These containers are usually very long-lasting. If you need to update them, you can do so with the normal tooling of the Linux distribution you are using. It also means that you will get normal security updates from distributions for those containers, so you wouldn’t need to wait for any image to be published to get the security fixes. "



Paul

vince

unread,
May 9, 2024, 12:15:06 PM5/9/24
to weewx-user
yup - overloaded terminology.  Sounds a little like running a process under cgroups isolation 15+ years ago.  Looking that up briefly I see the term 'process container' which I guess is the same thing.  Thanks.

G7LTT

unread,
May 10, 2024, 12:40:02 PM5/10/24
to weewx-user
Updated, some spelling errors corrected, 
WeeWX in an LXC container on Proxmox - v0.3.pdf
Reply all
Reply to author
Forward
0 new messages