openHABianPi Initial Setup

After having fucked up my openHAB installation I had to set up my openHABianPi from scratch and took the opportunity to write down the necessary steps. Mainly for myself, so that next time I wouldn’t have to search for all the different tutorials, always hoping not to forget any of the options I deem necessary…
And perhaps some of you can use this guide in a similar situation - or just as inspiration which options might be useful.


  • Installation
  • Configuration
  • SSD / Grafana / InfluxDB
  • Amanda-Backup
  • git
  • Decluttering the Log



  • connect to your openHABianPi
    • connect via ssh: ssh openhabian@openhab
    • Password: openhabian
  • open openHABian Configuration Tool: sudo openhabian-config
    • Check for updates - run the following options
      • 01 | Update
      • 02 | Upgrade System
      • 10 | Apply Improvements
        • 11 | Packages
        • 12 | Bash&Vim Settings
        • 13 | System Tweaks
        • 14 | Fix Permissions
        • 15 | FireMotD
      • 30 | System Settings
        • 34 | Change Passwords
          • all: you should not use any of the default passwords - do not skip this step because you think you will take care of that one later…
          • test if the password change did work - somehow the Config Tool doesn’t work for me in regard to password changes. If you have the same trouble the following comands should do the trick for you:
            • Linux system: passwd
            • openHAB Console: sudo passwd openhab
            • Samba: sudo smbpasswd openhabian
            • Amanda backup: sudo passwd backup
        • 31 | Change Hostname - choose an individual hostname
          • remember to use the new hostname when you reconnect via ssh
        • 32 | Set System Locale
          • set if you want to change the system language, for example to display weekdays on your sitemaps in your local language
      • 40 | openHAB related
        • 42 Remote Console
          • enter the password for ‘openHAB Console’ you selected during the step ‘Change Passwords’
          • test from a different computer ( stands for the hostname selected in step ‘Change Hostname’): ssh -p 8101 openhab@<hostname>
  • Close openHAB config with ‘ESC’
  • reboot: sudo reboot

SSD / Grafana / InfluxDB

Disclaimer: I’m not using Grafane & InfluxDB anymore since they seem to overwork my Raspi 3B setup (RAM use always at more than 90%, reliability of rule execution way lower than what I’m used to). Might use these tools again in the future if I switch to a more powerfull server :thinking:

If you wish to use Grafana & InfluxDB to persist and display stuff, you might also wish to switch your openHAB system to an external USB drive both both to protect your SD card from wear by to many write cycles and a growing database…
Since USB sticks have the same limitations as SD cards you should choose an USB HDD or SSD. If you consider buying a new HDD / SSD for that purpose I recommend to research a bit in regard to how much power the Raspy can deliver vs what your device needs, if your Raspy is able to boot from USB, if the Raspy is able to boot from your specific HDD / SSD, …
In my case the Raspy is not able to boot from my SSD, so I boot from SD card and have everything else on my SSD.

  • Move root to an SSD
    • connect USB drive to your openHABianPi
    • open openHABian Configuration Tool: sudo openhabian-config
    • 30 | System Settings - 37 | Move root to USB
    • reboot
  • Install Grafana & InfluxDB
    • open openHABian Configuration Tool: sudo openhabian-config
    • 20 | Additional Components - 24 | InfluxDB+Grafana
    • reboot
    • Test Installation by visiting http://<hostname>:3000 and signing in with admin and your adminpwd
    • look into the log to to see if you get InfluxDB related error messages - if yes execute the following commands:
      • sudo chown -hR openhab:openhab /etc/openhab2
      • sudo chown openhab:openhabian /etc/openhab2/services/influxdb.cfg
      • influx -port 8086 -username admin -password myinfluxdbadminpwd -host localhost
      • CREATE DATABASE openhab_db
      • CREATE USER admin WITH PASSWORD 'myinfluxdbadminpwd' WITH ALL PRIVILEGES
      • CREATE USER openhab WITH PASSWORD 'myopenhabpassword'
      • CREATE USER grafana WITH PASSWORD 'mygrafanapassword'
      • GRANT ALL ON openhab_db TO openhab
      • GRANT READ ON openhab_db TO grafana
      • (Found at InfluxDB+Grafana persistence and graphing)
    • Guide for starting with InfluxDB, Grafana & openHAB:


