2016-01-10

Handbrake, LibDVDCSS, and Windows 10.

While on my work laptop (A Lenovo T430 that I'm exceptionally happy with, and can heartily recommend, but sadly is only available used these days) I'm very happy with my Linux Mint install, at home I still have what was in the (not so?) distant past called a "Wintendo".

With this in mind, after setting up a reasonably sized NAS at home, I decided that it was time for me to start digitizing media that I have currently. Most of it is DVD or CD Audio, as I haven't made the jump to BluRay as of yet.

My go-to for almost all DVD ripping in the past has been Handbrake. It's a reasonably usable interface with a reasonably fast encoding engine behind it. What's happened since the last time I set it up has been that DVD copy protection has become massively onerous, due to many reasons which are beyond the scope of this article. Most places that you start to look for side-stepping this stuff (which is a massive grey area legally in the United States and possibly other places. You have been warned.) say "download libDVDCSS from [some weirdly site] and drop it in your handbrake folder".  This kind of works, but most of the links seem to be to an older version of the library (1.2.x) instead of being built off a current copy of the code.  So I decided to document what I did to compile this myself on my wintendo, which happens to be running Windows 10 64B at this point in time.

You'll need to set up and download some things to get all this to work, so if you're into "one click solutions", this isn't for you.  Due to the legal nature of mentioned above, I'm not going to provide a link to the finished product.  Have fun and learn something.  Or not, I'm not your conscience.

You'll need to install a build environment.  The recommendation from VideoLAN (who wrote the library you're going to be compiling) is to use the suite of tools provided by MinGW.  MinGW has a very nice installer that you can get from http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download.

When you get that installed, accepting all the defaults (they appear to be mostly sane), run the installation manager.  You'll be presented with a fairly simple 3 pane UI.  In the top right pane, select "mingw-developer-toolkit".  It'll spin for a few moments before coming back and putting a check in the box.  Click the "Installation" menu and then select "Apply Changes".  This should complete what you need to do with this application.

You'll need to download the code that you're going to be compiling from VideoLAN.  You can grab it from http://download.videolan.org/pub/libdvdcss/last/.  It looks like the latest as of this writing is 1.4.0.  It also looks like it only is available in a bz2 file.  7-Zip (http://7-zip.org), one of many compressed file managers, can open this for you.  I personally like 7-zip because it's scriptable and open. However you unpack this, put it somewhere you can find it easily.  I'm lazy and generally put stuff like this on my desktop. 

Once you decompress the files, you'll need to open a command prompt, but not the one you think you need to:  You'll need to open a MinGW prompt to make things easy.  You can open this by running "C:\MinGW\msys\1.0\msys.bat", assuming that C:\MinGW is where you configured the installer to put all of the MinGW stuff.  This will open a command prompt that looks a bit strange, but will make your life MUCH easier.

Now's when it gets a bit more complicated.  You'll need to change directory to where you unpacked your copy of the DeCSS code.  Since I put mine on my desktop, in my MinGW bash window, I change directory like so:

cd /c/Users/captslaq/desktop/libdvdcss-1.4.0/  

Once in the proper directory, it's pretty straight forward, and documented in the INSTALL text document:
./configure
Configure, in a nutshell, checks the state of your system and then builds out a file to tell the compiler what it needs to do.  This will spit out a list of status messages before exiting without any real complaint, assuming everything works.
make
Make runs all the things that the file(s) spit out by configure tells it to.  It'll carp about some things, but in the end it will exit without an error.  When this is done, you'll have a new folder, .libs, in your folder.  Inside there, you'll find a copy of libdvdcss-2.dll. You don't even have to rename it anymore.  Using windows explorer, just copy libdvdcss-2.dll into your handbrake folder.  You now have a current version of libdvdcss that should work as expected.




2015-05-08

Installing SMBind using MySQL backend on Ubuntu 14.04

In Ubuntu 12.04, there was a package for web management of a BIND based DNS server called SMBIND. This package has not been ported forward to 14.04, so here's how I got this done.
Assumptions:
  • Using Apache as a web server is acceptable. Apache is one of the most ubiquitous http servers on the planet, with plenty of documentation for how to fix stuff if it goes pear shaped. If you want to use another web server, please check the documentation for that service.
  • There is no other service using HTTP on the machine being configured. On a private IP space, you have plenty of places to put stuff. With the plethora of options available for VM hosts, I recommend that you run one of those on your home server and host this in there. ProxMox has a very nice web managed front end for its VM management console that works well and uses very little overhead.
  • Using MySQL as a database server is acceptable. MySQL is (as of this writing) still the default SQL server for Ubuntu.
  • A rudimentary knowledge of MySQL, Apache, and a basic knowledge of how to get common tasks done in Ubuntu. If you're setting this up, you either have these or want them anyway.
Grab and unarchive the package from SourceForge.
Install the following packages with your favorite package manager. I typically use apt from the command line directly.
php5 php5-mysqlnd php5-pear mysql-server bind9 smarty3

This will install a bunch of stuff for you, and, most importantly, ask you to set a password for the root user for mysql. Once you've done this, create a user and a database for SMBind to use. I typically do this from the console, but there are several tools you can use to get this done.

You'll need to install the Pear DB package. It balks that it's deprecated, but it's required for SMBind to work. I haven't tested to see if the replacement drops in or not.
sudo pear install DB

Inside the SMBind archive, there's a database that needs to be imported called 'smbind-mysql.sql'.
mysql -u smbind -p -D smbind < smbind-mysql.sql

Inside the SMBind archive, there is a folder that contains the PHP files that are used to get work done. Copy the entire folder into a sane location. The following puts it in /var/www/smbind, which is assumed for the rest of this article.
sudo cp -r ./php/ /var/www/smbind

Set up apache to serve the code. The cleanest way to do this is to copy the default config to another file, modify the new file, disable the default config, and enable the smbind config.
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/smbind.conf

Here's the file I'm using for this currently:
<virtualhost>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/smbind
ErrorLog ${APACHE_LOG_DIR}/smbind_error.log
CustomLog ${APACHE_LOG_DIR}/smbind_access.log combined
</virtualhost>

Enable the smbind site
sudo a2dissite 000-default.conf
sudo a2ensite smbind.conf

Restart apache:
sudo service apache2 restart

Edit the config file /var/www/smbind/config.php. Here's what I'm using currently, password redacted:
<?php
// Include paths.
$_CONF['smarty_path']   = "/usr/share/php/smarty3";
$_CONF['peardb_path']   = "/usr/share/php";

// Database DSN.
$_CONF['db_type']       = "mysql"; // mysql for MySQL, pgsql for PostgreSQL
$_CONF['db_user']       = "smbind";
$_CONF['db_pass']       = "not really my password";
$_CONF['db_host']       = "localhost";
$_CONF['db_db']         = "smbind";

// Zone data paths (normal).
$_CONF['path']          = "/etc/smbind/zones/";
$_CONF['conf']          = "/etc/smbind/smbind.conf"; # Include this file in named.conf.

// Zone data paths (chroot).
#$_CONF['path']         = "/var/named/chroot/var/named/";
#$_CONF['conf']         = "/var/named/chroot/etc/smbind/smbind.conf"; # Include this file in named.conf.

// BIND utilities.
$_CONF['namedcheckconf'] = "/usr/sbin/named-checkconf";
$_CONF['namedcheckzone'] = "/usr/sbin/named-checkzone";
$_CONF['rndc']           = "/usr/sbin/rndc";
?>

Set the permissions on the necessary files:
sudo chown www-data:www-data /var/www/smbind/templates_c/
sudo chown www-data:www-data /var/www/smbind/config.php

Create a place for smbind to house configuration files.
sudo mkdir -p /etc/smbind/zones/
sudo chown www-data:www-data /etc/smbind/zones/
sudo touch /etc/smbind/smbind.conf
sudo chown www-data:www-data smbind.conf

Add www-data to the bind group:
sudo usermod -a -G bind www-data

