Airfield Weather Station - Raspberry Pi to weewx to Weather Underground - failing

226 views
Skip to first unread message

Garrick Cruise-Smith

unread,
Oct 3, 2016, 2:04:11 PM10/3/16
to weewx-user
Hi,

All I am a Microlight (ULM) pilot in Kent , England. We set up a weather station using old laptop running Windows 7 , Easywether , wireless hotspot and a Maplin Weather Station -https://www.wunderground.com/personal-weather-station/dashboard?ID=ILINTON4 It worked really well but power issues have killed the project (Solar and Battery can't cope in Winter). I am now trying to get it up and running on a  Raspberry PI . Five months of trying and my incompetence is reaching new heights, I have read every bit of information I can but just can't seem to figure out what is wrong.

Anyone who lives near Kent feel free to change advise for free flight around southern England , I have ten eager pilots who can fly but are as useless as me at working on a PI.

Info : Trying to get PI to connect to Weatherunderground but think there is a permissions problem with USB

pi@weatherPi:~ $ sudo tail -f /var/log/syslog
Oct  3 17:36:21 weatherPi wee_device[807]: fousb: Unable to claim USB interface 0: could not claim interface 0: Operation not permitted
Oct  3 17:37:11 weatherPi wee_device[808]: fousb: driver version is 1.8
Oct  3 17:37:11 weatherPi wee_device[808]: fousb: polling mode is PERIODIC
Oct  3 17:37:11 weatherPi wee_device[808]: fousb: polling interval is 60
Oct  3 17:37:11 weatherPi wee_device[808]: fousb: found station on USB bus=001 device=005
Oct  3 17:37:11 weatherPi wee_device[808]: fousb: Unable to claim USB interface 0: could not claim interface 0: Operation not permitted
Oct  3 17:38:19 weatherPi weewx[813]: engine: Initializing weewx version 3.5.0
Oct  3 17:38:19 weatherPi weewx[813]: engine: Using Python 2.7.9 (default, Sep 17 2016, 20:26:04) #012[GCC 4.9.2]
Oct  3 17:38:19 weatherPi weewx[813]: engine: Platform Linux-4.4.22+-armv6l-with-debian-8.0
Oct  3 17:38:19 weatherPi weewx[813]: engine: Unable to open configuration file /home/pi/weewx.conf


pi@weatherPi:~ $ wee_debug --info
Using verbosity=1, displaying most info
wee_debug output will be sent to stdout(console)
Using configuration file /etc/weewx/weewx.conf
Using database binding 'wx_binding', which is bound to database 'archive_sqlite'
System info
  CPU implementer:        0x41
  Features:               half thumb fastmult vfp edsp java tls
  CPU architecture:       7
  BogoMIPS:               697.95
  Hardware:               BCM2708
  CPU revision:           7
  CPU part:               0xb76
  model name:             ARMv6-compatible processor rev 7 (v6l)
  Serial:                 00000000fa626280
  processor:              0
  CPU variant:            0x0
  Revision:               0002
  Operating system:       debian 8.0
                          Linux weatherPi 4.4.22+ #912 Mon Sep 26 19:00:13 BST 2016 armv6l
  1 minute load average:  0.08
  5 minute load average:  0.02
  15 minute load average: 0.01
General weewx info
  Weewx version 3.5.0 detected.
Station info
  Station type: FineOffsetUSB
  Driver:       weewx.drivers.fousb
Driver info
[FineOffsetUSB]
    # This section is for the Fine Offset series of weather stations.
    # The station model, e.g., WH1080, WS1090, WS2080, WH3081
    model = N96FY
    # How often to poll the station for data, in seconds
    polling_interval = 60
    # The driver to use:
    driver = weewx.drivers.fousb
Currently installed extensions
No extensions installed
Traceback (most recent call last):
  File "/usr/bin/wee_debug", line 402, in <module>
    main()
  File "/usr/bin/wee_debug", line 144, in main
    options.verbosity)
  File "/usr/bin/wee_debug", line 223, in generateDebugInfo
    manager_info_dict = getManagerInfo(config_dict, db_binding_wx)
  File "/usr/bin/wee_debug", line 342, in getManagerInfo
    with weewx.manager.open_manager_with_config(config_dict, db_binding_wx) as dbmanager_wx:
  File "/usr/share/weewx/weewx/manager.py", line 984, in open_manager_with_config
    return open_manager(manager_dict, initialize)
  File "/usr/share/weewx/weewx/manager.py", line 976, in open_manager
    manager_dict['table_name'])
  File "/usr/share/weewx/weewx/manager.py", line 99, in open
    connection = weedb.connect(database_dict)
  File "/usr/share/weewx/weedb/__init__.py", line 66, in connect
    return driver_mod.connect(**db_dict)
  File "/usr/share/weewx/weedb/sqlite.py", line 44, in connect
    return Connection(database_name=database_name, SQLITE_ROOT=SQLITE_ROOT, **argv)
  File "/usr/share/weewx/weedb/sqlite.py", line 100, in __init__
    raise weedb.OperationalError("Attempt to open a non-existent database %s" % self.file_path)