Yes, you want an automated backup!

  • mount a backup drive
    • follow this guide:
    • example:
      • connect to your NAS via SSH (DSM):
      • sudo vim /etc/exports
      • mkdir /volume1/Backup/openHAB
      • append: /volume1/Backup/openHAB <hostname>(rw,async,no_wdelay,crossmnt,no_root_squash,insecure_locks,sec=sys,anonuid=1024,anongid=100)
        • the values for anonuid and anongid can be found under /etc/passwd for the System default user (admin:x:1024:100)
      • sudo exportfs -ra
    • do the following steps on your openHABianPi
      • sudo mkdir /mnt/backup
      • sudo vim /etc/fstab
        • press ‘i’ to insert text
        • Append the following line: <DNS name NAS>://volume1/Backup/openHAB /mnt/backup nfs nouser,atime,auto,rw,dev,exec,suid 0 0
        • press ‘ESC’
        • type ‘:wq’ and press ‘Enter’
      • sudo mount -a
      • sudo chmod 777 /mnt/backup
      • test the mounted folder by creating a file on your Pi and checking the file on your NAS. Than delete the file on your NAS and check on your Pi
  • set up amanda
    • follow this guide:
      • sudo openhabian-config
        • 50 | Backup/Restore
        • 51 | Amanda Backup
          • backup location: /mnt/backup
          • Storage: 1024
    • configure additional folders to be backed up
      • switch to user backup: sudo su - backup
      • vim /etc/amanda/openhab-dir/disklist
      • add: <hostname> /etc/amanda/openhab-dir user-tar
    • test backup
      • currently no backup: amreport openhab-dir
      • run backup: amdump openhab-dir
      • backup report: amreport openhab-dir


My git setup is not traditional, but you should be able to tweak it for your purpose without to much trouble.

Decluttering the log

log4j2.appender.event.filter.ItemStateChangedEvent.type = RegexFilter
log4j2.appender.event.filter.ItemStateChangedEvent.regex = .* changed .*
log4j2.appender.event.filter.ItemStateChangedEvent.onMatch = DENY
log4j2.appender.event.filter.ItemStateChangedEvent.onMisMatch = ACCEPT

Feel free to add the steps for options you deem necessary or let me know about improvements for my post :slight_smile:


One thing missing, though.
Add in a UPS and a driver to properly shutdown the Pi, to reduce the chances of SD card corruption.

1 Like

Add use of ZRAM (install option 38) to mitigate SD card corruption.

1 Like

nice job! Should be updated in the official wiki.

Anyone is free to edit it. :wink:

In the current form it’s more of a work log, I think for the wiki it would need a little bit more polish :thinking:
On the other hand I would appreciate it if someone would take this post as groundwork for a wiki entry :grinning:

I’ve installed OH in this way and it worked great but yesterday my SSD drive broke down :frowning: .

Now I trying to restore backup using amanda but I have no idea how to do it. (I’ve read tutorial but I completly don’t understand it :frowning: )
Could you write how you restore backup?

Hi @Dom_KS,

Thx for your trust - but I have never actually used Amanda to restore after a crash, so I can’t really help you with that.
A quick search in this forum for „Amanda restore“ points you to some posts that might be helpful, for example this one

Then read it again. Twice if needed. Don’t hurry but take your time to understand what’s written.
Yes OH and Amanda expect users to invest a fair minimum of their own time and thinking.
You are welcome to get back here with concrete questions, but not with an overall ‘lazy’ one like this.
And please follow the rules in here:
How to ask a good question / Help Us Help You - Tutorials & Examples - openHAB Community

1 Like

I was directed to use a USB to protect my SD card by BK Hobby but when I tried to execute “Move root to USB” (37)to said that I needed to cancel -uninstall i think- zram.
The video was 2018 and not sure if I should “Uninstall ZRAM” (39) second selection or use it.

