Installing HA on Linux Mint

I wanted to set up a home server, something with a little more juice than the Pi. I did a test run of installing HA on Linux, specifically Linux Mint 18. I set up one of my spare laptops with Linux Mint and nothing else and proceeded to install HA manually. I followed this guide:

Install Home Assistant On CentOS 7

Now, of course, I had to make some changes to the packages and dependencies installed but by and large things went smoothly and I have HA up and running and autostarting on that machine.

Encouraged by this I began looking at Dell PowerEdge R710’s for a rack mountable server. I have a bunch of Cisco gear at home and I figured I would get a nice cabinet mount it all and call it good. However, before I went through all that I wanted to do a trial run in setting up Ubuntu Server and making sure I could get HA to install on it. I go through all the steps, which was much easier this time because I took very detailed notes, so it was much more a breeze. Everything went smoothly until the very last step of compiling the OZWCP. In doing so I get the following output when I ran sudo make:

g++ -c -Wall -Wno-unknown-pragmas -Wno-inline -Wno-format -g -DDEBUG -ggdb -O0 -I /opt/python-openzwave/openzwave/cpp/src -I /opt/python-openzwave/openzwave/cpp/src/command_classes/ -I /opt/python-openzwave/openzwave/cpp/src/value_classes/ -I /opt/python-openzwave/openzwave/cpp/src/platform/ -I /opt/python-openzwave/openzwave/cpp/src/platform/unix -I /opt/python-openzwave/openzwave/cpp/tinyxml/ -I /usr/local/include/ -o ozwcp.o ozwcp.cpp
g++ -c -Wall -Wno-unknown-pragmas -Wno-inline -Wno-format -g -DDEBUG -ggdb -O0 -I /opt/python-openzwave/openzwave/cpp/src -I /opt/python-openzwave/openzwave/cpp/src/command_classes/ -I /opt/python-openzwave/openzwave/cpp/src/value_classes/ -I /opt/python-openzwave/openzwave/cpp/src/platform/ -I /opt/python-openzwave/openzwave/cpp/src/platform/unix -I /opt/python-openzwave/openzwave/cpp/tinyxml/ -I /usr/local/include/ -o webserver.o webserver.cpp
g++ -c -Wall -Wno-unknown-pragmas -Wno-inline -Wno-format -g -DDEBUG -ggdb -O0 -I /opt/python-openzwave/openzwave/cpp/src -I /opt/python-openzwave/openzwave/cpp/src/command_classes/ -I /opt/python-openzwave/openzwave/cpp/src/value_classes/ -I /opt/python-openzwave/openzwave/cpp/src/platform/ -I /opt/python-openzwave/openzwave/cpp/src/platform/unix -I /opt/python-openzwave/openzwave/cpp/tinyxml/ -I /usr/local/include/ -o zwavelib.o zwavelib.cpp
g++ -o ozwcp -g ozwcp.o webserver.o zwavelib.o /opt/python-openzwave/openzwave/libopenzwave.a -lgnutls -lgcrypt /usr/local/lib/libmicrohttpd.a -pthread -ludev -lresolv
webserver.o: In function `Webserver::SendTopoResponse(MHD_Connection*, char const*, char const*, char const*, char const*)':
/opt/open-zwave-control-panel/webserver.cpp:338: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/usr/local/lib/libmicrohttpd.a(connection.o): In function `do_read':
/opt/libmicrohttpd/src/daemon/connection.c:1501: undefined reference to `gnutls_strerror'
/usr/local/lib/libmicrohttpd.a(connection.o): In function `do_write':
/opt/libmicrohttpd/src/daemon/connection.c:1548: undefined reference to `gnutls_strerror'
/usr/local/lib/libmicrohttpd.a(connection.o): In function `MHD_connection_get_pollfd':
/opt/libmicrohttpd/src/daemon/connection.c:855: undefined reference to `gnutls_record_get_direction'
/usr/local/lib/libmicrohttpd.a(connection.o): In function `MHD_get_connection_info':
/opt/libmicrohttpd/src/daemon/connection.c:2401: undefined reference to `gnutls_cipher_get'
/opt/libmicrohttpd/src/daemon/connection.c:2406: undefined reference to `gnutls_protocol_get_version'
/usr/local/lib/libmicrohttpd.a(daemon.o): In function `parse_options_va':
/opt/libmicrohttpd/src/daemon/daemon.c:1785: undefined reference to `gnutls_priority_deinit'
/opt/libmicrohttpd/src/daemon/daemon.c:1786: undefined reference to `gnutls_priority_init'
/opt/libmicrohttpd/src/daemon/daemon.c:1792: undefined reference to `gnutls_strerror'
/usr/local/lib/libmicrohttpd.a(daemon.o): In function `recv_tls_adapter':
/opt/libmicrohttpd/src/daemon/daemon.c:385: undefined reference to `gnutls_record_recv'
/usr/local/lib/libmicrohttpd.a(daemon.o): In function `send_tls_adapter':
/opt/libmicrohttpd/src/daemon/daemon.c:417: undefined reference to `gnutls_record_send'
/usr/local/lib/libmicrohttpd.a(daemon.o): In function `MHD_cleanup_connections':
/opt/libmicrohttpd/src/daemon/daemon.c:1171: undefined reference to `gnutls_deinit'
/usr/local/lib/libmicrohttpd.a(daemon.o): In function `MHD_add_connection':
/opt/libmicrohttpd/src/daemon/daemon.c:977: undefined reference to `gnutls_init'
/opt/libmicrohttpd/src/daemon/daemon.c:978: undefined reference to `gnutls_priority_set'
/opt/libmicrohttpd/src/daemon/daemon.c:984: undefined reference to `gnutls_credentials_set'
/opt/libmicrohttpd/src/daemon/daemon.c:1008: undefined reference to `gnutls_transport_set_ptr'
/opt/libmicrohttpd/src/daemon/daemon.c:1010: undefined reference to `gnutls_transport_set_pull_function'
/opt/libmicrohttpd/src/daemon/daemon.c:1013: undefined reference to `gnutls_transport_set_push_function'
/opt/libmicrohttpd/src/daemon/daemon.c:1018: undefined reference to `gnutls_certificate_server_set_request'
/usr/local/lib/libmicrohttpd.a(daemon.o): In function `MHD_get_timeout':
/opt/libmicrohttpd/src/daemon/daemon.c:1235: undefined reference to `gnutls_record_check_pending'
/usr/local/lib/libmicrohttpd.a(daemon.o): In function `MHD_stop_daemon':
/opt/libmicrohttpd/src/daemon/daemon.c:2585: undefined reference to `gnutls_priority_deinit'
/opt/libmicrohttpd/src/daemon/daemon.c:2587: undefined reference to `gnutls_certificate_free_credentials'
/usr/local/lib/libmicrohttpd.a(daemon.o): In function `MHD_start_daemon_va':
/opt/libmicrohttpd/src/daemon/daemon.c:2439: undefined reference to `gnutls_priority_deinit'
/opt/libmicrohttpd/src/daemon/daemon.c:1979: undefined reference to `gnutls_priority_init'
/usr/local/lib/libmicrohttpd.a(daemon.o): In function `MHD_TLS_init':
/opt/libmicrohttpd/src/daemon/daemon.c:484: undefined reference to `gnutls_certificate_allocate_credentials'
/usr/local/lib/libmicrohttpd.a(daemon.o): In function `MHD_init_daemon_certificate':
/opt/libmicrohttpd/src/daemon/daemon.c:443: undefined reference to `gnutls_certificate_set_x509_trust_mem'
/opt/libmicrohttpd/src/daemon/daemon.c:461: undefined reference to `gnutls_certificate_set_x509_key_mem'
/usr/local/lib/libmicrohttpd.a(daemon.o): In function `MHD_start_daemon_va':
/opt/libmicrohttpd/src/daemon/daemon.c:2108: undefined reference to `gnutls_priority_deinit'
/usr/local/lib/libmicrohttpd.a(daemon.o): In function `MHD_init':
/opt/libmicrohttpd/src/daemon/daemon.c:2714: undefined reference to `gcry_control'
/opt/libmicrohttpd/src/daemon/daemon.c:2715: undefined reference to `gnutls_global_init'
/usr/local/lib/libmicrohttpd.a(daemon.o): In function `MHD_fini':
/opt/libmicrohttpd/src/daemon/daemon.c:2726: undefined reference to `gnutls_global_deinit'
/usr/local/lib/libmicrohttpd.a(connection_https.o): In function `MHD_tls_connection_handle_write':
/opt/libmicrohttpd/src/daemon/connection_https.c:108: undefined reference to `gnutls_handshake'
/usr/local/lib/libmicrohttpd.a(connection_https.o): In function `MHD_tls_connection_handle_read':
/opt/libmicrohttpd/src/daemon/connection_https.c:62: undefined reference to `gnutls_handshake'
/usr/local/lib/libmicrohttpd.a(connection_https.o): In function `MHD_tls_connection_handle_idle':
/opt/libmicrohttpd/src/daemon/connection_https.c:167: undefined reference to `gnutls_record_check_pending'
/opt/libmicrohttpd/src/daemon/connection_https.c:164: undefined reference to `gnutls_bye'

At the end of it, the following error was spit out:

collect2: error: ld returned 1 exit status
Makefile:71: recipe for target 'ozwcp' failed
make: *** [ozwcp] Error 1

I thought, okay, Google time. There is literally like only two pages of results in searching on that Makefile error, all of which I have either done or tried.

So I think, okay, maybe there is something different in the base of Ubuntu Server from Linux Mint. So I wipe the drive and install Linux Mint. Fresh install and straight into installing Home Assistant. I get to the exact same spot and get the exact same error. I am now like what the @#$@# @$@#$@$%^%#!!! My laptop is running this EXACT same version of Linux and HA is working perfectly on it.

I know gnutls is installed on the machine because, I installed it and I can check for it:

 $ sudo pkg-config gnutls --libs
-lgnutls

And

 $ whereis gnutls
gnutls: /usr/include/gnutls

So I am not sure what is going wrong, but I am at my witts end and thought I would post up here in case anyone had some ideas or perhaps have solved this at some point.

Here is the OZWCP Makefile in case anyone is curious or needs it to figure something out:

#
# Makefile for OpenzWave Control Panel application
# Greg Satz

# GNU make only

.SUFFIXES:      .cpp .o .a .s

CC     := $(CROSS_COMPILE)gcc
CXX    := $(CROSS_COMPILE)g++
LD     := $(CROSS_COMPILE)g++
AR     := $(CROSS_COMPILE)ar rc
RANLIB := $(CROSS_COMPILE)ranlib

DEBUG_CFLAGS    := -Wall -Wno-unknown-pragmas -Wno-inline -Wno-format -g -DDEBUG -ggdb -O0
RELEASE_CFLAGS  := -Wall -Wno-unknown-pragmas -Werror -Wno-format -O3 -DNDEBUG

DEBUG_LDFLAGS   := -g

# Change for DEBUG or RELEASE
CFLAGS  := -c $(DEBUG_CFLAGS)
LDFLAGS := $(DEBUG_LDFLAGS)

OPENZWAVE := /opt/python-openzwave/openzwave
LIBMICROHTTPD := /usr/local/lib/libmicrohttpd.a

INCLUDES := -I $(OPENZWAVE)/cpp/src -I $(OPENZWAVE)/cpp/src/command_classes/ \
        -I $(OPENZWAVE)/cpp/src/value_classes/ -I $(OPENZWAVE)/cpp/src/platform/ \
        -I $(OPENZWAVE)/cpp/src/platform/unix -I $(OPENZWAVE)/cpp/tinyxml/ \
        -I /usr/local/include/

# Remove comment below for gnutls support
GNUTLS := -lgnutls -lgcrypt

# for Linux uncomment out next three lines
LIBZWAVE := $(wildcard $(OPENZWAVE)/*.a)
LIBUSB := -ludev
LIBS := $(LIBZWAVE) $(GNUTLS) $(LIBMICROHTTPD) -pthread $(LIBUSB) -lresolv

# for Mac OS X comment out above 2 lines and uncomment next 5 lines
#ARCH := -arch i386 -arch x86_64
#CFLAGS += $(ARCH)
#LIBZWAVE := $(wildcard $(OPENZWAVE)/cpp/lib/mac/*.a)
#LIBUSB := -framework IOKit -framework CoreFoundation
#LIBS := $(LIBZWAVE) $(GNUTLS) $(LIBMICROHTTPD) -pthread $(LIBUSB) $(ARCH) -lresolv

%.o : %.cpp
        $(CXX) $(CFLAGS) $(INCLUDES) -o $@ $<

%.o : %.c
        $(CC) $(CFLAGS) $(INCLUDES) -o $@ $<

all: defs ozwcp


defs:
ifeq ($(LIBZWAVE),)
        @echo Please edit the Makefile to avoid this error message.
        @exit 1
endif

ozwcp.o: ozwcp.h webserver.h $(OPENZWAVE)/cpp/src/Options.h $(OPENZWAVE)/cpp/src/Manager.h \
        $(OPENZWAVE)/cpp/src/Node.h $(OPENZWAVE)/cpp/src/Group.h \
        $(OPENZWAVE)/cpp/src/Notification.h $(OPENZWAVE)/cpp/src/platform/Log.h

webserver.o: webserver.h ozwcp.h $(OPENZWAVE)/cpp/src/Options.h $(OPENZWAVE)/cpp/src/Manager.h \
        $(OPENZWAVE)/cpp/src/Node.h $(OPENZWAVE)/cpp/src/Group.h \
        $(OPENZWAVE)/cpp/src/Notification.h $(OPENZWAVE)/cpp/src/platform/Log.h

ozwcp:  ozwcp.o webserver.o zwavelib.o $(LIBZWAVE)
        $(LD) -o $@ $(LDFLAGS) ozwcp.o webserver.o zwavelib.o $(LIBS)

dist:   ozwcp
        rm -f ozwcp.tar.gz
        tar -c --exclude=".svn" -hvzf ozwcp.tar.gz ozwcp config/ cp.html cp.js openzwavetinyicon.png README

clean:
        rm -f ozwcp *.o

You might want to consider the use of docker, it will spare you the problem of platform and work pretty well.

And as a bonus, the docker image of home-assistant already have integrated support for Open Z-Wave, so it will be start-and play for you.

I run mine with docker, on CentOS 7.3 and on a HP Gen8 server, never had any problem.

I would normally be all over that, except I know next to nothing about Docker. That aside, however, I would still be all over it if not for the fact I have HA currently installed on my laptop that is running Linux Mint. So I know its possible to do, I just need to find out what is different between the server install and the laptop Linux Mint install. It’s related to some missing package or dependency I am sure, the trick is figuring out which one.

SUCCESS!!!

I now have HA running on a PC that I converted to a server. It is currently running Ubuntu Server 16.10. The neat part, for me anyway, is that once I had everything worked out and up and running, all I had to do was just transfer the configuration files from the RPi over to the server, start up HA and boom, most everything worked right out of the box. There were a couple of things I would need to tweak a little but mostly fully functional once the files were moved over.

I may have to do a write up on the process as I had to pull information from about three different resources in order to get everything to click. And I have to thank whomever it was on Gitter that pointed me to the last bit of info that made it click. Ironically, it was an information source I had looked at a dozen times in trying to figure this out but one little piece of additional information made it all click and I was off to the races.

1 Like

Is there a way to autostart docker containers?

Simply add the option --restart=unless-stopped to your docker run command.

It will restart the docker container if hass crash, if the docker daemon is restarted or if the computer restart.
The only case it will stay off is when you stopped it using docker stop.

Other parameter for the restart option are no (does not restart, default behavior), always or on-failure (only restart on non-zero exit code; wouldn’t restart after a computer/docker daemon restart).