weedb.OperationalError: Attempt to open a non-existent database /var/lib/weewx/weewx.sdb

vince

unread,
Oct 3, 2016, 2:19:16 PM10/3/16
to weewx-user
I googled for "Unable to claim USB interface 0: could not claim interface 0: Operation not permitted" and found a 2013 threadd here saying permissions indeed.
https://groups.google.com/forum/#!topic/weewx-user/mvV-0o9hLgI

(hint - try 'sudo' on a pi almost always, you are running as a non-privileged user by default on a pi)

Garrick Cruise-Smith

unread,
Oct 3, 2016, 2:47:20 PM10/3/16
to weewx-user
Hi , Vince this is helpful. I think I am confused as  thought PI user ID had full privileges, weewx folder seems to have full read write access. Do I need to set up another user to allow USB comms ?

rw-r--r--  1 root root     771 Jun  9  2012 staff-group-for-usr-local
-rw-r--r--  1 root root     291 Sep 23 03:52 subgid
-rw-------  1 root root     272 Sep 23 03:49 subgid-
-rw-r--r--  1 root root     291 Sep 23 03:52 subuid
-rw-------  1 root root     272 Sep 23 03:49 subuid-
-r--r-----  1 root root     697 Sep 23 02:38 sudoers
drwxr-xr-x  2 root root    4096 Sep 23 02:37 sudoers.d
-rw-r--r--  1 root root    2084 Mar  6  2015 sysctl.conf
drwxr-xr-x  2 root root    4096 Sep 23 02:37 sysctl.d
drwxr-xr-x  6 root root    4096 Sep 23 02:23 systemd
drwxr-xr-x  2 root root    4096 Sep 23 02:21 terminfo
-rw-r--r--  1 root root      14 Sep 23 04:14 timezone
drwxr-xr-x  2 root root    4096 Sep 23 03:38 timidity
drwxr-xr-x  2 root root    4096 Sep 17 20:20 tmpfiles.d
drwxr-xr-x  3 root root    4096 Sep 23 02:27 triggerhappy
-rw-r--r--  1 root root    1260 May 26  2014 ucf.conf
drwxr-xr-x  4 root root    4096 Sep 23 02:23 udev
drwxr-xr-x  2 root root    4096 Oct  6  2014 udisks2
drwxr-xr-x  3 root root    4096 Sep 23 02:33 ufw
-rw-r--r--  1 root root     888 Aug 18  2014 usb_modeswitch.conf
drwxr-xr-x  2 root root    4096 Apr 14  2015 usb_modeswitch.d
-rw-r--r--  1 root root      51 Jan 12  2016 vdpau_wrapper.cfg
drwxr-xr-x  2 root root    4096 Sep 23 02:24 vim
drwxr-xr-x  4 root root    4096 Sep 23 03:52 vnc
drwxr-xr-x  7 root root    4096 Oct  3 15:45 weewx
-rw-r--r--  1 root root    4812 Sep 17 18:33 wgetrc
drwxr-xr-x  2 root root    4096 Sep 23 02:56 wildmidi
drwxr-xr-x  2 root root    4096 Sep 23 02:39 wpa_supplicant
drwxr-xr-x 11 root root    4096 Sep 23 03:36 X11
drwxr-xr-x 10 root root    4096 Sep 23 02:56 xdg
drwxr-xr-x  2 root root    4096 Sep 23 02:37 xml
drwxr-xr-x  2 root root    4096 Sep 23 02:56 xpdf
pi@weatherPi:/etc $ sudo nano /etc/usb_modeswitch.conf

mwall

unread,
Oct 3, 2016, 3:53:01 PM10/3/16
to weewx-user
On Monday, October 3, 2016 at 2:47:20 PM UTC-4, Garrick Cruise-Smith wrote:
Hi , Vince this is helpful. I think I am confused as  thought PI user ID had full privileges, weewx folder seems to have full read write access. Do I need to set up another user to allow USB comms ?


garrick,

by default, only the root user can use a usb device.

what are your options?

