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.

Author: Ed

  • Linux Install Tweaks: XSane Scanner Setup

    Might as well put all this all in one place for reference; that’s what this blog is all about.

    Relevant for Xubuntu 8.10 with XFCE 4.6

    Do that to get static network addresses.

    Do that to get /dev/scanner created, which might not be needed with USB scanners.

    Install xinetd

    Create /etc/xinetd.d/saned with this stanza:

    service sane-port
                {
                  socket_type = stream
                  server = /usr/sbin/saned
                  protocol = tcp
                  user = saned
                  group = scanner
                  wait = no
                  disable = no
                }
    

    Restart xinetd (this may not be needed): sudo /etc/init.d/xinetd restart

    Add the IP addresses of any other local PCs that should be able to use the scanner to /etc/sane.d/saned.conf. If they’re in /etc/hosts, call them by name.

    Add the IP address of this PC to the /etc/sane.d/net.conf files on those PCs. Again, if it’s in those /etc/hosts files, call this one by name.

    Add the scanner group to any users who need it:
    sudo usermod -a -G scanner userid
    Log out and back in again to activate your new group membership.

    And then it should Just Work…

  • Xubuntu Install Tweaks: Setting a Static IP in Xubuntu 8.10

    I use static IP addresses on my simple DNS-free local net, but the 8.10 Gnome Network Manager applet is pooched: you cannot add another entry or change the existing one. Some sources indicate that deleting the existing Auto eth0 entry and adding your own static entry will work, but that failed for me.

    Why this remains broken five months after the 8.10 release remains a puzzle, but there it is.

    So…

    Use the network manager applet to bring the network interface down. Perhaps ifdown will also work, although I don’t recall at this point: sudo ifdown eth0

    Use Synaptic to get rid of network-manager and network-manager-gnome. The cute little system tray thing will remain behind until you log in again.

    Make /etc/network/interfaces look like this, adjusted for whatever addresses seem appropriate in your network:

    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto eth0
    iface eth0 inet static
    address 192.168.1.3
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1
    

    Make /etc/resolv.conf look like this:

    nameserver 208.67.222.222
    nameserver 208.67.220.220
    

    OpenDNS runs those nameservers and they may well be faster & better & less intrusive than whatever your ISP offers.

    Bring the interface up: sudo ifup eth0

    Enjoy …

  • 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!