Friday 22 August 2014

Wierd goings on with a Live CD and libdvdcss.so.2

I've been messing around trying to make a live-CD with some transcoding/ripping utilities built in to utilize some of the spare hardware I've got lying around. More on this later, but I've been reworking the guide @ http://willhaley.com/blog/create-a-custom-debian-live-environment/ with my own utilities and tools.

One problem I've been challenged with over the last couple of days is HandBrake-Cli bombing out with the message:

root@av3-build2108141:/mnt/Videos/Movies/dvdrip/91# HandBrakeCLI -i BHD.iso -o BHD.mkv --preset="High Profile"
[20:41:41] hb_init: starting libhb thread
HandBrake 0.9.9 (2014070200) - Linux x86_64 - http://handbrake.fr
4 CPUs detected
Opening BHD.iso...
[20:41:41] hb_scan: path=BHD.iso, title_index=1
index_parse.c:191: indx_parse(): error opening BHD.iso/BDMV/index.bdmv
index_parse.c:191: indx_parse(): error opening BHD.iso/BDMV/BACKUP/index.bdmv
bluray.c:2341: nav_get_title_list(BHD.iso) failed
[20:41:42] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Missing symbols in libdvdcss.so.2, this shouldn't happen !
libdvdread: Using libdvdcss version  for DVD access
Segmentation fault

This has been bugging me, as it worked before I converted the image to a livecd.  I wondered if it was some kind of problem with the lack of 'real' disk space, or a lack of memory or something like that, but nothing I could find would identify it.

Finally, I started looking into libdvdcss rather than HandBrake itself.  I think what confused me is the symbols error looks like a warning, especially given that there is a follow-on message which looks like libdvdcss is continuing.  Anyway, eventually!   I ran an md5sum on the libdvdcss.so.2 file to see if it matched a non-live machine (to a virtually identical build).

root@av3-build2108141:/# md5sum /usr/lib/x86_64-linux-gnu/libdvdcss.so.2
4702028ab20843fd5cb1e9ca4b720a72  /usr/lib/x86_64-linux-gnu/libdvdcss.so.2

N.b. libdvdcss.so.2 is symlinked to libdvdcss.so.2.1.0 in my current Debian sid based build.

On the donor machine
root@mediasvr:/usr/lib# md5sum x86_64-linux-gnu/libdvdcss.so.2
c9b314d9ed2688223c427bc5e5a39e6f  x86_64-linux-gnu/libdvdcss.so.2

So I've SCPd the source file into the live machine, checked the md5sum matched the donor machine (it did), and repeated the HandBrake job.  Lo and behold it worked!  So I've restreamed the two files into the filesystem and success, it just works.

So I don't know if something funky happens when the image is created using the link, but actually its quite easy to fix once you understand the problem.

Hope this helps someone,  and I'll be back soon with more details about building a live image, then booting it using iPXE.