Alter the named apparmor profile to read the smbind configs. The file is /etc/apparmor.d/local/usr.sbin.named. Here's my current one:
# Site-specific additions and overrides for usr.sbin.named.
# For more details, please see /etc/apparmor.d/local/README.
/etc/smbind/smbind.conf rw,

Reload the apparmor profile
sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.named

Change the permissions of /etc/bind/rndc.key to allow smbind to read it.
sudo chgrp www-data /etc/bind/rndc.key

Link the rdnc.key file into /etc. No configuration option exists for this in SMBind. I've opened a ticket to see if this can be moved to the config file so this step can be skipped.
sudo ln -s /etc/bind/rndc.key /etc

Alter /etc/bind/named.conf.local to have the smbind and rndc settings. Here's the one I'm currently using:
//
// Do any local configuration here
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
include "/etc/bind/rndc.key";
include "/etc/smbind/smbind.conf";

Restart bind
sudo service bind9 restart

Run the config test using your favorite web browser.
http://your.server.ip/src/configtest.php

If everything comes back clean, congratulations. You've succeeded.

A package for SMBind may show up at some point. If it does, use it. This configuration, while it does work functionally, is probably not ideal by any stretch. If I get super ambitious, I may set up a launchpad account and build out a package for this, assuming no one else is working on it.

2014-10-23

Installing MySQL 5.6 with Galera on Ubuntu 14.04

Inspired by this horror story of an install, I've decided to see if there's a more elegant way of getting it done. I *think* I have it, but the root cause may make this fix moot.

The problem that needs to be addressed is that the dependencies listed in the .deb files provided by Codership for installing the patched mysql binaries and Galera don't line up properly with packages that you can install in Ubuntu. The version provided by Codership is based on MySQL 5.6.16, where as the repositories are up to 5.6.19. This particular problem isn't exactly unexpected due to the nature of what's being installed: A patch to MySQL.

Before you go any further, I must state the following: I have not analyzed the impact of this procedure with great depth. All I know is that initial testing indicates that there's no problem with it, but there is a reality that cannot be denied: There might be a version mis-match with some of the binary files. Until Codership delivers a version of mysql greater than 5.6.19, if you want to use the packaged version of this tool, this is the reality.

With this in mind, I set about trying to find a method of modifying the data baked into the .deb files for the prerequisites. Here's the install procedure I've used and appears to be successful. All of the following is based on a freshly installed copy of Ubuntu 14.04 and the salt-minion package, with all of its requirements.

First, you'll need to install the MySQL 5.6 packages from the Universe repo. If you don't have the Universe repo enabled, check here.

After you have Universe enabled, you can simply install the mysql 5.6 packages, along with the required libssl0.9.8 package:

sudo apt-get install mysql-server-5.6 mysql-client-5.6 libssl0.9.8
You'll need to download the required .deb files for installation. These are the latest as of this writing.

wget https://launchpad.net/galera/3.x/25.3.5/+download/galera-25.3.5-amd64.deb https://launchpad.net/codership-mysql/5.6/5.6.16-25.5/+download/mysql-server-wsrep-5.6.16-25.5-amd64.deb

I hope that Codership will patch and release soon so this entire writeup isn't necessary to be indexed by anyone. The listed milestones on Codership's launchpad seems to suggest that they're probably close to a release using MySQL 5.6.20, which WILL make this ugly hack unneeded.

I found this thread with a nifty little script in it that I'll paste here with some very minor modifications. Take the following and save it to disk.

#!/bin/bash

if [[ -z "$1" ]]; then
  echo "Syntax: $0 debfile"
  exit 1
fi

DEBFILE="$1"
TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
OUTPUT=`basename "$DEBFILE" .deb`.modfied.deb

if [[ -e "$OUTPUT" ]]; then
  echo "$OUTPUT exists."
  rm -r "$TMPDIR"
  exit 1
fi

dpkg-deb -x "$DEBFILE" "$TMPDIR"
dpkg-deb --control "$DEBFILE" "$TMPDIR"/DEBIAN

if [[ ! -e "$TMPDIR"/DEBIAN/control ]]; then
  echo DEBIAN/control not found.

  rm -r "$TMPDIR"
  exit 1
