søndag den 3. november 2013

Plex Transcoding Problems Solved

I've been getting very frustrated at not being able to watch most of my video content with Plex. In theory, Plex Media Server should be able to stream my stored videos when I'm on the move directly to my iPad or mobile. But in practice it rarely seems to work. I spent an hour or so to do poring over the server logs and it was obvious that it simply wasn't transcoding anything. I don't know where Plex stores temporary files by default, but I'd set it to a location on my SSD disk, and there was simple nothing in there.

Eventually I tracked down the problem to a file-permission issue - the server didn't have write permission to the directory. So all it took was a quick application of chown and everything was solved:  

colin@redick ~ $> sudo chown plex:plex mytmpdir

I have to admit I'm still puzzled as to why it stopped working as it certainly used to. I'm guessing that it some point I accidentally changed the temporary directory from its default value in the web-configuration interface.

fredag den 30. august 2013

Unix Timestamps and Postgres

This is a 100% quickie! Convert back and forward between postgres timestamps and the Unix epoch like this:

 psql=> select extract(epoch from to_timestamp(1354012641));
 date_part
------------
 1354012641
(1 row)

torsdag den 11. juli 2013

Less Than Useful Directory Layout in Plex

The only reason for this post is because I couldn't work out how to make the above image publicly readable in Google+/picasaweb, or whatever it's called these days when I upload a photo from my phone to Google. I have a query about it posted here.

mandag den 8. juli 2013

Linux on a Packard Bell ZA8 Netbook

This smart little notebook is a Packard Bell ZA8. With its AMD L110 1.2Ghz processor and 2GB RAM is should be an ideal candidate for use with a moderately lightweight Linux installation. Well that's what my pal Sergei thought.

However the reality was that as soon as he installed Linux on it he noticed massive image corruption on the screen which made it completely unusable. So, since his time is valuable, and mine not-so-much he handed it over to me with a "you get it to work, you keep it". Challenge accepted!

It didn't take much googling (or thinking) to find that the problem lies with the drivers for the ATI RS690M Graphics Controller. The story, so far as I can understand it, is that ATI stopped releasing Linux drivers for this model in 2009 and has never released a full specification for the cards. Modern versions of Linux come with an open source driver, but as ATI haven't released specs, this is badly broken. Try to run with any resolution over 1024x768 and you're screwed, because the video-ram gets corrupted.

Well I admit this was a headscratcher and I followed a lot of false leads, up to and including hacking into the driver to try to disable the video ram. None of it helped, but eventually I found (with some help from Google, of course) an absurdly simple solution - simply set the video-ram down to 64MB in the kernel boot parameters. And so all that was left was to to remember how the hell to configure GRUB 2 (I miss the old GRUB).

For anyone else who might have forgotten, GRUB is now configured by editing the file /etc/default/grub. Mine now looks like

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash radeon.vramlimit=64"
GRUB_CMDLINE_LINUX=""

Note the "vramlimit"! Now the only thing left to do was follow the instructions at the top of the file and run update-grub, and I was the happy owner of a functioning Linux netbook. Now should I tell Sergei?

Installing Bought Content in Sims 3 for Windows

This is a bit of a diversion from my usual linux nørderi, but in my part-time job as home-head-of-IT I am also responsible for the onerous task of maintaining two installations of EA's beloved Sims 3 on Windows PC. Unfortunately daughter-no-1's PC recently had to be fully reinstalled. Fortunately I was able to extract a backup of her Sims data before the Windoze reinstall, but after reinstalling we had terrible problems reinstalling her online purchases. Essentially we could go through all the motions - ie download + install - but the worlds she'd bought just didn't show up in the game.

You can Google this issue and there are a lot of posts on the subject, which rather tends to confirm my existing prejudice that EA are a bunch of useless jerks who'll be the first against the Wall when the revolution comes. However what eventually worked for me was based on what I found at http://thecurtisparadisshow.ca/gaming/paradisebeach/ . However I was able to take a simpler approach as I actually had two .world files in our Installed Worlds folder. All I needed to do was copy them over to C:/....Program Files (x86)/EA/TheSims3/GameData/Shared/NonPackaged/Worlds and restart the program.

