OWFS on a Raspberry Pi

I have an old Raspberry in my Stevenson screen and I’d quite like to hook it up to my 1-wire weather sensors rather than running the 1-wire connection into the observatory to my desktop system there. OWFS looks like it might be a sensible way to get access to the data from all the devices, but it has taken me a while to work out how to get it all set up under Raspbian 10. I have owfs working on my Mint 19 64-bit Intel desktop, so I didn’t think it should be too hard to get set up having done it once.

For the moment I just have a DS2490R plugged in on one of the RPi USB ports. I thought I’d try to get it to show that then I’d be in a good place as regards connecting up all the sensors.

I installed all the owfs packages just using

sudo apt-get install owfs

and then had to get my head around the /etc/owfs.conf configuration file. The syntax is a little unexpected in that it allows the specification of values that apply to all of the OWFS components (owserver, owfs, owhttpd, owftpd) or specifically one of them, or all but one of them, but once you’ve got your head around it then it’s not too bad.

No matter what though, I couldn’t get owserver to start. After much grovelling in search engines I found that the solution was to edit the systemd configuration for owserver using

systemctl edit owserver

and enter the following to override the existing configuration:

[Service]
ExecStart=
ExecStart=/usr/bin/owserver -c /etc/owfs.conf --foreground

[Install]
Also=

That effectively removes the existing ExecStart setting and recreates the same line with the addition of the “–foreground” parameter. I’m unconvinced the “[Install]” section actually does anything, but it doesn’t seem to harm anything either.

This allowed me to get owserver running with

systemctl start owserver

When I started owfs in a similar way, I discovered that in the filesystem it created I had multiple copies (sometimes I managed up to four!) of the device node for my DS2490R. Eventually I guessed that owfs must be reading the configuration file multiple times and processing the device once for each, or talk to the server multiple times with the same result. Looking at the common actually running, the parameter -c /etc/owfs.conf did indeed appear multiple times on the command line when it was only present once in the systemd configuration. To clean that up I edited the configuration file:

systemctl edit owfs

And entered:

[Service]
RuntimeDirectoryMode=0755
ExecStart=
ExecStart=/usr/bin/owfs %t/owfs
ExecStop=
ExecStop=/bin/umount %t/owfs

to remove the reference to the configuration file altogether. The last two lines correct the umounting of the filesystem on exit as the default configuration called /usr/bin/umount, which doesn’t exist.

Restarting owfs then gave me what I’d been hoping for in the first place:

$ ls /run/owfs
81.0F9C3A000000  bus.0  settings  statistics  structure  system  uncached

(the first entry being the device node for the DS2490R).

Now I need to start thinking about how I’m going to set everything else up, but for a start I could just connect the 1-wire kit into the DS2490R and see what happens.

For reference, the configuration lines I have in my /etc/owfs.conf file now are:

!server: server = localhost:4304
owfs: allow_other
http: port = 2121
ftp: port = 2120
server: usb

The allow_other option should allow non-root access to the device files. I have also edited /etc/fuse.conf to add

user_allow_other

which I believe is also required.

This entry was posted in Computing, Linux, Raspberry Pi and tagged . Bookmark the permalink.

2 Responses to OWFS on a Raspberry Pi

  1. Chris Lyon says:

    Excellent article.

  2. aew says:

    Many thanks. Nothing else I tried got owfs started. This worked for me exactly as you say. Both my systemctl files you edit did not initially exist for me. ( I was upgrading from a pi2 to a pi4 with a replacement os using a ds2482-800 ).

Leave a Reply

Your email address will not be published. Required fields are marked *