fi

CONTROL="$TMPDIR"/DEBIAN/control

MOD=`stat -c "%y" "$CONTROL"`
"${FCEDIT:-${VISUAL:-${EDITOR:-vi}}}" "$CONTROL"

if [[ "$MOD" == `stat -c "%y" "$CONTROL"` ]]; then
  echo Not modfied.
else
  echo Building new deb...
  dpkg -b "$TMPDIR" "$OUTPUT"
fi

rm -r "$TMPDIR"
Take the above script and save it to a file. The referenced post suggested videbcontrol, so I'll go with that.

You'll need to execute it. The easiest thing to do is set the execute bit:

# chmod +x videbcontrol

When you run videbcontrol mysql-server-wsrep-5.6.16-25.5-amd64.deb you'll be presented with the following:

Package: mysql-server-wsrep
Version: 5.6.16-25.5
Maintainer: Codership Oy
Architecture: amd64
Description: wsrep-enabled MySQL server
 Copyright: MySQL AB, Codership Oy, All Rights Reserved
 MySQL server + wsrep patch (https://launchpad.net/codership-mysql)
Depends: psmisc, debianutils (>= 1.6), libc6 (>= 2.4), libdbi-perl, libdbd-mysql-perl (>= 1.2202), libgcc1 (>= 4.1.1), libncurses5 (>= 5.6), libstdc++6 (>= 4.1.1), libwrap0 (>= 7.6), perl, zlib1g (>= 1.1.4), libaio1, mysql-client
Replaces: mysql-server-core (<= 5.6.16), mysql-server-core-5.0 (<= 5.6.16), mysql-server-core-5.1 (<= 5.6.16), mysql-server (<= 5.6.16), mysql-server-5.0 (<= 5.6.16), mysql-server-5.1 (<= 5.6.16), mysql-server-5.6 (<= 5.6.16), mysql-server-5.5 (<= 5.6.16)
Provides: mysql-server-core, mysql-server, mysql-server-5.6
The finished product that you'll save looks like below. I've hilighted the changes and additions.

Package: mysql-server-wsrep
Version: 5.6.16-25.5
Maintainer: Codership Oy
Architecture: amd64
Description: wsrep-enabled MySQL server
 Copyright: MySQL AB, Codership Oy, All Rights Reserved
 MySQL server + wsrep patch (https://launchpad.net/codership-mysql)
Depends: psmisc, debianutils (>= 1.6), libc6 (>= 2.4), libdbi-perl, libdbd-mysql-perl (>= 1.2202), libgcc1 (>= 4.1.1), libncurses5 (>= 5.6), libstdc++6 (>= 4.1.1), libwrap0 (>= 7.6), perl, zlib1g (>= 1.1.4), libaio1, mysql-client-5.6, libssl0.9.8
Replaces: mysql-server-core (<= 5.6.16), mysql-server-core-5.0 (<= 5.6.16), mysql-server-core-5.1 (<= 5.6.16), mysql-server (<= 5.6.16), mysql-server-5.0 (<= 5.6.16), mysql-server-5.1 (<= 5.6.16), mysql-server-5.6 (<= 5.6.20), mysql-server-5.5 (<= 5.6.16), mysql-server-core-5.6 (<= 5.6.20)
Provides: mysql-server-core, mysql-server, mysql-server-5.6, mysql-server-core-5.6

When you save and exit your editor, videbcontrol will save a new file called mysql-server-wsrep-5.6.16-25.5-amd64.modified.deb

You can then install the two .deb packages without any carping. Be sure you install the modified mysql package.

sudo dpkg -i mysql-server-wsrep-5.6.16-25.5-amd64.modfied.deb
sudo dpkg -i galera-25.3.5-amd64.deb 
Modify /etc/mysql/conf.d/wsrep.cnf by inserting the following lines in the [mysqld] section:

wsrep_provider = /usr/lib/galera/libgalera_smm.so wsrep_cluster_address = "gcomm://"

And finally, restart Mysql:

sudo service mysql restart

When you connect to mysql, it should give you the following:

Server version: 5.6.16 MySQL Community Server (GPL), wsrep_25.5.r4064

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Hopefully the version mismatches don't give you any trouble.

2014-08-30

Music of the moment, August 30 2014

Pandora's introduced me to a wide variety of music that's been great.

Ólafur Arnalds is one of those artists that will never really get a ton of traction in the mainstream, much like Jonsi/Sigur Ros, El Ten Eleven, et. al., until his music gets picked up and used on a major commercial project. I sincerely hope it will happen sooner than later, but my gut says it will happen.

While I have a lot of comments about this tune, enigmatically entitled 3055, I think it stands on its own well. Listen to it in a quite time, with an open mind, and let your imagination hear the story being told.

2012-11-04

If you have a passion for the automobile...

read this:
https://intuneingear.wordpress.com/

He gets it. A very tiny sample of why:

Do you even understand how you’re allowed to move forward in a car? We, as a species, have learned how to control explosions. We control explosions to move you forward.
Looks to be new at the blogging gig. I sincerely hope he keeps up with it.

2012-09-22

A short note about Windstream, the ISP I use.

At one point in time, the service where I am was, if not awe inspiring, at least acceptable for everything I do. While the network is my connection to the world (I haven't connected anything but the XBox to the TV), I don't do too much out of the ordinary off of the connection here; web browsing, netflix, online gaming, and the occasional remote session for work when one of my coworkers or customers had something blow up after hours. I'd have to reboot the modem once a week or so, which, while annoying, I could easily chalk up to the house wiring or something weird on the circuit. I do live a few miles from the nearest town, and over 30 miles from anything remotely classified a city. The bandwidth wasn't always what I was promised, but it was often enough and reliable enough that I didn't worry about it. I was a happy customer.

The past roughly two months have not been that way. I get frequent dropouts, massive lag spikes, and it doesn't matter where I measure my bandwidth from, if I get 1Mbps, it's a GOOD measurement. I wouldn't complain about the bandwidth if I'm paying for wasn't 6 times that, but the lag and dropouts are very problematic for gaming, streaming video, and the occasional work I have to do.

Online chat support hasn't been the greatest either. I get the feeling that it's run by people with a script, their wits, and not much other support.

Of the 3 (maybe more... it's been quite a while) support agents I've chatted online with, none of them have asked me to use the Windstream internal speed test at http://speedtest.windstream.net, or asked me for test results from said site. In fact, I've been referred to http://speedtest.net and http://speakeasy.net/speedtest.

One tech (Kenyatta N.) did escalate my request to "an engineer", who apparently did call as promised on 2012-08-27 during the day, and was short to the Mrs. while informing her "it's fixed". Which it really wasn't. The former I can almost forgive, because often engineers are busy. I don't appreciate it at all, but I can understand. The latter is a real problem.

One tech requested remote access to my machine via http://join.me, which I found to be very disconcerting. He poked around a bit like he might have been looking for something specific, but it could just as easily be construed as being nosy on the machine. I allowed it because I keep no sensitive information on the machine, but really? You have to remote in? You can't just look at the stats that the connection has from both the modem (which I know you have some access to) or the DSLAM (which I hope you have some access to) and see "oh hey, there may be some issues here". The speed test from Windstream's network even appears to have numbers for each test run from there that I could give you so you can (or at least should be able to) pull results from that site.

If you're going to allow remote connections from tech support, at least pay for a branded service. Join.me (no offense intended to the people who operate that service) just comes off as a skeezy, "I'm doing this from my bedroom" fly by night operation. I know Windstream isn't the biggest player in the space, but it's certainly more than a single room office in a warehouse.

The last agent (Keith W., who also happened to be the one who asked to remote connect to me) was fairly condescending, and after nearly 90 minutes of "work", said "Let me cycle your connection", which then disconnected me from him, with no hope of actually talking to him again. Not fixing the issue.

I'm not the only one out here who has this problem. There is at least one more who also works in tech, lives in the area, and would like to work from home, but can't because the connectivity out here is so lousy. I've quit bringing my laptop home because it's worthless to even try and get anything done: 90% of my work is on the network.

I'm not asking for the moon, and I certainly don't think I'm whingeing. I'm asking for a fix. Hell, I'd consider forgoing compensation if it can be made right permanently. I'd consider a "business class" connection as well, but currently I'm not convinced that it would change anything except to make my bill larger. I am told by support that all support requests are logged. If that's the case, and you're from Windstream, please look up incident number 13173128 and you should have enough information to find the rest. I assume the tech was honest when I asked them for that information, and it actually exists. The call that landed me that number was made on 2012-08-29, around 2000 Eastern time. The tech (whose name I didn't document, bad customer) had excellent soft skills, but I'm unconvinced that he has the tools to actually fix any problem beyond "Lemme cycle the modem". Which I can do myself.

This could end up being an awesome customer service story. I'd love to write that half, if you'll let me.

2012-06-28

Music of the moment, May 28 2012

I've been saving this one for Memorial day for reasons that will be obvious shortly.

Before that: Thank you to all of our Vets, past and present. You walk the wall many of us would or can not so that we can have our comfortable lives and myriad opportunities. Thank you.

The War was in Color by Carbon Leaf

This is a poignant tune; the lyrics that tug at heartstrings of any who have considered the sacrifices of the military of whatever nation that they come from. They tell a story of a grandfather who actually was in a hot zone (lyrics suggest WWII, Pacific theater), who recounts his time there when his grandson finds a box of photos from that time.
Well written, evocative lyrics can tell stories that can make simple music powerfully emotional. This is one excellent example.

Carbon Leaf's website: http://carbonleaf.com/

2012-02-08

Music of the moment, Feb 8 2012

The internet has opened up venues for what would only otherwise be local cult acts.

Needing/Getting by OK Go

OK Go has, in the particular piece above, combined the art of logistics with the art of music and developed something rarely heard outside of acts like the Blue Man Group. The trademark wild and quirky sound that has dominated their catalog is still there, albeit in a completely different format than their older stuff, due to the nature of the "instruments" "played".

While less musical genius and more creative genius is involved with this tune, it still amuses me in a fashion that I can't quite put a finger on. Perhaps with the visuals and the idea of all the work that has been put into just getting this to the table gives me pause.

OK Go's website: http://www.okgo.net

2012-01-23

Music of the moment, Jan 23 2012

A bit of older music this week:

The Impression that I get by The Mighty, Mighty Bosstones.

The Mighty, Mighty Bosstones came into the pop rock scene in the early to mid 90s with the ska and swing "resurgence". This tune, arguably, is one of the defining tunes of the time.

Sonically all ska (and ska-punk, which is closer to what the Bosstones really fit) is incredibly interesting: You have a mid-range brass/woodwind section, an electric guitar that primarily stays on the top three strings, and lots of high tom/snare/hat work by the drummer. This leaves a HUGE hole for the bass (and sometimes baritone saxophone) to fill. Many of the bassists in this genre do their best to slam a ton of notes into the music to fill that void. The Bosstones often follow that recipe, this tune being no exception, and it works well.

I have a special place for this tune in my heart, evidenced by the fact that I've written about it before.

The Mighty, Mighty Bosstones website: http://www.bosstonesmusic.com

2012-01-16

Music of the moment, Jan 16 2012

A classic tune this week: Lukey, a traditional folk song from the tiny island of Newfoundland.

This particular arrangement is performed by two great bands in the genre, The Chieftans and Great Big Sea. It has the feel of an old sea shanty, and sonically is an acoustic assault on the ear. There is so much going on in the music it's hard to track sometimes, but it comes out as a coherent piece of fun due to the talent that both of these groups bring to the table.

I've found myself drawn to Canadian/Irish folk music over the past few years. The instrumentation is completely fresh to my ear, having followed a gamut of preferred genres through the years from prog rock and metal, to jazz, to pop-rock. Accordion, tin whistle, violin, mandolin, dulcimer... While none unique to the genre, very unique to hear in something that has appeal to those outside of those who grew up with this kind of music.

The Chieftans: http://www.thechieftains.com/
Great Big Sea: http://www.greatbigsea.com