Running Binary nVidia Drivers under Xen Host

Submitted by jbreland on Sun, 06/22/2008 - 01:50

In my last post I mentioned that I recently had a hardware failure that took down my server. I needed to get it back up and running again ASAP, but due to a large number of complications I was unable to get the original hardware up and running again, nor could I get any of the three other systems I had at my disposal to work properly. Seriously, it was like Murphy himself had taken up residence here. In the end, rather desperate and out of options, I turned to Xen (for those unfamiliar with it, it's similar to VMware or Virtual Box, but highly geared towards server0. I'd recently had quite a bit of experience getting Xen running on another system, so I felt it'd be a workable, albeit temporary, solution to my problem.

Unfortunately, the only working system I had suitable for this was my desktop, and while the process of installing and migrating the server to a Xen guest host was successful (this site is currently on that Xen instance) it was not without it's drawbacks. For one thing, there's an obvious performance hit on my desktop while running under Xen concurrently with my server guest, though fortunately my desktop is powerful enough that this mostly isn't an issue (except when the guest accesses my external USB drive to backup files; for some reason that consumes all CPU available for about 2 minutes and kills performance on the host). There were a few other minor issues, but by far the biggest problem was that the binary nVidia drivers would not install under Xen. Yes, the open source 'nv' driver would work, but that had a number of problems/limitations:

  1. dramatically reduced video performance, both in video playback and normal 2d desktop usage
  2. no 3d acceleration whatsoever (remember, this is my desktop system, so I sometimes use it for gaming)
  3. no (working) support for multiple monitors
  4. significantly different xorg.conf configuration

In fairness, issues 1 and 2 are a direct result of nVidia not providing adequate specifications for proper driver development. Nonetheless, I want my hardware to actually work, so the performance was not acceptable. Issue 3 was a major problem as well, as I have two monitors and use both heavily while working. I can only assume that this is due to a bug in the nv driver for the video card I'm using (a GeForce 8800 GTS), as dual monitors should be supported by this driver. It simply wouldn't work, though. Issue 4 wasn't that significant, but it did require quite a bit of time to rework it, which was ultimately pointless anyway due to issue 3.

So, with all that said, I began my quest to get the binary nVidia drivers working under Xen. Some basic searches showed that this was possible, but in every case the referenced material was written for much older versions of Xen, the Linux kernel, and/or the nVidia driver. I tried several different suggestions and patches, but none would work. I actually gave up, but then a few days later I got so fed up with performance that I started looking into it again and trying various different combinations of suggestions. It took a while, but I finally managed hit on the special sequence of commands necessary to get the driver to compile AND load AND run under X. Sadly, the end result is actually quite easy to do once you know what needs to be done, but figuring it out sure was a bitch. So, I wanted to post the details here to hopefully save some other people a lot of time and pain should they be in a similar situation.

This guide was written with the following system specs in mind:

  • Xen 3.2.1
  • Gentoo dom0 host using xen-sources-2.6.21 kernel package
    • a non-Xen kernel must also be installed, such as gentoo-sources-2.6.24-r8
  • GeForce 5xxx series or newer video card using nvidia-drivers-173.14.09 driver package

Version differences shouldn't be too much of an issue; however, a lot of this is Gentoo-specific. If you're running a different distribution, you may be able to modify this technique to suit your needs, but I haven't tested it myself (if you do try and have any success, please leave a comment to let others know what you did). The non-Xen kernel should be typically left over from before you installed Xen on your host; if you don't have anything else installed, however, you can do a simple emerge gentoo-source to install it. You don't need to run it, just build against it.

Once everything is in place, and you're running the Xen-enabled (xen-sources) kernel, I suggest uninstalling any existing binary nVidia drivers with emerge -C nvidia-drivers. I had a version conflict when trying to start X at one point as the result of some old libraries not being properly updated, so this is just to make sure that the system's in a clean state. Also, while you can do most of this while in X while using the nv driver, I suggest logging out of X entirely before the modprobe line.

Here's the step-by-step guide:

  1. Run uname -r to verify the version of your currently running Xen-enabled kernel; eg., mine's 2.6.21-xen
  2. verify that you have both Xen and non-Xen kernels installed: cd /usr/src/ && ls -l
    • eg., I have both linux-2.6.21-xen and linux-2.6.24-gentoo-r8
  3. create a symlink to the non-Xen kernel: ln -sfn linux-2.6.24-gentoo-r8 linux
  4. install the nVidia-drivers package, which includes the necessary X libraries: emerge -av nvidia-drivers
    • this will also install the actual driver, but it'll be built and installed for the non-Xen kernel, not your current Xen-enabled kernel
  5. determine the specific name and version of the nVidia driver package that was just installed; this can be found by examining the output of emerge -f nvidia-drivers (look for the NVIDIA-Linux-* line)
  6. extract the contents of the nVidia driver package: bash /usr/portage/distfiles/NVIDIA-Linux-x86_64-173.14.09-pkg2.run -a -x
  7. change to the driver source code directory: cd NVIDIA-Linux-x86_64-173.14.09-pkg2/usr/src/nv/
  8. build the driver for the currently-running Xen-enabled kernel: IGNORE_XEN_PRESENCE=y make SYSSRC=/lib/modules/`uname -r`/build module
  9. assuming there are no build errors (nvidia.ko should exist), install the driver:
    • mkdir /lib/modules/`uname -r`/video
    • cp -i nvidia.ko /lib/modules/`uname -r`/video/
    • depmod -a
  10. if necessary, log out of X, then load the driver: modprobe nvidia
  11. if necessary, reconfigure xorg.conf to use the nvidia binary driver rather than the nv driver
  12. test that X will now load properly with startx
  13. if appropriate, start (or restart) the display manager with /etc/init.d/xdm start

Assuming all went well, you should now have a fully functional and accelerated desktop environment, even under a Xen dom0 host. W00t. If not, feel free to post a comment and I'll try to help if I can. You should also hit up the Gentoo Forums, where you can get help from people far smarter than I.

I really hope this helps this helps some people out. It was a royal pain in the rear to get this working, but believe me, it makes a world of difference when using the system.

Server Outage

Submitted by jbreland on Sun, 06/01/2008 - 04:22

In case anyone was wondering why legroom.net was offline for the past few days, it's because of a hardware failure that occurred Thursday morning. The server hosting legroom.net failed due to a yet unknown hardware issue. As a result, all web/mail/database/file/etc. services have been unavailable since then. As of early Sunday morning, I just finished migrating all of the data from the old server (well, I hope I got all of it) to a new OS install on a different, though temporary, system. As far as I can tell, all internet functionality should be restored at this point, including e-mail.

Needless to say, this was a major inconvenience, but I'm reasonably certain I didn't lose any data. However, if you happen find any errors on the site, or any missing content, please let me know ASAP. Also, if you sent me an e-mail at any point from Thursday morning to Sunday night, please resend it as I may not have received it.

This site will probably go down a couple more times, albeit very briefly, over the next couple of days as I continue working on the migration. I still have a few remaining issues to take care of. I'm hoping that by Tuesday the site will be up again for good (at least until the next migration to a permanent home...).

NAS Server Specs

Submitted by jbreland on Mon, 03/17/2008 - 03:18

Updated: 06/16/2008
I finally ordered my hardware. I also finalized the list of components below and provided more details, rationale, and commentary about their selection. I also still need to finish some of the details of this post, which I've put off way to long (and I'm going to put off a bit longer), but that will eventually happen. Also, once I start building the NAS I'm going to document the pros/cons and any gotchas involved in setting up the system. Stay tuned.

