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: 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:

  • Linux Install Tweaks: The Basics

    The conventional wisdom for Linux installations is to put your /home directory in a separate partition, so that your next installation won’t blow it away. The intent is to save your settings for the new installation and avoid a bunch of tedious reconfiguration.

    That probably made sense back in the day when Unix installations didn’t change very much, very often, but it seems nowadays that hulking programs use elaborate configurations and don’t take kindly to being blindsided by old config files. I can’t provide specific details, but some upgrades have gone awry for mysterious reasons; a clean install fixed everything up again.

    I now do a clean OS installation in a freshly formatted partition, then spend a day or two tweaking everything. This eliminates a tremendous amount of cruft, takes advantage of new features, and generally seems to be more productive than dicking around trying to figure out exactly which old setting pooched the new version.

    Two meta-configuration choices help a lot:

    • All our “data” files live on a file server in the basement that’s mounted via NFS, so the local system doesn’t have much more than its own configuration.
    • Hard drives have plenty of space, so slicing the drive into smaller chunks and preserving the old installations doesn’t cost anything.

    Case in point: I’m setting up Xubuntu 8.10 on a system with partitions containing Kubuntu 7.10 and 8.04. I’ve blown away several different trial installations of Kubuntu & Xubuntu in this partition already; now things are looking good. The trick is to use manual partitioning and aim the installer at the correct spot.

    Make sure you get that right and always back up your partitions first!

    The disk layout on this box:

    sudo fdisk -l /dev/sda
    
    Disk /dev/sda: 160.0 GB, 160000000000 bytes
    255 heads, 63 sectors/track, 19452 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0xd0f4738c
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1               1           7       56196   de  Dell Utility
    /dev/sda2   *           8        2489    19928633    7  HPFS/NTFS
    /dev/sda3            2489        2973     3888569+  db  CP/M / CTOS / ...
    /dev/sda4            2974       19452   132367567+   f  W95 Ext'd (LBA)
    /dev/sda5            2974        3496     4200966   82  Linux swap / Solaris
    /dev/sda6            3497        6107    20972826   83  Linux
    /dev/sda7            6108       15245    73400953+  83  Linux
    /dev/sda8           15246       19452    33792696   83  Linux

    Yup, it has Windows on it; rarely gets booted, but it’s there. You cannot begin to imagine the number of reboots required to update even a minimal Windows install after a year.

    So, to begin…

    The first steps with a new PC:

    • back up the drive
    • shrink the Windows partition down to maybe 20 GB
    • snuggle the other pre-installed partitions next to it
    • create an extended partition over the rest of the disk
    • set up the Linux partitions

    After you’ve done that the first time, you never have to do it again… just ping-pong between two (or three!) Linux partitions with each new installation. There’s a bit of fussiness with grub, but it’s easy enough to either let the new installation capture the MBR or re-aim it at the old installation after the fact.

    For more details on partitioning & backups, particularly for laptops, go there. Use partimage (use System Rescue CD) for whole-partition backups to a USB drive and move on.

    I favor the mini.iso installation method, as it tends to install less cruft and loads the latest versions right from the start. Start from there and proceed as directed.

    Don’t do an x86_64 installation, even though you think it’d be cool. Flash doesn’t work yet and restarting Firefox a dozen times a day simply isn’t attractive. Trust me on this.

  • Poof: A Post!

    Looking at the calendar shows I missed 16 March… so I’ll just go back and rewrite history.

    I generally have two or three weeks of posts scheduled for release, one a day, just before 8 am Eastern US time. That way I can write ’em when I have the time, edit them a bit to make the answer look better (or, in some cases, come out right), and not have to worry about being somewhere else in the morning.

    Yes, I agree that’s a bit sneaky. Perhaps a blog post should appear when the spirit moves me, but all in all I’d rather not dump a dozen entries in two days, then go dry for a week.

    That’s how it works… and now I’ve filled in the hole.

    Memo to self: scan the dates a little closer next time, eh?

  • Electronic Fluorescent Ballast: Zowie!

    Back in 2000, I replaced the ballast in our bathroom light; the old one failed after a mere 45 years. The casing didn’t sport any PCB-free labels (no surprise there), so I disposed of the carcass at a town hazmat day.

    Under normal circumstances you’d replace the whole fixture, but this is a slender 4-foot chromed steel base with a matching chromed shield over a 4-foot fluorescent tube: charming, in a retro-mid-50s sort of way. We couldn’t find anything suitable at the local big-box home supply stores, so I just cleaned it up and stuck a new ballast inside.

    I indulged in the luxury of a warm-white tube so I didn’t look quite so dead in the morning.

    That ballast just failed, after a mere 9 years, which I confirmed by swapping in a new tube. It seems nothing lasts any more.

    We went through the same “should we get a new fixture?” exercise and, unwilling to drop more than $150 on a really cheesy two-tube fixture that would be way too bright, I bought Yet Another Ballast from, oddly enough, the same manufacturer and possibly even the same Mexican town.

    This time I got an electronic ballast, with an A sound rating which comes mostly for free without that big magnetostrictive iron core. Costs twice what the magnetic ballast does, but I figure you only go around once, right?

    It comes with a scary label telling you to insulate the unused lead (it can drive two tubes) “for 600 V”. That turns out to be the standard wire-nut rating, so I clipped off the exposed copper end and screwed the nut in place over the insulation. Wired the leads up per the diagram and that’s the end of that story.

    Now, I’m here to tell you that going from a nearly dead magnetic ballast to a shiny new electronic ballast is a wonder to behold: the tube pops on at full brilliance, far brighter than it ever was before, and is (no surprise) flicker-free.

    It’s almost enough to make me preemptively re-ballast the kitchen fixtures …

    Update: Which I did, a few months later. The 4-tube kitchen light pops on and is much brighter. However, that may be due to new tubes as much as anything; the ballasts wanted T8 tubes. Alas, I couldn’t find 3000 K warm-whites and had to settle for 3500 K soft-whites. All in all, a good improvement.

    More on electronic ballast adventures there.

  • Kosher-for-Passover Coca Cola: Closer to the Real Thing

    it’s about that time of the year again: get ready to stock up on Kosher Coke!

    Turns out that Coca Cola produces sugar-based Coke shortly before Passover each year; their usual high fructose corn syrup, while Kosher, falls into the Chametz category of grains that cannot be eaten during Passover.

    Kosher-for-Passover Coca Cola bottle cap
    Kosher-for-Passover Coca Cola bottle cap

    Bottles containing the special sugar-based formula wear a distinctive yellow cap, so they’re easy to spot against the usual all-red array. To cross-check: the ingredients list runs: Carbonated Water, Sucrose …

    A friend brought me a few two-liter bottles from a Jewish grocery store in the metro NYC/NJ area last year, shortly before I discovered that the local Target had a generous stockpile on the top shelf of their soda section. It’s allegedly available in cans, but I’ve never seen any.

    NB: Pepsi uses yellow caps around this time of year to mark their bottles for some dimbulb contest. At least they did that last year and I’m sure it’s no coincidence. If the cap doesn’t have distinctive Hebrew symbology and the ingredients still include HFCS, it ain’t been cleared for Passover consumption.

    While sugar-based Passover Coke is not the same as the old-school Coke you remember from long ago if you’re enough of an Olde Farte to do so, it’s as close as you’re going to get in these degenerate times.

    In actual point of fact, sugar Coke tastes pretty much like HFCS Coke. That should not be entirely surprising, given the bazillion dollars they spend on development. Run your own side-by-side comparison, blind if you can, and report back.

    If you plan to stock up on the stuff anyway, give the caps an extra twist to ensure they’re on tight before you put ’em on the shelf. I just cracked the final bottle from last year and it’s still plenty fizzy enough for me.

    The phosphoric acid in either formulation is really hard on your teeth & gut, so don’t overdo it.

    Selah.

    Update: As of 22 April, the local Target had a shelf full of yellow-cap Coke; they had none the week before Passover. Perhaps they got the last pallet a day too late? In any event, I stocked up my year’s supply in one shot. Admittedly, it’s $1.89 / 2 liter bottle, but it’s just for special occasions… and half a dozen bottles is a year’s supply for me.

  • Xubuntu: Separate X Sessions

    Although XFCE is rather short on creature comforts, it handles my dual output video card with separate X sessions on two monitors and doesn’t fall flat on its face with the right-hand monitor rotated into portrait mode. Some apps don’t maximize quite correctly, thinking the bottom is at 1200 (1080?) rather than 1680, but overall it works fine.

    The XFCE version shipped with Xubuntu 8.10 is now backlevel, but you can fetch the latest & greatest from www.xfce.org. Add the repository (and corresponding public key), then do a normal upgrade.

    You’ll also want to install/upgrade OpenOffice 3 from the PPA repository. Do the obvious search to find the most current links. There’s no need for the manual install hocus-pocus using a tarball from the OOo site.

    You can’t have separate wallpaper on each virtual desktop, you must have the same number of desktops in each X session, and there are some other aggravations, but … no showstoppers so far.

    Bottom line: It (pretty much) Just Works.

    More on the system setup in a bit, as I get some useful results.