Tag Archives: Linux

Graphics Driver Headaches

Nothing like computer problems when you’re trying to wrap up your dissertation to really make your day…

Quick tl;dr version: I’ve had a lot of problems with NVIDIA Linux drivers 337.x and even more with 340.24, at least on dual Quadro K600 cards driving four displays using basemosaic. No such problems under 331, but Debian didn’t package the 331 update that supports the current xorg-server ABI. I took their 331.79 package and updated it with the upstream 331.89 version, which fixes a few bugs, adds two PCI IDs, and adds support for the newer xorg-server ABI. Here are the source package, as well as the build results from my i386 and amd64 jessie cowbuilders. Use at your own risk, but they work great for me so far. You’ll have to pin the versions otherwise it’ll try to upgrade after you install them.

The standard disclaimers (no warranty, not responsible for problems, crashes, nasal demons, etc) apply: use at your own risk.

After the jump: deb packages, source packages, source debdiff, problem description, process, and lessons learned.

Continue reading

Building xpra on RHEL6 as a normal user

Xpra is described as “screen for X”, and while that’s true, I’ve never really used GNU screen much. What I use it for, though, is provide a much faster substitute for X forwarding (even on a local network).

I have access to a nice machine that I’d like to work remotely on. Two catches: I’m not root, and it’s running RHEL6 with minimal extra package repos. To install software locally, I use GNU stow along with some nice setenv action in files sourced by .cshrc. Here is what I was able to do to get Xpra running at a minimum capacity.

Note: $STOW is whatever your stow directory is – all the stow documentation essentially assumes that it’s /usr/local/stow, but in my case it happens to be (wait for it) /home/users/rpavlik/linux/stow/rhel6/stow. Yes, I could have probably chosen a location with a shorter pathname, but inertia makes it not worth changing at this point. I’ll use $STOWPREFIX to refer to wherever stow links things into, usually the parent directory.

  1. I asked my friendly department IT folks to install the dependencies from https://www.xpra.org/trac/wiki/Building – which in my case, wasn’t exactly what happened since EPEL or other package repos are off-limits, but I ended up with whatever the latest official versions are of those dependencies for RHEL6.
  2. Grabbed Cython 0.20.1 since the RHEL6 Cython is too old. Copied the contents of the tarball into $STOW/Cython-0.20.1/lib64/python except for the bin directory, which instead went became $STOW/Cython-0.20.1/bin. Stowed Cython-0.20.1 – note that this is a build-time dependency only (I think).

  3. Made sure that I had my PYTHONPATH environment variable set to include (it may be empty to start) $STOWPREFIX/lib64/python. On the next login, I checked that which cython and cython -V reported values that I expected.

  4. Grabbed Xpra 0.11.6 and unpacked it. I initially built without a lot of ffmpeg/libav stuff, but it turns out that there are patches in the source tree to handle old versions. I patched with these commands:

    • patch -p1 < patches/old-libav-pixfmtconsts.patch (replaced --without-csc_swscale flag)
    • patch -p1 < patches/old-libav-nofree.patch (replaced --without-dec_avcodec flag)
  5. In the source directory, I ran ./setup.py install --home=$STOW/xpra-0.11.6 -without-vpx which almost worked except for one place where it tried to write to /etc. I applied this trivial patch to correct that.

Adding --without-client to the build command is an option I considered since I typically use this home directory on a headless machine, but it’s shared with headfull machines which I might want to use as Xpra clients someday.

And…. that worked! I had to run with --no-mdns since I didn’t apparently have the Avahi mDNS python module installed on the system, but that’s a minor issue easily worked around.

Making a CMake-based build install software in de-facto standard locations

