Category Archives: 1-Wire

Arch Linux and 1-Wire on a Seagate DockStar

Outline for now. This is currently improcess, but I’ve made much more progress than shown below – I now have all but the data logging/graphing set up and everything autostarts with new systemd service files. Yay!

Reinstall latest Arch following instructions.

Modifications to that installation process:

  • Create the system partition as ext3 instead using mke2fs -j /dev/sda1 and make sure the boot loader knows to use ext3:/usr/sbin/fw_setenv usb_rootfstype ext3
  • Perform the fw_setenv mods for rootdelay and an additional stop/start on usb drive/bus (figured this out the last time, required to ensure the usb drive will come ready before the DockStar tries to boot from it) /usr/sbin/fw_setenv usb_rootdelay 10 (should experiment to see if this can be reduced with the next item in place) and /usr/sbin/fw_setenv bootcmd 'usb start; usb stop; usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run rescue_bootcmd; run pogo_bootcmd; reset'. Otherwise the DockStar may boot into the original PogoPlug OS instead.

Change root password. Update hostname and locale per instruction at Arch Beginner’s Guide (HW reboot required for hostname to take effect)

update system: pacman -Syu

Install owfs, lighttpd, FastCGI and PHP: pacman -S owfs lighttpd fcgi php php-cgi (digitemp not available as a package yet, see AUR)

Set up lighttpd (including PHP and fcgi support, but DO NOT make the first set of mods shown right under the FastCGI heading, this is to enable Ruby on Rails but is incomplete and will bork the server start-up)

Set up passwordless login via key:

On your local machine, copy over your local public key to the new server using
user@localmachine ~ $ ssh-copy-id root@remotemachine
root@remotemachine's password:
Now try logging into the machine, with "ssh 'root@remotemachine'", and check in:

~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

Modify /etc/ssh/sshd_config to disable password authentication (without this, the passwordless authentication will work, but others could still try to log in with the root password):
PasswordAuthentication no
ChallengeResponseAuthentication no
PubkeyAuthentication yes

and restart the sshd service:
systemctl restart sshd

Future:

  • Get owfs suite working and create the proper config and daemon files to have it autostart and keep running [DONE, details to be added here – but all the magic happens via /etc/systemd/system].
  • Create web page(s) to autodisplay the local 1-wire sensors data as well as interesting data from a chosen wunderground feed [DONE, using the json API for wunderground, details to be added here].
  • Automate the data collection and graphing for sensors. [PENDING]

1-Wire/owfs on Seagate Dockstar under PlugApps Linux

This post is currently just a set of notes as I blaze the trail to get this working. Ignore for now, unless you like just reading random technical thoughts from someone puzzling their way through something they don’t know a lot about… I’ve started a true step-by-step description at the end below as I make my way through this for a second time. Hopefully this will be completed and cleaned up shortly.

PlugApps is based on Arch Linux, follows their start-up sequence – which is loosely based on BSD’s. The file /etc/rc.conf is where a lot of the main settings are made. Daemons are initiated based on an array entered at the bottom of that file. The daemons exist as bash scripts in the directory /etc/rc.d . Config files and similar stuff appear to be are normally set/stored in /etc/___. See here and here for the Arch info.

The owfs package now created for PlugApps includes the owfs core application/commands PLUS temploggerd but only creates the related option and template files for temploggerd. No similar files are created for the core owfs stuff. Currently have verified that owserver and owhttpd can be started with the applicable options from command line and those basically work.

Next steps:

  • figure out the option/config files for owserver, etc. under PlugApps based on prior work with NSLU2 (these were in /opt/etc/owfs there)
  • does my application require FUSE and the sensor array to be mounted as a file system? (A: YES, it is handy and by using owserver as a front end it does not cause a burden.) if not, skip owfs itself, otherwise script creation of /tmp/1wire and do related stuff to make the array available (A: will need to script this, it will be part of the rc.d script).
  • figure out temploggerd operation – can it be verified without web server access at start? (A: Yes, but web server is now set up)
  • determine what web server to use – thttpd? something light weight but secure! (A: Cherokee is available, installed easily and works well with little load on server. Plus is it has a GUI for admin!)
  • generate temploggerd templates (reclaim from NSLU2 installation?), or do I want to use another prettier graphing toolset like http://dygraphs.com/? (A: stay with temploggerd for now)
  • make the system survive a power outage -> install (what?) to NAND? or simply configure a static IP locked to MAC address on router and reboot from pogo OS if stuck?