For the past couple of months I've been researching various home NAS (network attached storage) solutions. Currently, all file-serving and backups are handled by a desktop system in my living room - which also handles my website and e-mail, multimedia functionality (hence running it in my living room), and a whole lot more. As I'm getting rather tired of the noise and recent instability, I want to migrate all functionality off of this system onto other systems/servers better suited to the tasks. My first step is setting up a NAS system for my house.

As I said above, I've been researching this for quite some time now, mostly because I'm having trouble deciding which direction I want to take. The two main choices are:

  • Setup a commercial NAS appliance (such as the Linksys NAS200)
  • Build a dedicated NAS system, based on something like FreeNAS

A commercial appliance would be the much simpler route, and is mostly what I'd been researching, but for various reasons I'm actually learning towards building a dedicated system now. The primary reason, to be completely honest, is flexibility. If I build my own hardware and install a "real" OS on it, even though it may be used specifically designed to function as a NAS device I still have the ability to do anything else with it that I may want or need. With an appliance, I'm much more limited in what I can do here (if it's even possible at all). Some appliances do allow remote console access, but every one I've seen is very vague on details as far as what can be done once you've logged in. Without being able to test it out myself, I have to assume that I won't meet my requirements.

So, why is building a dedicated system such a hard decision? This breaks down into two categories:

  • power, heat, noise (ie., efficiency)
  • NAS functionality

