The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

Category: PC Tweakage

Remembering which tweaks worked

  • Xubuntu Install Tweaks: Fine Tuning

    After getting everything installed, there remains some fine tuning. These are some of the jots & tittles & glitches from my installation, in no particular order, which mostly apply to Xubuntu 8.10, but may also have something you need to know.

    Mplayer grumps about not being able to resolve IPV6 addresses. Add prefer-ipv4 = yes to /etc/mplayer/mplayer.config and it’ll be perfectly happy with plain old IPV4. Which is, of course, what essentially everybody uses. It’s not clear to me why Mplayer is the only program to fail this way, but that’s the story and it’s been that way for a long time.

    With compositing turned off, X doesn’t draw some OpenOffice menu & dialog items when it’s running on the right-hand portrait monitor. Turning the compositor on, however, reveals what an utter dud compositing is on a dual-core 2.8 GHz 1 GB box with an nVidia-flavored 9400 dual-head board. So turn compositing on, dial main windows back to opaque, allow shadows & transparency foo-foos only on small windows, and it’s pretty much bearable.

    But then the every pop-up window or dialog box displays weird trash from deep in the display buffer: icons, chunks of other apps, pure raw pinball panic, it all flashes before my eyes.

    Something in the X infrastructure interacts badly with the Mouse Gestures Redox Firefox add-on, but only on the left landscape monitor. Attempting a right-click-swipe-left to return to the previous page plunks a copy of the display that’s as wide as the portrait monitor on the left side of the landscape monitor, overlaying the live display beneath it. Minimize, restore, and the overlay is now dead black. The only way to get rid of it is to restart Firefox.

    Just exactly who do I file that bug with? The gestures extension? Firefox? Xubuntu? FXCE? X.org? Replacing it with FireGestures seems to work OK.

    The local CUPS server won’t display printers from the file server downstairs. Fix that by browsing to http://localhost:631, clicking the Administration tab, checking the Show printers shared by other systems box, and click Change Settings. Go brew up some tea or check your news feed; when you get back, all the network printers should appear when you click the Printers tab.

    Microsoft seems to have changed the definition of their keyboards such that the volume keys on a “Microsoft Comfort Curve Keyboard 2000 V1.0” don’t quite match the stock X layouts for MS multimedia keyboards, although msprousb seems close. More study is indicated. It’s not obvious how to link the keystrokes to the stock mixer, either.

    You can have only one mixer in the panel, aimed at one audio device, so adjusting a USB phone / headset will require some fiddling. A drop-down menu on the mixer main window permits setting other devices, but not from the panel.

    You can’t have menu / status panels on both monitors; you can only put either one on either monitor. Similarly, desktop icons must appear on both monitors; I think that’s ugly. So the only way to start programs on the “other” monitor is to either have duplicated icons or configure the Desktop settings to show the app menu on right-clicks, then scroll through it every time.

    Ctrl-Fnkey swaps workspaces; it’s even easier than point-and-clicking. Alas, you must have the same number of desktops on both screens and corresponding workspaces share the same name. All workspaces on a given monitor must have the same backdrop, so you can’t tell which one you’re on if there’s no program active: mouse-wheel scrolling gives you no hint which workspace you’re on.

    Alt-Tab clicks between active programs on the current monitor and sorts the programs in MRU order. Once you get used to it, you’ll love it.

    All in all, it does what I need.

  • Xubuntu Install Tweaks: Fonts

    Even a lean distro like Xubuntu has a bunch of fonts you’ll never use. Which ones you won’t need depends on who you are and where you live, but for my purposes the Asian and Arabic fonts just clutter up the font selection menus.

    They’re all in /usr/share/fonts/truetype/, neatly stashed in separate directories. Figure out which ones you don’t need (perhaps browsing with Thunar will help), then:

    cd /usr/share/fonts/truetype
    sudo rm -rf arphic kochi thai
    

    And so forth and so on, until you’re left with the ones you’ll actually use.

    I also have a bunch of fonts I actually paid money for. While this is a single-user box, it’s easy enough to install ’em in the default system locations (rather than a user directory), with a pair of directories to organize them:

    cd /usr/local/share/fonts
    sudo mkdir truetype
    sudo mkdir type1
    

    Then copy the store-bought fonts into the appropriate locations. After doing this a few times, I organized the original fonts under a few directories, so this need not degenerate into a search-and-copy operation every time.

    Worst case: when you’re done, just copy those two directories back to your font dump and copy them back for the next installation.

    The final step is updating all the font caches, which point to directories & fonts that no longer exist:

    sudo fc-cache -f -v

    You may need the -r option to forcibly delete existing caches and re-scan from scratch.

    More details there.

    The details differ, often wildly, among distros, so perhaps this manual command-line fiddling will grossly confuse whatever automated GUI routines you’re supposed to use.

  • Xubuntu Install Tweaks: Kmail

    Oddly, Kmail seems to not have a configuration option for its main email directory, using ~/.kde/share/apps/kmail/mail if it has its way.

    If you already have a ~/Mail directory, it’ll use that instead.

    I stash my mail on the file server in the basement and NFS-mount the directory locally, so I set up a symlink:

    ln -s /path/to/nfs/mount/Mail ~/Mail

    That works fine, somewhat to my surprise, if you do it before starting Kmail for the first time.

    Other files that must tag along to preserve the Kmail setup:

    • ~/.kde/share/config/kmailrc — main config file with accounts & filters
    • ~/.kde/share/config/emaildefaults — my name & address
    • ~/.kde/share/config/emailidentities — account info
    • ~/.kde/share/apps/kabc/std.vcf — contact list

    The std.vcf thing has your entire contact list. Which, I’m sure, doesn’t integrate well into whatever Xubuntu uses for a contact list, but that’s a second-order problem.

    Admittedly, this violates my meta-rule to not migrate the configurations, but the prospect of regenerating all those email filter rules and re-typing all the contacts is, um, daunting, even if most of them are cruft. I could hand-edit the new kmailrc file and insert the old filters, but …

    Memo to Self: do this before starting Kmail the first time!

  • Linux Install Tweaks: xorg.conf

    My desktop system has accreted a bunch of input devices over the years and the automagic X configuration system just doesn’t handle everything. Hence, some manual fiddling is in order every time I set up a new Linux installation.

    Recall that I’m using Xubuntu because KDE4 Just Doesn’t Work with dual monitors.

    Portrait-mode Monitor

    You must use the nVidia restricted driver, so install that if you didn’t pick it during installation. I have no experience with ATI, other than reading many despairing posts saying ATI boards contribute great suckage to the Overall Linux Experience.

    Use the Nvidia X Server Settings program to set up separate X sessions on each monitor. This is different from TwinView and Xinerama, which spread a single desktop over both screens, because it lets you independently switch between desktops on each screen. I want to edit my columns on the right-hand portrait screen while switching between PDF doc, simulations, schematics, and ahem email on the left screen, so separate X sessions are the way to go.

    I save successive xorg.conf files in a directory in my home directory, then manually copy them into /etc/X11 as needed. That way, if (when!) an update clobbers the X setup, I can recover easily.

    Save the file, copy it to /etc/X11/xorg.conf, log out, restart the X server (Ctrl-Alt-Backspace at the login screen will suffice), log back in again, make sure you have two monitor and separate X sessions, both in landscape mode. If not, fiddle around until you do.

    Edit that xorg.conf file and add one line to the right-hand monitor’s Section “Screen”

    Section "Screen"
        Identifier     "Screen1"
        Device         "Device1"
        Monitor        "Monitor1"
        DefaultDepth    24
        Option         "TwinView" "0"
        Option         "metamodes" "DFP-1: nvidia-auto-select +0+0"
        Option	        "Rotate" "CCW"
        SubSection     "Display"
            Depth       24
        EndSubSection
    EndSection
    

    Hardcoded rotation disables RandR, which seems to not matter, although it does prevent the XFCE Display config applet from starting. I tried RandR some time ago and it basically didn’t work on the setup I had, so I gave up. As I never change screen resolutions or rotations on the fly, it doesn’t solve a problem I have, anyway.

    Update: it seems the “nvidia-auto-select +0+0” setting causes an occasional hang when logging out; I must ssh in and reboot the system. Replace that string in both Screen sections with the actual resolution: 1600×1200 and 1680×1050, respectively, leaving the DFP-? in place.

    Save the new xorg.conf, copy it, log out, restart X, and log back in again. Now the right-hand monitor runs in portrait mode: wonderful for editing pages of text. Stand the right-hand monitor on its left ear.

    Wacom Tablet

    I have a Wacom Graphire tablet, which sort of worked with the default xorg.conf, but the mouse pointer switched to the right-hand screen in the middle of the left screen. I think the default single-X configuration confused it mightily.

    These sections pin it to the left-hand screen, let it rove over the full screen, and swap the side-switch buttons on the stylus. Tweak these sections and save copies as needed

    Section "InputDevice"
            Identifier      "stylus"
            Driver          "wacom"
            Option          "Device" "/dev/input/wacom"
            Option          "Type" "stylus"
            Option          "Mode" "Absolute"
            Option          "ScreenNo" "0"
            Option          "Button2" "3"
            Option          "Button3" "2"
    EndSection
    
    Section "InputDevice"
            Identifier      "eraser"
            Driver          "wacom"
            Option          "Device" "/dev/input/wacom"
            Option          "Type" "eraser"
            Option          "Mode" "Absolute"
            Option          "ScreenNo" "0"
    EndSection
    
    Section "InputDevice"
            Identifier      "cursor"
            Driver          "wacom"
            Option          "Device" "/dev/input/wacom"
            Option          "Type" "cursor"
            Option          "Mode" "Absolute"
            Option          "ScreenNo" "0"
    EndSection
    

    Trackballs

    I have two trackballs, one on each side of the keyboard, to distribute the strain equally on both wrists. The default configuration treated them both as mice and didn’t allow separate configuration. That meant the left-hand ball operated in right-hand mode; a bit of a problem.

    Fortunately, evdev now allows button configuration, so the setup was straightforward. Add these two sections

    Section "InputDevice"
            Identifier      "LogiBall"
            Driver          "evdev"
            Option          "Device" "/dev/input/by-id/usb-Logitech_USB_Receiver-event-mouse"
            Option          "Emulate3Buttons" "false"
            Option          "Buttons" "10"
    EndSection
    
    Section "InputDevice"
            Identifier      "KenBall"
    	Driver		"evdev"
            Option          "Device" "/dev/input/by-id/usb-Kensington_Kensington_Expert_Mouse-event-mouse"
            Option          "Emulate3Buttons" "false"
            Option          "ZAxisMapping" "4 5"
            Option          "ButtonMapping" "3 2 1"       # Left hand
    EndSection
    

    The default mouse configuration now doesn’t do anything, so remove the automagically generated Section “InputDevice” for Mouse0.

    ServerLayout

    With all that in place, the Section “ServerLayout” entry becomes

    Section "ServerLayout"
        Identifier     "Layout0"
        Screen      0  "Screen0" 0 0
        Screen      1  "Screen1" RightOf "Screen0"
        InputDevice    "Keyboard0" "CoreKeyboard"
    #   InputDevice    "Mouse0" "CorePointer"
        InputDevice     "LogiBall" "CorePointer"
        InputDevice     "KenBall" "SendCoreEvents"
        InputDevice     "stylus" "SendCoreEvents"
        InputDevice     "cursor" "SendCoreEvents"
        InputDevice     "eraser" "SendCoreEvents"
    EndSection
    

    Save it, copy it, log out, restart the X server, log back in again, and enjoy …

    Although your setup will differ from mine, here’s the entire xorg.conf file for your perusal and my backup. It’s saved as an OpenOffice odt document: just open it and Save As plain old text and it’ll work fine. There’s a bit more cruft than I mentioned, but that’s how it goes…

    This doesn’t resolve the random USB disconnects and X hassles I described there, but now that I’m not wearing an acrylic overshirt it’s not so much of a problem.

  • Linux Install Tweaks: Firefox

    I wish there was a way to bulk-install a list of add-ons, rather than futzing around installing them one-by-one. On the other hand, this way you’re sure to get the latest-and-greatest, while not attempting to install anything that’s obsolete.

    Copy passwords & suchlike from your previous installation into ~/.mozilla/firefox/whatever

    • key3.db
    • signon3.txt

    Install add-ons:

    • Adblock Plus
    • GreaseMonkey — then get GoogleMonkeyR for two-up search results
    • Google Gears — for wordpress blogging
    • Image Zoom
    • Tab Focus — 250 ms delay
    • Print Context Menu
    • FireGestures
    • Linkification
    • PDF Download
    • Brief

    Install themes

    • Microfox
    • Littlefox
    • Classic Compact

    I like Microfox: it doesn’t waste vertical space on foo-foos.

    Kill off Flash cookies and disable all the sharing and enabling and local storage: does anyone really want Flash apps to use the microphone & camera by default? This technique is not obvious and you must do it for every user and every browser on each system.

    The Adobe Knowledgebase article is here:

    http://kb.adobe.com/selfservice/viewContent.do?externalId=52697ee8

    The actual Flash control panel is here:

    http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager02.html

    You should also search on the obvious keywords for more info.

    Exit Firefox, fire it up again, do the obvious tweakage, and you’re set!

  • Linux Install Tweaks: System Infrastructure

    As before, most of this is peculiar to my Xubuntu setup, but this way I’ll remember it and you might get some benefit, too… something similar will work for whatever distro you’re using, perhaps with a bit of adaptation.

    Note: for all the files you tweak, first copy the original. I tend to save file whatever as whatever.base, but you may do as you see fit.

    Edit ~/.bashrc to enable aliases and get a decent colored prompt:

    force_color_prompt=yes
     ... snippage ...
    PS1="\[\e[1m\][\[\e[33m\]\u\[\e[32m\]@\[\e[36m\]\h \[\e[37m\]\W\[\e[32m\]]\\$ "
     ... snippage ...
    alias ll='ls -l'
    alias la='ls -A'

    What look like gratuitous backslashes in PS1 actually make it work: they escape the unprintable stuff so bash (or whatever) correctly counts the length of the string. That way the command line wraps correctly and backspaces actually back up correctly from line to line.

    It seems WordPress randomly eats backslash characters, so here’s that line with backslashes turned into pipe symbols. Use your favorite editor to replace pipes with backslashes and you should get the original text back:

    PS1="|[|e[1m|][|[|e[33m|]|u|[|e[32m|]@|[|e[36m|]|h |[|e[37m|]|W|[|e[32m|]]||$ "

    Incidentally, the reason you want a colored prompt is so you can find the prompts when you scroll upward in a terminal window. If all the text is the same color, you can’t spot the commands amid the output.

    Edit /etc/bash.bashrc to turn on command completion:

    if [ -f /etc/bash_completion ]; then
        . /etc/bash_completion
    fi

    Add local addresses to /etc/hosts

    192.168.1.1 gateway
    192.168.1.2 oyster
     ... etc ..

    Create NFS mount points:

    sudo mkdir /mnt/bulkdata
    sudo mkdir /mnt/diskimages
    sudo mkdir /mnt/userfiles
    sudo mkdir /mnt/music

    Add NFS shares to /etc/fstab so they auto-mount:

    oyster:/mnt/bulkdata    /mnt/bulkdata   nfs     defaults,noatime,noexec 0 0
    oyster:/mnt/diskimages  /mnt/diskimages nfs     defaults,noatime,noexec 0 0
    oyster:/mnt/userfiles   /mnt/userfiles  nfs     defaults,noatime        0 0
    oyster:/mnt/music       /mnt/music      nfs     defaults,noatime,noexec 0 0

    People pee all over NFS, but the alternatives seem worse. NFS preserves users & groups & permissions, doesn’t have the FAT 2-second timestamp resolution issue, and basically works. Admittedly, when the server goes Tango Uniform, things get really ugly, but that’s not a routine event.

    If you have these files already set up on another system, you can fetch ’em using scp:

    cd /etc
    scp oyster:/etc/hosts /tmp
    sudo mv hosts hosts.base
    sudo cp /tmp/hosts .

    Or, if you’re doing this in another partition, just cp the files from the old installation to the new one. Run diff on the two files to verify that you’ve changed what you think you have and that there’s nothing new sneaking in while you weren’t paying attention.

  • Xubuntu Install Tweaks: Repositories and Programs

    With a fresh Xubuntu (but it’s similar for the rest of ’em) install up & running, it’s time to set up some basic system-level stuff.

    Fire up Synaptic, enable some repositories:

    • Backports
    • Multiverse
    • Restricted

    Add custom repositories (first link is the main site, second is repository & install info):

    There’s some public-key installation required to validate each repository; check the howtos or just search for the obvious keywords, then do what the nice man tells you.

    Update: There seems to be a Synaptic buglet in 8.10 that prevents the Quick Search bar from finding third-party packages; the ordinary Find works correctly. If you can’t find, say, acroread from Quick Search, do this:

    sudo update-apt-xapian-index

    That should get it up to speed again.

    Update 2: The bug is still present in 9.04, if you’re keeping track: 288797

    Reload package info, mark upgrades, apply. Perhaps you’ll get a new kernel out of that, so do one of the few mandatory reboots…

    Install useful programs using Synaptic:

    • flashplugin-nonfree — but turn off Flash cookies — more on that later
    • acroread
    • libdvdcss2 — gasp!
    • non-free-codecs
    • mplayer / mencoder / ffmpeg / sox / lame
    • realplayer — to watch NASA TV
    • nfs-common
    • ssh
    • htop
    • java-common
    • openoffice — not installed by default in Xubuntu
    • msttfcorefonts
    • pilot-link
    • build-essential — you will compile something, eventually
    • gizmo or skype
    • xchm (for LTSpice IV)
    • digikam (it normalizes camera filenames during upload)
    • kmail (or all of Contact, sigh)
    • kmymoney
    • kate

    You can shortcut some of those by installing xubuntu-restricted-extras if you prefer.

    The National Weather Service radar plots require Genuine Sun Java, so:

    • install sun-java6-jre, -bin, -fonts, -plugin
    • remove default-jre, default-jre-headless, openjdk6-jre, openjdk6-jre-headless, -lib

    Doing it in that order makes the dependencies work out. Otherwise, you’d yank the entire OpenOffice suite out by the roots.

    Installing KDE apps perforce drags in much of the KDE infrastructure, but it mostly works. The KDE program menu fonts are tiny and there seems no obvious way to crank them up.

    Download & install: