newspaint

Documenting Problems That Were Difficult To Find The Answer To

Monthly Archives: October 2015

Tmux Value Is Invalid

I created a .tmux.conf file but tmux kept rejecting the settings I put in the file with the error:

value is invalid

The cause? I created the configuration file in in Windows using the DOS end-of-line encoding instead of Unix end-of-line encoding.

Tenvis TH692 IP/Network Camera

Resources

To reset the camera press and hold the push button for 15 seconds.

For URLs see http://www.instar.com/faq_cgi_hd.

For the CGI interface (of more interest to programmers) see the PDF at http://wiki.instar.com/index.php/File:INSTAR_CGI_H264_Chipset_English.pdf.

Out of the Box

Your router should dynamically assign a DHCP address to the camera by default (out of the box) and the camera will report itself with “IPCAM” as the hostname.

You can log into the camera by visiting http://<address>/ using the username admin and password admin which you’ll have to change on first login.

Feeds

You can get a video feed in VLC from your camera by using the following URL:

  • rtsp://admin:password@<address>:554/1 (1024×768)
  • rtsp://admin:password@<address>:554/2 (640×352)

You can take a temporary snapshot photo:

iPhone Quicktime stream:

Altering Video Feed Parameters

By default the camera is set to transmit at 2048Kbps and 25 frames per second. If you’re trying to upload that stream over a home Internet connection that can be a little excessive. Perhaps you’re happier with 5 frames per second and 512Kbps. How can you set this? The user interface on the web camera will only let you change the frame rate – not the bit rate.

The URL http://<address>/web/cgi-bin/param.cgi?cmd=getvencattr&-chn=1 will fetch the parameters of the connection and will look like this:

var bps_1="2048"; var fps_1="25"; var gop_1="25"; var brmode_1="1"; var imagegrade_1="1"; var width_1="1280"; var height_1="720"; 

You can set parameters (see PDF link above) such as:

Other parameters include:

  • gop – prime frame rate interval (2-150)
  • imagegrade – encode quality (1-6), lower values better image quality
  • brmode – 0 for fixed bit rate, 1 for variable bit rate

Setting Infrared Mode

The URL http://<address>/web/cgi-bin/param.cgi?cmd=getinfrared will get the current state of the infrared mode and return:

var infraredstat="auto";

To set the infrared mode you have the choice of:

Compiling/Installing ZoneMinder on Ubuntu Trusty 14.04 From Source

Download ZoneMinder

Download from http://www.zoneminder.com/downloads.

sudo apt-get install wget
wget 'https://github.com/ZoneMinder/ZoneMinder/archive/v1.28.1.tar.gz'
tar -xvzf v1.28.1.tar.gz

Build

Find required packages at http://packages.ubuntu.com/.

sudo apt-get install autoconf automake
sudo apt-get install libmariadbclient-dev
sudo apt-get install libpolkit-gobject-1-0 libpolkit-gobject-1-dev
sudo apt-get install g++
sudo apt-get install libjpeg62 libjpeg62-dev
sudo apt-get install libgnutls-dev
sudo apt-get install libdbi-perl libdbd-mysql-perl libdate-manip-perl libwww-perl libsys-mmap-perl
sudo apt-get install libavutil-dev libavcodec-dev libavformat-dev libavdevice-dev
sudo apt-get install libswscale-dev libbz2-dev libx264-dev
sudo apt-get install netpbm libvlc-dev
sudo apt-get install libarchive-zip-perl libmime-lite-perl

Then configure.

./bootstrap.sh
./configure --with-webdir=/opt/zm/web/zm --with-cgidir=/opt/zm/web/cgi --with-webuser=www-data --with-webgroup=www-data --prefix=/opt/zm --with-libarch=lib

Next make.

sudo apt-get install make
nice make -j 2

Was receiving the build error:

./configure: line 3430: syntax error near unexpected token `POLKIT,'
./configure: line 3430: `PKG_CHECK_MODULES(POLKIT, polkit-gobject-1)'

Solution was to sudo apt-get install libpolkit-gobject-1-0 libpolkit-gobject-1-dev and ./bootstrap.sh again.

Install.

sudo make install
sudo mkdir /opt/zm/share/perl
sudo ln -s '/opt/zm/share/perl5/' '/opt/zm/share/perl/5.18.2'

Then set up database.

sudo apt-get install mariadb-client mariadb-server
echo "create database zm" |mysql -u root -p

Add to my.cnf as per this MySQL webpage and this MariaDB webpage:

[mysqld]
innodb_file_per_table=1
innodb_file_format=Barracuda

Then:

mysql -u root -p zm < /opt/zm/share/zoneminder/db/zm_create.sql
echo "grant select,insert,update,delete,lock tables,alter on zm.* to 'zmuser'@localhost identified by 'zmpass'" |mysql -u root -p

Now we need a lock directory:

sudo mkdir /var/lock/subsys

Then we need an init script:

Create /etc/init.d/zm from this ZoneMinder webpage.

