21 September 2014

Update to VNC: tightvncserver instability

Update to http://zmodemz.blogspot.com/2010/03/ubuntu-vnc.html


tightvncserver was crashing on me when doing simple things like opening file manager. I was getting the following error:


/var/log/syslog
Sep 14 00:21:45 servername kernel: [440445.907880] Xtightvnc[12447]: segfault at 7fffaf355000 ip 0000000000448a2e sp 00007fffaf352c80 error 6 in Xtightvnc[400000+178000]


Turns out that the instability is just in this version of tightvncserver, should be fixed in 1.3.10. So for the time being, I swapped out tightvncserver for vnc4server. The commands are identical as far as I can tell, so the switch was easy.


Software Versions:
Xubuntu 14.04.1 LTS (Trusty Tahr)
tightvncserver 1.3.9
vnc4server 4.1.1

20 September 2014

MythTV 0.27 backend setup

As I wanted my new server to act as a DVR, I decided to go with MythTV as my backend.

Install MythTV (server only, I will have separate frontends):


  1. Install htdigest (for password protecting MythWeb):
    • sudo apt-get install apache2-utils
  2. Install mythtv-backend-master (and all dependencies)
    • sudo apt-get install mythtv-backend-master
    • Answered yes to password protect MythWeb
    • Told it that MythWeb would not be the only thing running on Apache
    • Told it other computers would be connecting to it (remote frontends)
  3. Ran mythtv-setup
    1. Changed database password to match the one in /etc/mythtv/config.xml
    2. Changed it to listen on 192.168.1.XXX instead of 127.0.0.1
    3. Also change the backend ip to the same (learned this the hard way)
    4. Added my HDHomeRun Dual tuner (must do twice once as tuner 0, second as tuner 1)
    5. Created an OverAir video group (use EIT)
    6. Put both tuners in this group
    7. Scanned for channels
  4. Enable remote connections in mysql (learned this the hard way):
    1.  Change the bind-address in /etc/mysql/my.conf
      • bind-address            = 192.168.1.XXX
    2. Restart mysql
      • sudo service mysql restart

Software Versions:
Xubuntu 14.04.1 LTS (Trusty Tahr)
MythTV 0.27

Troubleshooting:



Make sure MythWeb password protection is on. In /etc/apache2/sites-enabled/mythweb.conf the following lines should be un-commented:
        AuthType           Digest
        AuthName           "MythTV"
        AuthUserFile       /var/www/htdigest
        Require            valid-user
        BrowserMatch       "MSIE"      AuthDigestEnableQueryStringHack=On
        Order              allow,deny
        Satisfy            any


Restart apache: sudo service apache2 restart
For more info see: http://www.mythtv.org/wiki/Securing_MythWeb



Error: "mythtv cannot connect to database":

My remote frontend was unable to connect to my backend mysql database until I changed /etc/mysql/my.cnf to allow remote connections by changing bind-address from 127.0.0.1 to 192.168.1.XXX (server ip)



Mythfilldatabase returning an error about no version response, really slow backend connections, and constant backend crashes:

Turns out that when changing the ip to listen on from 127.0.0.1 to 192.168.1.XXX, you HAVE to make sure to also change the backend ip from 127.0.0.1 to 192.168.1.XXX





10 September 2014

ZFS: quota, compression, and encryption

Here is how I used ZFS to setup my storage drive.


Initial setup:

Get the ZFS package:
    sudo apt-get install zfs-fuse

Find your drives:
    ls /dev/disk/by-id/

Create the array:
    sudo zpool create storage mirror /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-SERIAL#1 /dev/disk/by-id/ata-WDC_WD30EFRX-68EUZN0_WD-SERIAL#2

Check pool status:
    sudo zpool status



Quota:

Create a new zfs container:
    sudo zfs create storage/mythtv

Set the storage limit (quota):
    sudo zfs set quota=1T storage/mythtv


Compression:

Create a new zfs container:
    sudo zfs create -o compression=on storage/.encrypted

Or to turn on compression on an existing container:
    sudo zfs set compression=on storage/.encrypted

Check CompressRatio:
    sudo zfs get all storage/encrypted | grep compressratio


Encryption:

Since Linux ZFS does not support the encryption option (as of 2014-09), there are 2 options. The first is to place the encryption below the ZFS layer using LUKS, and the second is to encrypt on top of the ZFS layer using a file based encryption. I have chosen to use the latter because I have heard that ZFS data reliability works better if it is the layer closest to the hardware.

Get the encryption package:
    sudo apt-get install ecryptfs-utils

Create a mount point and start the encryption process:
    sudo mkdir /storage/encrypted
    sudo mount -t ecryptfs /storage/encrypted /storage/encrypted

Follow the prompts. I chose AES, 32 bytes (256 bit), and yes to encrypt the filenames.

Save settings to be able to mount later:
    cat /etc/mtab | grep ecryptfs

Add results from above to /etc/fstab and add the options noauto (to prevent mounting at boot) and ecryptfs_passthrough=n (not sure why this is not on the mtab entry)

Example /etc/fstab entry:
    /storage/.encrypted /storage/encrypted ecryptfs noauto,rw,ecryptfs_sig=12a34b567c8de9ff,ecryptfs_cipher=aes,ecryptfs_key_bytes=32,ecryptfs_fnek_sig=12a34b567c8de9ff,ecryptfs_unlink_sigs,ecryptfs_passthrough=n 0 0

Unmount:
    sudo umount /storage/encrypted


Mount:
    sudo mount /storage/encrypted

Encryption Update (2014-09-26):

Enabling Filename Encryption in ecryptfs lowers your maximum filename from 255 characters to 143 characters.
See: https://bugs.launchpad.net/ecryptfs/+bug/344878