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

  • Twiddling Linux Swap Performance

    Depending on a solid model’s complexity, OpenSCAD will sometimes chew through system memory, consume the entire swap file, and then fall over dead. In an attempt to work around that situation, I recently jammed a 32 GB USB drive into the back of the box, turned it into a swap device, and then told the kernel to back off its enthusiasm for swapping.

    Format the USB drive as a swap device:

    sudo mkswap /dev/sd??   #--- unmount it before you do this!
    Setting up swapspace version 1, size = 31265292 KiB
    no label, UUID=0f559a8c-67b7-4fa3-a709-17aeec3104c4
    

    Add it to /etc/fstab and set swap priorities:

    # swap was on /dev/sdb3 during installation
    UUID=e8532714-ad80-4aae-bee7-a9b37af63c8c none  swap sw,pri=1	0 0
    UUID=0f559a8c-67b7-4fa3-a709-17aeec3104c4 none	swap sw,pri=5	0 0
    

    Turn it on:

    sudo swapon -a
    

    Following those directions, dial back the kernel’s swappiness and limit the file cache growth:

    sudo sysctl -w vm.swappiness=1
    sudo sysctl -w vm.vfs_cache_pressure=50
    

    Those commands now live in /etc/sysctl.d/99-swappiness.conf:

    cat /etc/sysctl.d/99-swappiness.conf
    # Improve responsiveness by reducing cache swapping
    vm.swappiness=1
    vm.vfs_cache_pressure=50
    

    For whatever reason, WordPress turns underscores into blanks, so those obvious typos aren’t, really.

    And then it should Just Work.

    The box has 4 GB of RAM and, under normal circumstances, doesn’t swap at all, so I expect the USB drive should kick in only for extreme OpenSCAD models. The swappiness tuning should help during ordinary operation with large file operations.

    I have no results to report, but if something blows up, I know what changed…

  • Forcing Pulseaudio DisplayPort Volume Initialization

    It turns out that the audio-over-HDMI/DisplayPort channel which, for whatever reason, is the only way to get audio out of the Optiplex 980 with the big Dell U2711 monitor starts up AT MAXIMUM VOLUME! regardless of the GUI’s Pulseaudio mixer setting that’s diligently saved-and-restored across sessions. That makes a certain perverse sense, as the digital-to-analog converter & power amp live inside the monitor.

    Manually adjusting the GUI mixer by one click, either up or down, forces the new setting out over the digital link to the monitor, after which the audio output corresponds to the mixer; I never remember that until just after some dipshit auto-play video lights up with a fanfare.

    Setting the mixer to the same value doesn’t force an update, so the obvious solution (at least to me) of sending a fixed initial value doesn’t work; it’s optimized away. I think that’s why the initial update doesn’t happen: the stored volume is the same as the, ah, stored volume, so there’s no need to tell the monitor.

    The automatic solution involves putting two more commands in my ever-growing ~/.config/startup.sh:

    amixer -D pulse sset Master 26%
    amixer -D pulse sset Master 1%-
    

    That sets a rational level (which might be the same as the existing one from the previous session), then changing it by one tiny click to force the new value out to the monitor.

    And then It Just Works…

  • Why Friends Don’t Let Friends Run Windows: Bad Gadgets

    The Token Windows box (which runs the few programs that don’t get along with Linux) doesn’t get a lot of attention, but a recent update changed their stylin’ graphic CPU meter to something a bit less, mmm, smooth:

    Win 7 - CPU Meter
    Win 7 – CPU Meter

    Searching for the obvious keywords turned up an explanation from Microsoft:

    Windows Gadgets Have Been Discontinued - detail
    Windows Gadgets Have Been Discontinued – detail

    It seems they simply pushed an update that killed Gadgets, without explanation or warning.

    Who could have anticipated that allowing random strangers to run their code on a desktop PC would lead to security problems?

  • Ubuntu 10.04LTS vs Foxconn D510 NIC: FAIL

    For some unknown reason, one of the very rare updates to the Ubuntu 10.04 LTS infrastructure (for LinuxCNC 2.5.3 on my Foxconn D510 box, driving the Sherline mill) stopped supporting the system board’s built-in NIC: networking stopped working. The only symptom was that the NIC didn’t respond and all the usual tricks were unproductive.

    After some fruitless searching, I took the easy way out:

    NIC added to Foxconn D510 PC
    NIC added to Foxconn D510 PC

    That’s the backside of an ancient NIC using the classic Tulip driver. It used to have a full-size bracket, which I chopped off, bent, and filed to suit, much as with that one in the D525.

    Fired it up, the kernel automagically picked the proper driver, and networking Just Worked again.

    There. Fixed that…

  • Rsnapshot vs. GVFS: Exclusion

    The backup scripts running on Mary’s folks’ PC kvetched on each backup:

    WARNING: Some files and/or directories in /home/ only transferred partially during rsync operation
    WARNING: /usr/bin/rsnapshot daily: completed, but with some warnings

    Poking around showed that the problem came from the .gvfs “directory” tucked into each home directory, which produced this unenlightening ls -al result:

    d????????? ? ? ? ? ? .gvfs

    Come to find out that it’s an old problem with mysterious causes that should be fixed by now; evidently I triggered it by installing basic Ubuntu-with-Unity and then installing the Xbubuntu desktop. Or something like that.

    Anyhow, the solution workaround involves an rsnapshot configuration entry that bypasses that directory:

    exclude .gvfs

    And then it Just Works.

  • MHV LUG Lightning Talk: Intro to NSA Hardware Implants

    Meme - Nixon - I see what you did there - 5x38k
    Meme – Nixon – I see what you did there – 5x38k

    I did five minutes of standup comedy at yesterday’s MHV Lug meeting, pointing out some of the more interesting ways to compromise a PC when you have an infinite budget for development and consumables.

    You don’t get my patter with the PDF (unless you had access to the room’s bugging hardware), but the links may come in handy in the unlikely event you haven’t been following the story closely.

    If you have a security clearance or are in line for one, you probably shouldn’t click on the link, because it contains copies of pages from the leaked NSA catalog:

    I See What You Did There – NSA Hardware Guide

  • Sandisk 32 GB Flash Drive: Now With String!

    So I drill two holes in the dust caps of those teensy Sandisk drives and added a cheerful red string:

    Sandisk 32 GB Flash Drive - cap string
    Sandisk 32 GB Flash Drive – cap string

    That this should not be necessary goes without saying…