Let me address the efficiency issue first as it's more straightforward. This box will be running 24x7, and I want something that's going to be as quiet and energy efficient as possible. The majority of the appliances I've looked at were designed with this in mind, and while some are much better than others, all are more efficient than a typical desktop system. I want to stick this thing in a corner and not ever see it or hear it; just have it run reliably and not make a significant dent in my power bill.

The functionality issue is a bit more complicated. I stated previously that flexibility was the primary reason I wanted to build my own system, which may seem to contradict with this current statement, but they apply to different scopes. The former is about OS-level functionality; the latter is more about hardware functionality. Eg., two features I'd really like from my NAS are hardware RAID 5 using four disks and hot-swappable drives, both of which a fairly among among higher-end home NAS appliances. Hardware RAID is easy enough to do on a custom built system, but how-swappable drives is a completely separate issue; short of a rack mount server or tower-style case (both of which are ruled out by the noise/efficiency requirements), options are extremely limited.

With all that said, here are the components that I'm currently looking at. Any and all feedback, especially regarding personal experience, is most welcome.

Unlike most custom built systems where the case is a fairly insignificant component, this choice of components in this system is almost entirely dictated by the case as I've only been able to find one that meets both the noise/efficiency and NAS functionality requirements described above. As a result, my requirements (and personal preferences) are:

  • Mini-ITX motherboard
    • integrated gigabit ethernet
    • single PCI-X or PCI-e slot
    • support for at least two GB RAM
    • optional: integrated CF (compact flash) support for OS drive
  • low-voltage/wattage processor
  • low-profile, 4-port SATA II RAID card
    • must be fully supported by both Linux and FreeBSD
  • three energy-efficient 1 TB SATA II hard drives

Case
Chenbro ES34069 - $187 (Lagoom)

The case is the defining feature of this system. Whereas the system case can usually be considered an afterthought in most computer systems, for this project it was absolutely key. I wanted something small, quiet, and yet flexible enough to do whatever I needed. The hot-swappable drive bays in particular were a huge selling point. That, combined with the looks and form factor, is what ultimately convinced me that I could make a custom built system fit my needs rather than going with an appliance solution.

As a result, the case largely dictated much of the component selection below. It has a very unique form factor, which imposes several requirements on component choices. If anyone building a NAS decides to go with this case, be sure to do a lot of research on what can/can't be used. It looks like a slick little case, though, and if things work out as expected it should definitely be worth it.

Motherboard/CPU
VIA EPIA SN10000EG - includes VIA C7 1.0 GHz processor w/ passive cooling - $247 (Logic Supply)

Motherboard/processor selection was a really, really tough choice. I looked at many different options, covering the range from full dual-core Intel / AMD desktop procs to ultra low-voltage systems such as teh AMD Geode and integrated VIA processors. I ended up choosing the the EPIA SN10000EG motherboard based on a number of factors, including:

  • cost
  • availability
  • performance
  • efficiency
  • passive cooling
  • integrated features
  • add-on slots

Note that the above list is not all "pros" for this board; it's simply a list of all factors that I considered. For example, I would've much preferred a dual-core 64-bit system, but the desktop choices were more power hungry than I wanted and the lower voltage solutions ("mobile on desktop") were of limited availability and maturity and prohibitively expensive. Most Mini-ITX systems are for some reason considered "industrial", which is just way of saying "expensive". $250 for a Mini-ITX motherboard and processor w/ integrated video is, sadly, pretty cheap compared to some of the other choices I explored.