I suspect that ZRAM is preferred.

Please advise.

It appears you were directed by somebody else’s video to do something different than the official documentation. Since Markus wrote that documentation I think you have your answer.

Thanks, Bruce

I will follow the documentation instead of Utube since it is likely the Utube is not up to date.

Based on the DOCs, I want to use the Amanda Network Backup automatic mode. The backup storage will be my USB stick

This will be set up to backup everything except the SD card. My understanding is to back up the SD card by removing it from the Pi and copy it directly to another BU SD card. I have only 1 SD card slot on my computer so I plan to copy it to a local disk and then copy to the BU SD chip. Is this correct?

Then in the Amanda auto back-up configuration, I need to know the disk drive that my USB is connected to. I followed the suggested link:, and this was the response to the command: mount -t ext4

/dev/mmcblk0p2 on / type ext4 (rw,noatime)
/dev/mmcblk0p2 on /opt/zram/log.bind type ext4 (rw,noatime)
/dev/zram1 on /opt/zram/zram1 type ext4 (rw,noatime)
/dev/mmcblk0p2 on /opt/zram/persistence.bind type ext4 (rw,noatime)
/dev/zram2 on /opt/zram/zram2 type ext4 (rw,noatime)
/dev/mmcblk0p2 on /srv/openhab2-userdata type ext4 (rw,noatime)
/dev/mmcblk0p2 on /srv/openhab2-conf type ext4 (rw,noatime)
/dev/mmcblk0p2 on /srv/openhab2-addons type ext4 (rw,noatime)
/dev/mmcblk0p2 on /srv/openhab2-sys type ext4 (rw,noatime)

Is the drive in this response? If not, how do I find it?

I understand that I also need to “prepare your storage by creating a directory somewhere and by then mounting the USB device or disk you’ve previously exported (= shared, i.e. made available for mounting) on that directory.”

I have not exported to the the attached disk. My usb is installed. When I execute fdiski -l I got this:
fdisk: cannot open /dev/ram0: Permission denied
fdisk: cannot open /dev/ram1: Permission denied
fdisk: cannot open /dev/ram2: Permission denied
fdisk: cannot open /dev/ram3: Permission denied
fdisk: cannot open /dev/ram4: Permission denied
fdisk: cannot open /dev/ram5: Permission denied
fdisk: cannot open /dev/ram6: Permission denied
fdisk: cannot open /dev/ram7: Permission denied
fdisk: cannot open /dev/ram8: Permission denied
fdisk: cannot open /dev/ram9: Permission denied
fdisk: cannot open /dev/ram10: Permission denied
fdisk: cannot open /dev/ram11: Permission denied
fdisk: cannot open /dev/ram12: Permission denied
fdisk: cannot open /dev/ram13: Permission denied
fdisk: cannot open /dev/ram14: Permission denied
fdisk: cannot open /dev/ram15: Permission denied
fdisk: cannot open /dev/mmcblk0: Permission denied
fdisk: cannot open /dev/sda: Permission denied
fdisk: cannot open /dev/zram0: Permission denied
fdisk: cannot open /dev/zram1: Permission denied
fdisk: cannot open /dev/zram2: Permission denied

Please council me.

The documentation is written by the developers who KNOW, not my some random youtube person guessing.

The third column tells you where the file system is mounted and the penultimate column has the file system type. So you have only ext4 file systems one of which is mounted at / which is the SD card. You’ve a bunch of stuff mounted at /opt/zram and stuff mounted at /srv/openhab2-* which think are all related to zram.

So in short, no, I don’t think the drive is in the response. It doesn’t always automatically mount a new drive when you plug it in, especially when running a lite headless type OS like openHABian does.

You need to run that command as root.

sudo fdisk -l

You will notice that is how that tutorial you linked to runs it too.

This is the SD card I think

This is the external hard drive. So run fdisk as root and it will tell you what type of file system the drive is formatted with. Than you should have the information needed to edit the fstab so it mounts automatically.