This post falls partially into the “Note to self” category. I typically set up CMake variables for “bin”, “lib”, “share”, and so on to use when installing software (or building it if I want it to run in the build directory and it’s stubborn about layout). Turns out that there’s a module called GNUInstallDirs that was added to CMake in 2.8.5, and improved since then, that sets these up in a standard-ish way. Furthermore, when distros package CMake, if they don’t follow the defaults, they typically patch this file so it applies, so this really takes care of the whole “what to call the library directory” mess quite nicely.  The canonical source documenting the meaning of these variables comes from the GNU project, but I’ve separated the most common ones below (listed ready to copy-and-paste into your build):

  • ${CMAKE_INSTALL_BINDIR} aka “bin”
  • ${CMAKE_INSTALL_LIBDIR} aka “lib” or “lib64” or something more complicated for Debian multiarch
  • ${CMAKE_INSTALL_INCLUDEDIR} aka “include”
  • ${CMAKE_INSTALL_DATADIR} aka “share” – not sure what the difference between this and DATAROOTDIR is, but it appears nobody else does either, so I’m just gonna roll with it.

As a side effect, you’ll get a unixy layout on other operating systems too, but as I already was doing this, it’s cool with me.

Using dfu-programmer with an Arduino Uno R3

Sometimes, whether intentionally (you want to “be” a different USB device) or unintentionally (your board is bricked), you want to replace the firmware on the little atmega usb chip used on the Arduino Uno.  Unfortunately, most of the instructions out there are for the Uno R2 or earlier: the R3 has a slightly different chip.  Adding to the trouble, the Linux/Mac tool for doing this operation (a “DFU upload”) has different USB product IDs than expected.  So, here’s the differences from the earlier Uno (with ATMEGA8u2) to the latest R3 (with ATMEGA16u2):

  • The dfu-programmer command line should contain at90usb162 instead of at90usb82.
  • If the version of the dfu-programmer you’re using (which includes the latest SVN as of this posting) doesn’t recognize it, you’ll want to get the latest source code and apply this patch, which adds a different device name (at90usb162unor3 instead of at90usb162) that uses 0x2FEF as the product ID.  (Thanks to http://forums.adafruit.com/viewtopic.php?f=25&t=25146 for the tip which led me to create the fix.)  I opted to add a new device type, rather than change the existing one, in case someone actually takes the patch upstream and if the original product ID is correct for some devices, just not our Arduinos.
  • I used the Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex firmware file and had to pass the –suppress-bootloader-mem flag to the dfu-programmer flash command for it to work.

Recommended PPA + Third Party Repositories

I’ve been setting up a number of new Ubuntu installs recently, and so I thought it would be useful to record somewhere the Personal Package Archive (PPA) and third-party repositories I frequently use. You can add any of these with sudo add-apt-repository or by pasting them into the add repository dialog in Software Sources.  I have all these enabled on Lucid successfully, but no guarantees that they will all successfully coexist without breaking things on your system, Lucid or otherwise.

  • General Software
    • ppa:chromium-daily/stable – the Chromium stable channel. If you prefer the Google Chrome version, try:
    • deb http://dl.google.com/linux/chrome/deb/ stable main – The Google Stable channel. For the key, look at ubuntu-tweak.com/source/google-chrome/
    • ppa:sevenmachines/flash – 64-bit Adobe Flash, install package “flashplugin64-installer”
    • ppa:libreoffice – Updates to LibreOffice, the future of OpenOffice.  Still incredibly slow, but sometimes it’s all you can use.
    • ppa:ubuntu-wine – The latest Wine stable and dev releases.
    • ppa:lucid-bleed – If you want lots of backports to Lucid, this is the repo to enable.
    • ppa:maco.m/ruby – Updated version of rubygems
  • Graphics (XOrg, drivers) Improvements
  • Programming-related
    • ppa:kubuntu-ppa/backports – Backports of newer Qt versions including Qt Creator.
    • deb http://streaming.stat.iastate.edu/CRAN/bin/linux/ubuntu/ lucid/ – Updates for R from the ISU CRAN mirror.  If you’re not using Lucid, change the release codename in this line
    • ppa:pyside – PySide is the LGPL replacement for PyQt that works pretty well. It’s under plenty of development so the PPA is useful.
    • ppa:git-core – Updates to the Git version control suite.
  • VR-Related – Of course I had to plug some of the PPA’s I maintain for the lab. Help maintaining these is always welcome!
    • ppa:isu-vrac/osg – Updated versions of OpenSceneGraph.
    • ppa:isu-vrac/vr-software – VR Juggler and its dependencies.

Enabling the hardware power button in Ubuntu Server 11.04 (Natty)

Just a quick note for my reference and for Google: If you want your Ubuntu Server machine to respond to the power button, you have to install acpid first.  Once installed, it will run by default (and start up during the install process), so the power button should be functional from then on.  This should also create the /etc/acpi directory and scripts that folks mention when discussing Linux power management.

Credit where credit is due: figured it out from this bug report resolved as INVALID with this workaround which, while old, still applies to the latest Ubuntu release.

Setting a “Task Manager” keyboard shortcut in GNOME

If you’re much of a Windows user, you’re probably aware that Ctrl-Shift-Esc will quickly open the task manager there, which is a handy thing to be able to access quickly – take care of an out-of-control app, see what’s pulling so much CPU power, etc. On GNOME (for instance, Ubuntu Linux), the System Monitor does the same task, but there’s no equally quick way to open it by default. You can add the system monitoring applet to your panel which will give you one-click access, but if you’re like me, you find yourself reaching for Ctrl-Shift-Esc first anyway.

Without further ado, how to make Ctrl-Shift-Esc do the same thing! (This is on Ubuntu Lucid, but should be pretty similar on most GNOME desktops.)

  1. Open the Keyboard Shortcuts control panel. For me, it’s in System, Preferences. (This is a per-user setting.)
  2. You might want to collapse all the existing groups so you can see where your new item will be added.
  3. Click “Add”, and enter:
    • Name: System Monitor
    • Command: gnome-system-monitorCustom Shortcut Window
  4. Click on the newly-added entry, and press Ctrl-Shift-Esc to record the new shortcut.Keyboard Shortcuts Window
  5. Close the control panel and try it out!

VR Juggler 3.0 packages updated for Ubuntu Natty

Just a quick heads-up: I’ve updated the VR Juggler Ubuntu/Debian packages I maintain on Gitorious and that are built in this PPA repository. There is now a Ubuntu 11.04 (“Natty”) build of VR Juggler 3.0 and its dependencies alongside the other distributions. The instructions I previously posted on installing VR Juggler on Ubuntu from packages is still accurate and now applies to those of you using the latest Ubuntu release.

There were only minor changes from the Maverick packages. Most notably, the Audiere plugin for Sonix is gone because Audiere is no longer being packaged or distributed by Ubuntu or Debian. (If someone would like to pick up where they left off I’d be happy to collaborate!)  Also, I temporarily disabled the VRPN Gadgeteer driver until I get a chance to make an updated, nice package of a recent version of VRPN. I’m almost done with one – just have to test it. When that’s done, I’ll push a new build with this driver re-enabled.

If they work, or don’t work, for you, let me know! You’re welcome to help maintain these packages – many hands make light work. Their source is over on that gitorious link above, and there’s docs in the gitorious wiki, though they’re sparse – happy to help clarify if you’re interested.  I’d also be interested in trying some alternate build service together with/instead of the Launchpad PPA’s – the openSUSE Build Service looks promising but I haven’t had the time to really look into it. So, there’s a side project for you 🙂

Git version control, Xcode, and Linux

Git and I

Within the last year, I’ve started to use Git (a distributed version control system) to manage changes to my personal and academic projects.  If you’ve used SVN or CVS before, the basic concept of storing multiple versions and committing changes is similar, but it’s otherwise a bit different: with Git, branching and merging is cheap (time-wise) and very easy, so you’re encouraged to branch and merge often.  This fosters a healthy “keep the master (trunk) branch stable” habit while you continue development of features, each in their own branch.  Additionally, Git has a concept of “staging” your changes – it doesn’t commit all of your modifications by default, so you can make sure that each commit is “atomic” – that it accomplishes only one thing.  Even when doing weekly class assignments now, I use Git as a way to track my progress, incentivize rapid progress (committing changes gives a rush of energy), and store working versions without making many messy copies of my source directory.  Read on for what I’ve learned and how to get started! Continue reading