Once I had decided on a VIA board, I looked at both the SN10000EG and SN18000G really hard, which are both essentially the same board though one uses a 1.0 GHz processor w/ passive cooling while the other uses a 1.8 GHz processor w/ active cooling. I actually had to fight my natural instincts to go with the faster board hear. If I was not including a high end hardware RAID controller in the mix then I definitely would've done with the SN18000G. However, I am including the RAID controller, while will take care of pretty much all of the disk processing. As a result, the more limited 1.0 GHz processor should be plenty enough to drive the gigabit NIC and take care of any other overhead. Plus, I like the fanless design and the fact that it draws literally half the power of the 1.8 proc. Like I said in my long introduction, power and noise are primary factors.

It's also important to mention that people building their own NAS systems in the future will actually have more/better options here than are available today. In particular, both the Intel Atom and Via Nano processors appear to be very very well suited for this type of system, packing plenty of power in a compact, low-power design. I'd especially love to use a Nano-based system for this, but it'll be several months before such systems are available.

Memory
PNY MD2048SD2-667 - 2 GB DDR2-677 DIMM - $37 (Newegg)

RAM was basically an arbitrary selection - the above appears to be good RAM for a good price. However, RAM height matters here. From what I've read, if a CD-ROM drive is included in the case, then the drive will sit right on top of the RAM. Tall RAM will not fit. The SN10000EG motherboard I selected also poses a problem - since it includes a built-in compact flash card reader on the underside of the board, the board sits up a bit higher than usual. As a result, RAM height is even more of a issue.

I'm hoping that this DIMM will fit. I'll certainly report on it when I start building the system. From what I can tell now, it appears that if you're only using one DIMM, and a CD-ROM drive, you should be ok. If you plan on using two DIMMs, the CD-ROM will sit directly over the second DIMM, and as a result you'll need to get low profile RAM to fit it in. Alternatively, of course, the CD-ROM drive can be omitted.

RAID Controller
3ware 9650SE-4LPML - $340 (Lagoom)
PCI Express Riser Card (PCIX-1A) - $12 (Logic Supply)