I ran fdisk in the root directory and got this:

Disk /dev/sda: 14.5 GiB, 15525216256 bytes, 30322688 sectors
Disk model: USB 2.0 FD
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa5bf9909

I then entered backupdrive=/dev/sda. Then opened the config window "sudo openhabian-config.

I followed the directions for Amanda and got this log:
After this operation, 23.2 MB of additional disk space will be used.
Get:1 buster/main armhf update-inetd all 4.49 [27.8 kB]
Get:2 buster/main armhf tcpd armhf 7.6.q-28 [21.5 kB]
Get:3 buster/main armhf openbsd-inetd armhf 0.20160825-4 [34.3 kB]
Get:4 buster/main armhf liblockfile-bin armhf 1.14-1.1 [18.9 kB]
Get:5 buster/main armhf liblockfile1 armhf 1.14-1.1 [15.3 kB]
Get:6 buster/main armhf exim4-config all 4.92-8+deb10u4 [323 kB]
Err:7 buster/main armhf exim4-base armhf 4.92-8+deb10u4
Connection failed [IP: 2607:fdc0:1::50 80]
Get:8 buster/main armhf libunbound8 armhf 1.9.0-2+deb10u2 [403 kB]
Get:9 buster/main armhf libgnutls-dane0 armhf 3.6.7-4+deb10u5 [315 kB]
Get:10 buster/main armhf exim4-daemon-light armhf 4.92-8+deb10u4 [492 kB]
Get:11 buster/main armhf bsd-mailx armhf 8.1.2-0.20180807cvs-1 [82.4 kB]
Get:12 buster/main armhf amanda-common armhf 1:3.5.1-2+b3 [1,889 kB]
Get:13 buster/main armhf libxml-namespacesupport-perl all 1.12-1 [14.8 kB]
Get:14 buster/main armhf libxml-sax-base-perl all 1.09-1 [20.4 kB]
Get:15 buster/main armhf libxml-sax-perl all 1.00+dfsg-1 [58.6 kB]
Get:16 buster/main armhf libxml-libxml-perl armhf 2.0134+dfsg-1 [322 kB]
Get:17 buster/main armhf liburi-perl all 1.76-1 [89.9 kB]
Get:18 buster/main armhf libencode-locale-perl all 1.05-1 [13.7 kB]
Get:19 buster/main armhf libtimedate-perl all 2.3000-2+deb10u1 [38.1 kB]
Get:20 buster/main armhf libhttp-date-perl all 6.02-1 [10.7 kB]
Get:21 buster/main armhf libfile-listing-perl all 6.04-1 [10.3 kB]
Get:22 buster/main armhf libhtml-tagset-perl all 3.20-3 [12.7 kB]
Err:23 buster/main armhf libhtml-parser-perl armhf 3.72-3+b2
Connection failed [IP: 2607:fdc0:1::50 80]
Get:24 buster/main armhf libhtml-tree-perl all 5.07-2 [213 kB]
Get:25 buster/main armhf libio-html-perl all 1.001-1 [17.6 kB]
Get:26 buster/main armhf liblwp-mediatypes-perl all 6.02-1 [22.1 kB]
Get:27 buster/main armhf libhttp-message-perl all 6.18-1 [77.8 kB]
Get:28 buster/main armhf libhttp-cookies-perl all 6.04-1 [17.8 kB]
Err:29 buster/main armhf libhttp-negotiate-perl all 6.01-1
Connection failed [IP: 80]
Get:30 buster/main armhf perl-openssl-defaults armhf 3 [6,782 B]
Get:31 buster/main armhf libnet-ssleay-perl armhf 1.85-2+b1 [286 kB]
Get:32 buster/main armhf libio-socket-ssl-perl all 2.060-3 [207 kB]
Get:33 buster/main armhf libnet-http-perl all 6.18-1 [24.5 kB]
Get:34 buster/main armhf liblwp-protocol-https-perl all 6.07-2 [9,242 B]
Get:35 buster/main armhf libtry-tiny-perl all 0.30-1 [23.3 kB]
Get:36 buster/main armhf libwww-robotrules-perl all 6.02-1 [12.9 kB]
Get:37 buster/main armhf libwww-perl all 6.36-2 [188 kB]
Err:38 buster/main armhf libxml-parser-perl armhf 2.44-4
Connection failed [IP: 2607:fdc0:1::50 80]
Get:39 buster/main armhf libxml-sax-expat-perl all 0.51-1 [12.0 kB]
Get:40 buster/main armhf libxml-simple-perl all 2.25-1 [72.0 kB]
Err:41 buster/main armhf amanda-client armhf 1:3.5.1-2+b3
Connection failed [IP: 80]
Err:42 buster/main armhf libjson-perl all 4.02000-1
Connection failed [IP: 80]
Err:43 buster/main armhf amanda-server armhf 1:3.5.1-2+b3
Connection failed [IP: 80]
Err:44 buster/main armhf libauthen-sasl-perl all 2.1600-1
Connection failed [IP: 80]
Get:45 buster/main armhf libcommon-sense-perl armhf 3.74-2+b18 [24.0 kB]
Get:46 buster/main armhf libdata-dump-perl all 1.23-1 [29.5 kB]
Get:47 buster/main armhf libfont-afm-perl all 1.20-2 [13.6 kB]
Get:48 buster/main armhf libhtml-form-perl all 6.03-1 [23.9 kB]
Get:49 buster/main armhf libhtml-format-perl all 2.12-1 [43.5 kB]
Get:50 buster/main armhf libhttp-daemon-perl all 6.01-3 [16.6 kB]
Get:51 buster/main armhf libtypes-serialiser-perl all 1.0-1 [12.7 kB]
Get:52 buster/main armhf libjson-xs-perl armhf 3.040-1+b1 [89.1 kB]
Get:53 buster/main armhf libnet-smtp-ssl-perl all 1.04-1 [6,184 B]
Get:54 buster/main armhf libmailtools-perl all 2.18-1 [88.5 kB]
Fetched 5,752 kB in 1min 29s (64.4 kB/s)
E: Failed to fetch Connection failed [IP: 2607:fdc0:1::50 80]
E: Failed to fetch Connection failed [IP: 2607:fdc0:1::50 80]
E: Failed to fetch Connection failed [IP: 80]
E: Failed to fetch Connection failed [IP: 2607:fdc0:1::50 80]
E: Failed to fetch Connection failed [IP: 80]
E: Failed to fetch Connection failed [IP: 80]
E: Failed to fetch Connection failed [IP: 80]
E: Failed to fetch Connection failed [IP: 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
chown: cannot access ‘1024’: No such file or directory
chmod: cannot access ‘1024’: No such file or directory
mkdir: cannot create directory ‘1024/slots’: No such file or directory
chown: cannot access ‘1024/slots’: No such file or directory
ln: failed to create symbolic link ‘1024/slots/drive0’: No such file or directory
ln: failed to create symbolic link ‘1024/slots/drive1’: No such file or directory

Finally I got the window that said that Amanda setup completed and successful. Bakcups will be at 01:00. I understand that this first backup is Level 0 and subsequent ones are Level 1.

Are those errors significant?
Should remove the SD card from the Pi and copy it to my computer and then etch another SD card back-up?
If I removed the backup USB stick from the Pi and inserted it into my computer, should I see evidence of the backup in the form of files?

Thanks for your help.

Update: I removed the stick from Pi, inserted iit in my laptop, and the label was USB20FD and it was empty.

I don’t think that the back-up was successful.

The errors look like networking errors and may be transient. Try again later is all I can offer. The chown/chmod errors may be related to that. I don’t know. Someone more familiar with Amanda would have to anser on that.

It said it completed successfully so I’d wait for a full backup to see if it actually works. If not, look into it more. If not than the problem is almost certainly just with Amanda so starting over is probably not necessary.

The backup files gotta go somewhere. I can’t say what you will see though. I don’t use Amanda.

Make sure you have proper IP connectivity and reinstall Amanda from the menu.