Feb 142014
 

I recently turned up a new RAID array and plopped an XFS filesystem down on it. I didn’t bother setting any specific tunings when I created the filesystem. However I couldn’t for the life of me export any subdirectories from the volume over NFS. Local access was fine and I could export via netatalk and samba.

On the server I saw messages like this in the logs:

Feb 14 13:08:43 monolith rpc.mountd[3092]: authenticated mount request from 192.168.1.50:1003 for /mnt/music (/mnt/music)
Feb 14 13:08:57 monolith rpc.mountd[3092]: authenticated mount request from 192.168.1.50:1002 for /opt/music (/opt/music)
Feb 14 13:15:19 monolith rpc.mountd[3092]: authenticated mount request from 192.168.1.20:717 for /mnt/music (/mnt/music)
Feb 14 13:15:20 monolith rpc.mountd[3092]: authenticated mount request from 192.168.1.20:1001 for /mnt/music (/mnt/music)
Feb 14 13:15:22 monolith rpc.mountd[3092]: authenticated mount request from 192.168.1.20:1002 for /mnt/music (/mnt/music)
Feb 14 13:15:26 monolith rpc.mountd[3092]: authenticated mount request from 192.168.1.20:801 for /mnt/music (/mnt/music)
Feb 14 13:15:34 monolith rpc.mountd[3092]: authenticated mount request from 192.168.1.20:967 for /mnt/music (/mnt/music)
Feb 14 13:15:44 monolith rpc.mountd[3092]: authenticated mount request from 192.168.1.20:794 for /mnt/music (/mnt/music)
Feb 14 13:15:54 monolith rpc.mountd[3092]: authenticated mount request from 192.168.1.20:855 for /mnt/music (/mnt/music)
Feb 14 13:16:04 monolith rpc.mountd[3092]: authenticated mount request from 192.168.1.20:863 for /mnt/music (/mnt/music)
Feb 14 13:16:14 monolith rpc.mountd[3092]: authenticated mount request from 192.168.1.20:932 for /mnt/music (/mnt/music)
Feb 14 13:16:24 monolith rpc.mountd[3092]: authenticated mount request from 192.168.1.20:830 for /mnt/music (/mnt/music)

On the client I would get two different behaviours, depending on whether it was NFSv4 or NFSv3 that was being used. With NFSv4 it would mount the directory, but any attempt to read from it would give a ‘Stale NFS handle’ error:

root:~# mount -t nfs -v 192.168.1.10:/mnt/music /mnt/
mount.nfs: timeout set for Fri Feb 14 16:49:39 2014
mount.nfs: trying text-based options ‘vers=4,addr=192.168.1.10,clientaddr=192.168.1.20′
root:~# ls /mnt/
ls: cannot open directory /mnt/: Stale NFS file handle

With NFSv3 it would just time out, although if I used the -v switch I could see that it was timing out because it was getting ‘Stale NFS handle’ errors during the attempt to mount the directory:

root:~# mount -t nfs -o nfsvers=3 -v 192.168.1.10:/mnt/music /mnt/
mount.nfs: timeout set for Fri Feb 14 16:51:29 2014
mount.nfs: trying text-based options ‘nfsvers=3,addr=192.168.1.10′
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.10 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
<SNIP>
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.1.10 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.1.10 prog 100005 vers 3 prot UDP port 60925
mount.nfs: mount(2): Stale NFS file handle
mount.nfs: Connection timed out

After much frustrated googling I finally stumbled across the answer: inode64. By default NFS still exports 32bit inodes, and XFS by default uses 64bit inodes. There are a few workarounds that worked for me:

1) Export the root of the filesystem and not subdirectories. If you’re in a high trust environment this might be a reasonable solution. However you might not want to export everything on your filesystem, in which case you should look at option 2.