The RAID card is another cause for concern. The special form factor case means that there isn't any standard method to secure add-on cards in place (eg., as you would screw a PCI card into the rear of a typical case). Chenbro makes a special PCI riser card and face plate for this, but it's limited to 32-bit PCI only, and only one recommended motherboard (hint: it's not the one I chose). As a result, I'm gambling a bit on the RAID card. I should be able to make it fit in the case with the above PCI-e riser card, but I'm not sure how/if I'll be able to secure it. Again, I'll report on this in more detail once I begin building the system.

As for the choice of RAID controller, I want with a high end 3ware card simply because I know it'll work and work well. Some things are worth paying for, and this is one of them.

Hard Drives
RAID 5: Samsung SpinPoint F1 HD103UJ 1 TB - $166 (x3) (Lagoom)
System: Transcend TS4GCF300 4 GB - $53 (Newegg)

Why terabyte drives? Why not? In all honesty, while they still carry a pretty decent price premium at this point, they're also among the best performing and quietest drives due to their high aerial density. Plus, they're huge. I'm building this system to act as the central file server for my entire home network, and quite frankly, I don't want to ever have to worry about running out of space on this system. With 2 TB of usable disk space (3-1 for the RAD 5), I'll have plenty, plenty of space to work with for the foreseeable future, and in the very unlikely event I manage to fill that up I can still slap one more TB disk in there at any time.

I chose the SpinPoint F1 drives not because the are the fastest, or quietest, or most efficient. Rather, I chose them because they are probably the best combination of all three factors. I spent a lot of time looking at various hard drives, evaluating them on these three criteria, and the SpinPoint F1 looks to be the leader of the pack at this point. Here are some detailed statistics if you're interested, courtesy of Storage Review.

The SN10000EG motherboard that I chose included a built-in compact flash card slot that's supposedly treated as an IDE device. As a result, I decided to go with a CF card as my main system drive. This will let me keep my OS install separate from the data drive RAID, and will generate less heat and noise than a normal hard drive as there are no moving parts. Of course, performance and lifecycle are concerns when using CF cards like this, but I plan on running my system mostly off of a ramdisk (hence the need for 2 GB). I'll discuss this more in my follow-up.

Optical Drive
Samsung SN-M242D - $40 (Lagoom)

This was another arbitrary choice, but I've had decent luck with Samsung drives in the past and I liked the specs on this one. I should mention, though, that for this type of system a built-in CD-ROM drive is largely optional. It's needed to install the OS and nothing else. If you have a USB CD-ROM drive (or even a key drive) available, you could easily connect that temporarily to install the OS. In this case, I opted for the drive to have literally in case of any emergency situations - eg., my system died for some reason, and I need to boot off a rescue CD to recover/repair ASAP.

Video Card
integrated

Power Supply
integrated

Network Interface Card
integrated

Sound Card
integrated

Input Devices
N/A

Operating System
OpenFiler (rPath Linux) or FreeNAS (FreeBSD)

Currently I'm leaning toward OpenFiler as I have a heavy Linux bias, but FreeBSD seems to enjoy a stronger community following. I plan on investigating both. If both distros support my hardware properly, then all things being equal I'll stick with OpenFiler. However, I'm certainly not ruling out FreeNAS just yet.

Cost
The total cost of this system ended up being significantly higher than I first expected: $1425.29, plus tax and shipping. This is extremely pricey for a home NAS server, even a custom built one. In my case, I had certain requirements that I wanted to meet at all (reasonable) costs, and I feel the price was worthwhile. For anyone else, though, there are a few places where scaling back would save a lot of money.

RAID Controller - This was the single most expensive component. Find a motherboard that supports 4 SATA ports and setup either software RAID or on-board (fake hardware) RAID. It's definitely not as efficient or reliable, but it may work well enough depending on the requirements.

Hard Drives - I used three terabyte drives, which still carry a hefty premium. If you don't need an insane amount of storage room, consider smaller drives. For example, the 500 GB Western Digital Caviar SE16 (WD5000AAKS) can be picked up on Newegg for only $80, less than half the price of the terabyte drives I used. You can buy 4 of these for only $320, which in a RAID 5 array will still give you 1.5 TB worth of usable disk space. Also, you can skip the separate system drive (in my case, a compact flash card) and just install the OS directly on the RAID.

Case - There's no way around it - this is an expensive case. Unfortunately, if you want a compact, attractive, custom-built system w/ hot-swappable drives, this is pretty much your only choice at this point. However, if aesthetics and hot-swappability is not a primary concern, there's no reason you should need to spend more than $100 on a case, at the high-end.

Motherboard / Processor - Going with a different case will also likely free up some additional motherboard options. Eg., going with a standard ATX motherboard, or even a micro-ATX motherboard, will be far cheaper than a mini-ITX system.

Starting from scratch, and taking the above points into consideration, you should be able to knock at least half the price off of my system configuration, and even much more than that if focusing on budget rather than performance/features. Be sure to keep this in mind when spec'ing our your own system; don't let yourself be surprised by the total bill like I was. ;-)

To complete:
For reference, here are the best appliance options I found:
to complete - QNAP, Storango, Irfrant, Thecus?

Geek Humor

Submitted by jbreland on Mon, 12/31/2007 - 03:13

I've been out of town for a while, and before that rather busy with work. Obviously, I haven't gotten much done on the site. However, once again I felt the need to post a quick note just to let everyone know that yes, I am still alive.

And with that said, I'd like to wish a belated Merry Christmas and early Happy New Years to all my family, friends, and visitors.

Also, I'd like to leave you with this xkcd comic. I'm sure the simple fact that it's 3:00am right now has a lot to do with it, but this just struck me as one of the funniest things I've read all week. Warning: as noted in the title, prepare for hardcore geek humor.

Project/Website Status

Submitted by jbreland on Wed, 11/21/2007 - 06:05

I haven't made very many posts lately, so I just wanted to update everyone that may be wondering what's going on. I've been insanely busy with work, both with my day and side jobs, and I just haven't had much time to work on personal projects. I definitely have some stuff in the works, just finding the time to move forward on any it is really hard to do lately.

I released a beta version of Universal Extractor v1.6 a while back now. That's pretty much ready for release right now, and has been for a couple weeks. I just need to polish a few last things related to the installer and language files, update the website with all of the appropriate new information for the release, and then put it out there. I'm hoping to dedicate some time to finishing this up soon.