Apache

sudo apt-get install apache2-mpm-worker

And, as recommended by this forum post for PHP5 CGI:

sudo apt-get install libapache2-mod-fcgid
sudo apt-get install php5-cgi php5-cli php5-mysqlnd

Enable SSL and CGI modules:

sudo mkdir /etc/apache2/ssl
a2enmod ssl
a2enmod cgi
sudo mkdir /var/log/apache2/zm/

And for basic authentication (to run htpasswd in Ubuntu) you need to:

sudo apt-get install apache2-utils # for htpasswd

A configuration that can be placed in /etc/apache2/sites-available is:

<IfModule mod_ssl.c>
  <VirtualHost _default_:443>
    ServerAdmin webmaster@localhost

    DocumentRoot /opt/zm/web/zm

    ErrorLog /var/log/apache2/zm/error.log
    CustomLog /var/log/apache2/zm/access.log combined

    #   SSL Engine Switch:
    #   Enable/Disable SSL for this virtual host.
    SSLEngine on

    # You're going to have to create your own PEM file
    SSLCertificateFile /etc/apache2/ssl/apache.pem
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
      SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /opt/zm/web/cgi>
      SSLOptions +StdEnvVars
    </Directory>

    BrowserMatch "MSIE [2-6]" \
      nokeepalive ssl-unclean-shutdown \
      downgrade-1.0 force-response-1.0 
    BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

    <Directory /opt/zm/web/zm>
      <IfModule mod_authz_core.c>
        # Apache 2.4
        Require all granted
      </IfModule>
      <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order deny,allow
        Allow from all
      </IfModule>

      AddHandler fcgid-script .php
      FCGIWrapper /usr/lib/cgi-bin/php5 .php
      Options +ExecCGI +Indexes

      AllowOverride All
    </Directory>

    ScriptAlias /cgi-bin/ /opt/zm/web/cgi/
    <Directory /opt/zm/web/cgi>
      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
      AllowOverride All
      <IfModule mod_authz_core.c>
        # Apache 2.4
        Require all granted
      </IfModule>
      <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order deny,allow
        Allow from all
      </IfModule>

      <FilesMatch "(nph-zms|zms)">
        SetHandler cgi-script
        SSLOptions +StdEnvVars
       </FilesMatch>
    </Directory>

    <Directory />
      <IfModule mod_authz_core.c>
        # Apache 2.4
        Require all denied
      </IfModule>
      <IfModule !mod_authz_core.c>
        # Apache 2.2
        Order deny,allow
        Deny from all
      </IfModule>
    </Directory>
  </VirtualHost>
</IfModule>

Linux Citrix Client – Black Screen on Connection

I was using the Citrix Linux Client/Receiver 13.2.1. But whenever I started a Citrix session (to a Windows virtual desktop) I would see the small log-in dialog, which I’d successfully fill out, but then the display would take up the full-screen and would be black.

As a work-around I could select the session from the session manager taskbar, right click on it, and select move – and the action of moving the window would cause it to display as normal. But this was frustrating – having to move the window every time to make it display – and once moved it would no longer be full screen but have scroll bars on the bottom and right-hand side.

A solution to this is to start the session with a command line parameter (-geometry widthxheight) added to the wfica executable. For example, on a 1920×1200 display the following settings would set up a separate application window with the remote desktop session inside:

./wfica -geometry 1860x1160 -file $1

Command line arguments for wfica are available at the Citrix website.

Linux Citrix Receiver – AuthManagerDaemon Not Found Running configmgr

When running /opt/Citrix/ICAClient/util/configmgr it would take tens of seconds to update the display and the console would output the following messages:

AuthManagerDaemon not found
ServiceRecord daemon not found

A thread recommended running /opt/Citrix/ICAClient/selfservice to see what was missing, on Ubuntu 14.04 it reported:

./selfservice: error while loading shared libraries: libsoup-2.4.so.1: cannot open shared object file: No such file or directory
libwebkit: libwebkit-1.0.so.2: cannot open shared object file: No such file or directory

So I ran:

sudo apt-get install libsoup2.4-1

And then configmgr would work again.

Linux Citrix Receiver – SSL Error – AddTrust External CA Root

I received the following error after installing the Citrix Receiver for Linux:

SSL error
Contact your help desk with the following information: You have not chosen to trust “AddTrust External CA Root”, the issuer of the server’s security certificate (SSL error 61).

Error message about AddTrust External CA Root

Error message about AddTrust External CA Root

One recommendation is to copy all the certificates from Mozilla’s certificate store to the Citrix store:

cp /usr/share/ca-certificates/mozilla/* /usr/lib/ICAClient/keystore/cacerts/
cp /usr/share/ca-certificates/mozilla/* /opt/Citrix/ICAClient/keystore/cacerts/

But I chose to download addtrustexternalcaroot.crt from Comodo into /opt/Citrix/ICAClient/keystore/cacerts/ and attempt the connection again – this worked for me.