Misc. Info:
From default installation of the owfs package on PlugApps:

[root@chicago /]# find . -name *emplog*
./usr/share/temploggerd
./usr/share/temploggerd/templates/README.temploggerd.templ
./usr/bin/temploggerd
./usr/lib/temploggerd
./usr/lib/temploggerd/temploggerd.conf.wrt54g
./usr/lib/temploggerd/temploggerd.conf.coldfire
./usr/lib/temploggerd/temploggerd.conf.default
./usr/lib/temploggerd/temploggerd.conf.ewrt54g
./usr/lib/temploggerd/temploggerd.conf.openwrt
[root@chicago /]# find . -name owfs*
./usr/include/owfs_config.h
./usr/share/man/man5/owfs.conf.5.gz
./usr/share/man/man5/owfs.5.gz
./usr/share/man/man1/owfs.1.gz
./usr/bin/owfs
./var/lib/pacman/sync/aur/owfs-2.8p7-1
./var/lib/pacman/local/owfs-2.8p7-1.2
./var/cache/pacman/pkg/owfs-2.8p7-1-any.pkg.tar.xz
./var/cache/pacman/pkg/owfs-2.8p7-1.2-any.pkg.tar.xz
[root@chicago /]# find . -name owft*
./usr/share/man/man1/owftpd.1.gz
./usr/bin/owftpd
[root@chicago /]# find . -name owht*
./usr/share/man/man1/owhttpd.1.gz
./usr/bin/owhttpd
[root@chicago /]# find . -name owse*
./usr/share/man/man1/owserver.1.gz
./usr/bin/owserver
[root@chicago /]#

How to Install PlugApps Linux on a Seagate Dockstar and Enable owfs and temploggerd

  1. Obtain ssh access for your Dockstar
  2. Perform basic installation of PlugApps
  3. Update pacman itself:

  4. [root@Plugbox ~]# pacman -Syu
    :: Synchronizing package databases...
    core 35.5K 172.4K/s 00:00:00 [######################] 100%
    extra 382.1K 457.7K/s 00:00:01 [######################] 100%
    community 371.6K 489.2K/s 00:00:01 [######################] 100%
    aur 5.9K 146.4K/s 00:00:00 [######################] 100%
    :: The following packages should be upgraded first :
    pacman
    :: Do you want to cancel the current operation
    :: and upgrade these packages now? [Y/n] Y
    resolving dependencies...
    looking for inter-conflicts...
    Targets (1): pacman-3.5.1-1.2
    Total Download Size: 0.79 MB
    Total Installed Size: 2.72 MB
    Proceed with installation? [Y/n] Y
    :: Retrieving packages from core...
    pacman-3.5.1-1.2-arm 804.7K 583.5K/s 00:00:01 [######################] 100%
    checking package integrity...
    (1/1) checking for file conflicts [######################] 100%
    (1/1) upgrading pacman [######################] 100%
    >>> The pacman database format has changed as of pacman 3.5.0.
    >>> You will need to run `pacman-db-upgrade` as root.
    >>>
    !!!!!! SERIOUSLY! Run pacman-db-upgrade or PACMAN WILL NOT WORK! !!!!!!
    [root@Plugbox ~]# pacman-db-upgrade
    ==> Pre-3.5 database format detected - upgrading...
    ==> Done.

  5. The Dockstar does not have a hardware clock, so it will always be off at start up unless you take action to fix that. The easiest way is to set up a network time protocol client. Install openntpd (automatic time sync client) and start it before the password change below, to avoid lockout due to password aging (30+ years will seem to have passed between the default date in 1970 and now).
  6. Change ssh login password for security (optional: install ssh public key in ~/.ssh/authorized_keys for more security [+ disable password authentication in /etc/sshd_config for even more security & to avoid having to type in your (long, strong) password])
  7. Install ddclient if you are going to want to access the machine over the internet with a DHCP address.

Now that we have the Dockstar basically set up and functioning under PlugApps, we can move on to the 1-Wire and owfs related items. (more to come…)
[root@chicago ~]# owserver -F -s 4304 -d /dev/ttyUSB0
[root@chicago ~]# owhttpd -F --readonly -s 4304 -p 3001
[root@chicago ~]# mkdir /tmp/1wire
[root@chicago ~]# owfs -F -s 4304 /tmp/1wire
[root@chicago ~]# ls /tmp/1wire

Post-install: disable telnet under pogoplug os, in case of PlugApps reboot failure (provide details here – did enabling ssh via pogoplug portal already do this?)