I've actually begun working on a new version of AutoFLAC as well, but so far changes have mostly been limited to bug fixes and efficiency/workflow updates. I have some ideas for some pretty useful new features (aside from all of the issues that have been discussed in the Hydrogenaudio AutoFLAC thread), but it'll take a while to implement everything and put out a new release. In the meantime, just rest assured that this project has definitely not been abandoned, despite the fact that it's been over a year since the last release.

Less obvious to most visitors are the various website updates I've slowly been working on. Most of this involves restoring administrative functionality that was lost in my migration from PostNuke to Drupal a few months back (for a good example of this, see my last last post), or introducing some "private" features of the website, such as a new webmail system, that's restricted to specific users. I've also been (slowly) working on various other updates and under-the-hood tweaks to the site and server to keep things running as smoothly as possible.

So, yes, I'm still around, and this website (and associated projects) is still under development. Also, even if I'm busy and things are moving slowly, I'll try to at least update my website more than once a month. :-)

Wishlist Updated

Submitted by jbreland on Wed, 11/21/2007 - 05:46

I finally got around to updating my Wishlist earlier tonight. I'd been putting it off for some time because I still haven't completely finished re-implementing the admin interface that allows me to add/update/remove items since moving to the new site a few months back. However, since Christmas is coming and I'm already being asked, "what do you want?", I figured it's about time to start working on it again. I can now add items through the administrative web interface (woo-hoo), but removing and modifying existing items still requires direct database edits (boo). I'll get around to finishing that part as well as soon as I can figure out Drupal's really, really odd method of form handling with tabular data.

Also, I used this opportunity to make a couple changes to the wishlist. I'm now including the Date Added, so you can tell how old (or new) a particular item is. Anything already on the list from before the migration will just have a blank value here. I've also begun adding links to Best Buy, since it's sometimes easier to purchase items in a physical store than order them online. And finally, each column is now sortable, so you can sort by things like cheapest or most recently added. Just click on the title of whichever column you'd like sorted.

So anyway, for those of you that may interested in purchasing something for me, my Wishlist page is now current. Enjoy.

Edit: I added a "Last Updated" field as well, in the upper-right corner of the page. Use this to determine at a glance how long it's been since I last updated the wishlist.

Website Upgrade

Submitted by jbreland on Thu, 10/18/2007 - 20:37

I just upgraded LegRoom.net to Drupal 5.3. Everything should be in good order, but in case you find any errors on the site please let me know ASAP so I can correct them.

Thanks.

Request: Slovak Translation Update for UniExtract 1.6

Submitted by jbreland on Sun, 09/30/2007 - 23:20

I'm trying to get in touch with Peter Ž., aka zilabo. If you're reading this, please contact me regarding your Slovak translation. I tried e-mailing you a couple of times, but it appears that the e-mail address I have for you is no longer valid.

Also, if anyone else is able (and willing) to provide a Slovak translation, feel free to contact me as well. If I don't hear back from zilabo, I'll have to drop the translation going forward unless someone else is willing to maintain it.

Thanks.

Updated 10/25/2007:
Nevermind! I got a couple offers, and I truly appreciate them, but the original author recently got back in touch with me. His translation will be included in v1.6.

Thanks anyway!

Sexism on the Internet?

Submitted by jbreland on Fri, 09/28/2007 - 09:52

While the title sounds like this should be some deep, thought-provoking post, it's actually just a link to a comic. Sorry to disappoint. However, the comic is pretty much right-on. I've seen a lot of this myself, and just recently read an article about this kind of behavior even at mainstream IT conferences. Definitely a sad trend.

With all that said, the comic is also pretty darn funny. :-) Check it out - Pix Plz

Note: This is from a webcomic that I recently began reading called XKCD. It's pretty funny, though very geek-oriented. If you enjoy the Pix Plz comic, you may want to check out some of the previous strips as well.

Web Server Upgraded

Submitted by jbreland on Fri, 09/28/2007 - 02:17

I just upgraded the LegRoom.net web server to Apache 2.2.6, which is a major upgrade over the previous 2.0.x version. I also upgrade PHP to address some security issues. It took me about an hour to migrate the site configuration, but I think I have everything up and running properly. If you encounter any error on with the website, please let me know ASAP so I can correct it.