- run the command as root.  in this case, running weewx as a daemon at system startup does this automatically for you.

- run the command using sudo.  this works fine for one-off, setup, and experimentation. 

- embed sudo in scripts.  this can be tricky, unless you configure sudo to not need a password.  see the sudo docs for how this is done.

- use a udev rule to change permissions on the usb device.  see the appropriate .rules file in the util/udev directory of the weewx distribution for examples.

there is a wiki entry about how to run weewx as a non-root user:

https://github.com/weewx/weewx/wiki/Run%20as%20a%20non%20root%20user

normally it is not a problem to run weewx as root, but if you need to harden the system, creating a separate weewx user can be a good thing.

m

vince

unread,
Oct 3, 2016, 4:07:56 PM10/3/16
to weewx-user
On Monday, October 3, 2016 at 12:53:01 PM UTC-7, mwall wrote:
normally it is not a problem to run weewx as root, but if you need to harden the system, creating a separate weewx user can be a good thing.



Garrick - if you want to concentrate on other stuff like flying, just running it as-is will probably be your lowest blood pressure option...

Short answer is the pi os defaults to a non-privileged account 'pi' as you have found out.  So when you run commands manually on the pi that 'need' privileges, you just need to preface your command with 'sudo' to make that command (only) run with privileges.  The startup files for weewx do this for you because the startup sequence runs as the privileged user 'root'.  At the keyboard you need to do it yourself.

weewx is a little unusual these days in that it runs as root rather than a non-privileged account of its own, so when the startup scripts etc. run at system bootup there aren't any of those kinds of permission issues.  It's a little different approach, with some historical reasons I guess behind it that aren't worth going into.



Garrick Cruise-Smith

unread,
Oct 3, 2016, 4:41:00 PM10/3/16
to weewx-user
Vince,

Going to have a go at manually kicking it off with Sudo and see if that helps , seeing some life on the Weatherstation will give me the will to persevere :)... p.s. If you live anywhere in Southern England or Kent you have a instant free flight in the bag. Seeing the weather at the airfield before we set off down is pretty important for us , saves us loads of time driving :)

Garrick Cruise-Smith

unread,
Oct 4, 2016, 2:40:47 AM10/4/16
to weewx-user
All / Vince,

Must be painful dealing with simple questions, a problem I have struggled with for months just got solved thanks to finally understanding the relationship between Sudo giving permission to PI user ID over not. As such (below) that is my weather station talking to my Raspberry PI , hopefully back online in the next few days. Vince is several thousand miles from me but I would happily take him up , hopefully one day he will come home to "Blighty" :)

pi@weatherpi:~/weather $ sudo pywws-testweatherstation
06:33:44:pywws.Logger:pywws version 16.08.0, build 1361 (ca4543e)
0000 55 aa 80 10 20 bc 76 04 60 e1 0a fb 9f 1e f5 12 0f 00 08 20 41 00 00 00 00 7f 00 f0 0f 00 e0 5b
0020 7b 27 c7 27 00 00 00 00 00 00 00 14 02 28 06 30 41 23 c8 00 00 00 46 2d 2c 01 64 80 c8 00 00 00
0040 64 00 64 80 a0 28 80 25 a0 28 80 25 00 6f 00 00 df 00 00 0a 00 f4 01 12 00 00 00 00 00 00 00 64
0060 04 60 5c 14 63 10 92 01 00 00 5d 01 11 80 5d 01 11 80 e2 00 5a 80 1d 28 5d 26 ca 28 4e 26 7e 00
0080 b1 00 42 00 f6 00 41 01 5b 02 5c 01 00 14 01 01 12 23 14 01 01 18 31 14 01 07 04 00 14 01 06 16
00a0 32 14 01 18 16 54 14 01 03 03 57 14 01 18 13 31 14 01 03 02 25 14 01 18 13 31 14 01 03 02 25 14
00c0 02 07 07 42 14 01 06 16 32 14 01 03 04 39 16 07 01 14 13 14 01 03 04 39 16 07 01 14 13 16 05 31
00e0 02 17 16 05 31 02 17 16 06 23 05 40 16 06 23 18 31 16 06 23 18 31 16 06 30 08 05 14 02 25 00 48
pi@weatherpi:~/weather $

Andrew Milner

unread,
Oct 4, 2016, 3:42:25 AM10/4/16
to weewx-user
Garrick - what do you fly - 3axis or flexi?  If the former you may find me dropping in to Kent when next in UK -  I let my licence lapse as there is no microlighting here in cyprus ....

Andrew
Reply all
Reply to author
Forward
0 new messages