2) You can also manually set the fsid option for each exported subdirectory like this:
/mnt/music 192.168.1.0/24(rw,async,wdelay,insecure,no_root_squash,no_subtree_check,fsid=1)
/mnt/pictures 192.168.1.0/24(rw,async,wdelay,insecure,no_root_squash,no_subtree_check,fsid=2)

I’ve tested both of the above with the following clients: Ubuntu 13.10, FreeBSD 9.2, and Mac OS X 10.9. I don’t actually have any older clients to test with at the moment.

 Posted by at 4:55 pm
Nov 032013
 

I wanted a new system to run as my router, so I set out to find a small system with at least three gigabit NICs. I settled on a Jetway NF9H-525 (also referenced as a NF9HQL-525), which is a mini-ITX board geared for networking applications with four onboard gigabit NICs and a dual core atom 1.8Ghz processor.  I also purchased an LGX MC500 case, two gigabytes of RAM, and pulled a drive out of a recently retired laptop. Bottom line: everything worked great and I would recommend it.

The board has four onboard realtek gigabit NICs (RTL8111/8168B) which use the re driver. They’re not the beloved Intel em NICs, but they’ll do. Especially for the types of applications this board is likely to be used for – like my home networking. Same deal with the intel atom processor. The system can be a bit louder than I would have really liked, but the fan speed stepping does work so it’s only loud when it’s under a bit of load.

I’m not going to bother including any build notes, mostly because I didn’t encounter any gotchas or oddities during the installation or configuration of the system. I read reports online that the NICs require a recent version of FreeBSD, but I didn’t have any issues with 9.2-RELEASE.

 Posted by at 6:44 pm
Oct 312012
 

For the second time now I’ve had an Asus EN9600GT catch fire on me. The first time was a few years ago when I first built my media centre. At the time the media centre was on but wasn’t actually doing anything, when suddenly there was a loud pop and flames shooting out the back of the computer. I RMA’d the device, which is a needlessly painful process with Asus, and installed the replacement.

This evening I was logged into the media centre from another computer and running an update on it (I run MythTV). Suddenly, progress seems to stop. I turn on the TV, and there’s nothing there. I try to power cycle the media centre to no effect. Finally I pull out the computer and pull off the cover – nothing is happening. I pull the power cord, give it half a minute, plug it back in and try again. Fire.

The burned component

The burned component

The first one was far more spectacular than this one. But regardless, I certainly don’t need the extra expense and hassle of having to rebuild or replace my media centre right now.

 Posted by at 10:48 pm
May 142012
 

I’ve been struggling with a pair of issues with forked-daapd recently. I’ve managed to fix one of them for the time being. In particular, with recent versions of iTunes forked-daapd was dropping out after about 5 minutes of audio. I found the issue in the bug tracker on github, and found that some people has taken some stabs at patching the problem. One of them actually succeeded (though no one appeared to be able to post a working .deb).

I used the guide How to: Recompiling / Rebuild Debian / Ubuntu Linux Binary Source File Packages and the patch listed in this comment to sort out the problem. On Debian Testing here are the steps to follow to recreate the solution:

# apt-get install build-essential fakeroot dpkg-dev
# cd /usr/src/
# apt-get source forked-daapd
# apt-get build-dep forked-daapd
# dpkg-source -x forked-daapd_0.19gcd-2.dsc
# cd forked-daapd-0.19gcd/src/
# cp httpd_daap.c httpd_daap.c.bak
# wget https://raw.github.com/kekiefer/forked-daapd/77dc0fd2f466a02b86582ed2c5f97ea6e444f2ac/src/httpd_daap.c
# cd ..
# dpkg-buildpackage -rfakeroot -b
# cd /usr/src
# dpkg -i forked-daapd_0.19gcd-2_amd64.deb

You’re just recompiling the regular debian package but with an updated httpd_daap.c source file. You can also just download the .deb here.

 Posted by at 7:48 pm
Feb 232012
 

Dear Senators,

I’m writing to you about Bill C-10, the Omnibus Crime Bill, hoping to convince you to reject it. Crime has been falling for years in Canada. Mandatory minimum sentences have been a colossal failure south of the border. In a period of deficit spending, do we really need a piece of boondoggle legislation?

The crime rate in Canada has been falling since it peaked in 1992, and in 2006 was the lowest it had been in 25 years. There are pockets of trouble, but these areas are isolated and should be treated for what they are: exceptions. Hot spot policing and other tactics and tools that are already available to police are more than enough to confront these exceptional areas. Overall, the crime rate fell by 5% in 2010, and the severity of crime fell by 5% - in a single year. There is no need for widespread and radical changes to our justice system based on irrational fear and not backed up by actual facts and numbers.

Mandatory minimum sentences have been a total failure in the United States. They represent a judgement by politicians that we can’t trust the judgement of judges. The result south of the border has been prisons that are bursting at the seams to no great benefit for either society at large or the populations inside. Conditions are so bad that the Supreme Court of the United States has declared it cruel and unusual punishment and ordered California to release tens of thousands of prisoners. The United States’ prison population is 2.2 million (2010 numbers), which means they represent the fourth largest city in the states, with more people than Houston and just less than Chicago. If you include everyone under correctional supervision the number jumps to 7.2 million (2009 numbers), which would make it the second largest city, just behind New York. I see no reason to model our justice system on what is clearly failing south of the border – you should not measure the effectiveness of your justice system by the number of people locked up but by how just it is.

The cost of C-10 is projected to be massive. We’re already spending more money than we take in revenue. This is worse than a pointless exercise – it will lead directly to cuts to other programs that could be doing more to make Canada better. If we spent this same money on early childhood care and access to education, on after school programs and sports clubs, and yes, on smarter policing and more courtrooms, we would see a much better return on our investment. Mandatory minimum sentences are just not cost-effective. Not just in terms of criminal acts deterred, but in people potential unleashed. This approach is not soft on crime. Things that are illegal will still be illegal, and the extra police and extra court resources could make sure they were dealt with quickly and effectively. But at the same time, the other programs could help prevent the creation of criminals in the first place.

There is another aspect I would like you to consider: the welfare of the criminals themselves. The crime rate in all western countries has been falling since it peaked in the 80s or early 90s. However, in the United States where mandatory minimum sentences mean millions of people are locked up, the falling crime rate hides an alarming fact: if you include the crimes committed within the prison system, almost all of them violent assaults both sexual and otherwise, the crime rate has not actually fallen that much in the United States. While the rate of sexual assault in the general population of the United States fell by 85% from 1980 to 2005, that statistic hides that there are over 216,000 prisoners raped each year(and that is the estimated number of victims, not the estimated number of actual rapes, as once you’ve been ‘marked’ you can expect it to be a common occurrence). The United States actually holds the dubious honour of likely being the only country in history with more male rape victims than female. Increasing the prison population is inevitably going to lead to higher incidents of assault within the prison system.

Please, assert your constitutional authority and vote to send this legislation back. It’s an unnecessary, pointless, and potentially inhumane waste of already scarce resources.

Regards,
Mike MacLeod
Toronto, ON

PS. I’ve collected here some further reading from a variety of sources, some are used above others are not:
The Economist: What’s America’s real crime rate?
The New Yorker: The Caging of America
Wikipedia: Incarceration in the United States
Wikipedia: Crime in Canada
The Star: 10 Reasons To Oppose Bill C-10
Huffington Post: Occupy the Dream: The Mathematics of Racism
Canadian Lawyer Magazine: A chink in mandatory minimums
Coalition for Evidence-Based Policy: Do Early Childhood Intervention Programs Really Work?
Student Pulse: Preventing Juvenile Delinquency: Early Intervention and Comprehensiveness as Critical Factors
n+1: Raise the Crime Rate
CBC: Mandatory sentences staying in crime bill, Nicholson says
RAND: Are Mandatory Minimum Drug Sentences Cost-Effective?
StatsCan: Police-reported crime statistics

 Posted by at 3:02 pm