I should point out that I tried a lot of other tricks and tips from elsewhere on the net first, so it's always possible that it was some combination of these  which actually worked in the end. Good luck, and if you have any problems, don't ask me.

lørdag den 6. juli 2013

Intel NUC 847 as an HTPC: Part 1 (Hardware)

So my newest toy is an Intel NUC DCCP847DYE which I'm using as a Home Theatre PC as replacement for the increasingly obsolescent Boxee Box - good timing, eh?
Attractive packaging that plays a little jingle when you open it

So what do you get when you buy a NUC? Well what comes in the attractive packaging is an unprepossessing little grey box with various inputs and outputs, and a power supply (but no mains cable). What you get inside is a motherboard with a dual-core processor, graphics chip, fan, and not much else: RAM, harddisk, WiFi card are all extra.
Unprepossessing

Now I'm well known as a cheapskate, and having just taken out a mortgage for a loft conversion I'm naturally going for the cheapest option for my HTPC. The 847 is the cheapest NUC model and sticking to the barebones philosophy I'm equipping it with a minimum 32GB mSATA SSD and 4GB RAM. I have an old D-Link USB wireless-network card and plenty of power cables lying around so that keeps my total purchase under 2000DKK.

Putting it all together is pretty much too trivial to describe: the SSD fits here and the RAM fits there and you're done and ready to start installing your favourite Operating System. But that's for another post.

mandag den 24. juni 2013

Nightly Backups over smb

This is just a quickie.

I have a usb drive attached to my boxee box which I share over boxee's inbuilt smb server. This is mounted on my server machine with an /etc/fstab line like:

//192.168.0.100/maxell_hdd /home/csr/boxee cifs user,rw,username=guest,file_mode=0777,dir_mode=0777,guest,auto,uid=1000,gid=1000 0 0

So if I want to backup files from my server machine to the boxee on a nightly basis, how do I do it? rsync is a great tool, but I ran into one problem - every so often the boxee would be offline for some reason or other and the rsync would just copy my files into the mount directory, filling my disk up in no time. So I added a test to see if the boxee was actually mounted. The backup script ended up looking like

#!/bin/bash
#
#
volume="/home/csr/boxee"
if mount | grep "on ${volume} type" > /dev/null
then
  rsync -av --modify-window=1 --ignore-existing  /home/csr/media/Music/ /home/csr/boxee/Music
else
echo 'Nightly sync failed becaue of lack of mount'
fi

I put this in a file /bin/backup.sh and then added it to my nightly cron job.

Update

I've now replaced the boxee box with a NUC Linux box to which I have direct ssh access. This means I can replace the above rsync with something like this:

rsync -av --modify-window=1 --ignore-existing  /home/csr/media/Music/ -e ssh colin@192.168.0.155:Maxell/Music

onsdag den 19. juni 2013

Getting from A to C via B (with ssh)

So this is a very typical, but stupid, real-life problem. I need to get some files from machine A to machine C. I have ssh access to machine A only from machine B. From my local workstation I can access machine B and machine C, but not A (except via B). And to make matters more fun, there isn't enough diskspace on machine B to just move the files there first temporarily. Also I only have root access to my local machine so I can't assume that nice tools like sshfs are installed on the any of the other machines.

Here's my solution:
  • From localhost, create an ssh tunnel B->A:
  • ssh -f B_user@machineB -L 9999:machineA:22 -N
  • Create a mount point for the remote directory
  • mkdir my_mount
  • Mount the remote directory (this prompts for the password on machine A)
  • sshfs -p 9999 A_user@127.0.0.1:/data my_mount
  • ... and just copy the files to machine C,
  • scp my_mount/afile C_user@machineC:/home/C_user/data
     
The crucial part is the third step which mounts the remote directory from machine A on my local machine.

Hello

This blog is just a place where I can stick little bits of technical nerdery that I come across in solving the daily problems of life as a software-geek and household-head-of-IT.