How not to do automatic updates

Filed under: linux — jlm @ 10:47

Today’s attempt at upgrading packages produced this:

Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/extras.ubuntu.com_ubuntu_dists_precise_main_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.

The contents of that file?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">  
   <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
   <META HTTP-EQUIV="refresh" CONTENT="0;url=https://login.wifiportal.co.nz">
   <TITLE>Welcome to FIVO Hotspot, Product of Natcom LTD NZ</TITLE>


I don’t have unattended upgrades enabled on my Ubuntu laptop. Nevertheless, there’s something which goes around and replaces files in /var/lib/apt with whatever junk it gets from whatever network it happens to be connected to at random times. Can I be the only person who thinks this is a Really Bad Idea?


Stopping laptop suspend on Ubuntu Linux

Filed under: linux — jlm @ 21:15

The default configuration for Ubuntu is to suspend the laptop any and every time the lid is closed, regardless of whether it’s on AC power or using an external display and keyboard, which is pretty annoying but up until Oneiric the setting wasn’t too difficult to discover and override. With Oneiric, Ubuntu reset the suspend options during the upgrade and removed it from GUI accessibility (Options are bad! Everyone uses computers the same way! No one uses an external KVM with a laptop! Gag.), but 5 seconds of web search reveals how to set it with the command line: gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action nothing

Except one problem. This only affects the PM settings if you’re logged in to the primary X console. I also want to be able to use my laptop headless. What to do when not logged in was set under “system” (as opposed to “user”) options in the no-longer-available GUI, but no references I found told how to set it from the command line. This is done by running gsettings set as a system user unsurprisingly, but unfortunately, gsettings doesn’t work from sudo or su, because gsettings wants to start up dbus because … I’m not sure why. And it won’t run without X, and gsettings won’t run without dbus. So, how do you run something non-graphical with dbus access? That turns out to be with the dbus-launch command, which can figure out it’s not in X unlike whatever gsettings is doing to start dbus, so what we want is sudo dbus-launch gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action nothing

Ha ha, no. That changes the setting for the root user, but the laptop still suspends. This turns out to be because the setting used when awaiting login aren’t root‘s, but gdm‘s. So that means to stop the suspending, we do sudo -u gdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action nothing

Ha ha, no. See, the documentation on whose settings are used is wrong. It’s not gdm‘s settings that are used at all. (That’s whose was used up to Natty.) If you look at your passwd file, you’ll see there’s a new display-manager user in addition to gdm now: lightdm. What the docs don’t say is that it’s that user whose settings are used now. So, no more teasing, this is the command which keeps your laptop powered on: sudo -u lightdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action nothing


Recommended software: disper

Filed under: linux — jlm @ 12:23

One of the common use cases for laptops is to plug into an external display at a docking station or with a projector, and unplug and use the internal display, then plug into another external display, then later back to the internal display, and keep on cycling like this. Unfortunately, Linux distributions haven’t supported switching displays very easily.

Enter disper to save the day. This is a command-line (and so easily scriptable) tool to switch the display in use. For example, to make only the internal display active, run disper -s. For only the external display, disper -S. And to toggle between them, disper --cycle-stages='-s:-S' -C. So when I want to bind one of the special laptop function keys to alternate between external-display-active-only and internal-display-active-only in Gnome, I run gnome-keybinding-properties, add a custom shortcut to run disper --cycle-stages=-s:-S -C, and bind that to XF86LaunchA. Voilà, with one keypress I can switch between the laptop’s screen and the projector. Other flags to disper let you activate both displays, etc.


Linux distribution switch, 2011 edition

Filed under: linux — jlm @ 23:15

I switched to OpenSuSE tonight.
PCLinuxOS had been grating on me for the last few months, since they decided to drop most of their man pages in favor of entering “man foo” into Google. But after an ordinary update, tonight I discovered that the new kernel hung on boot. To my distress, GRUB didn’t list any previous kernels when I intercepted its autoboot. After trying and failing to get grub to show me any files on the filesystem so I could select another kernel from /boot to boot from (why is this so hard?), I booted from a rescue disk… and discovered that there was only one kernel version in /boot, PCLinuxOS had been deleting the previous versions. This bad practice dismayed me, it’s standard for distributions to keep the previous one or two kernels around, in case of a case like this, where a kernel that doesn’t boot on someone’s hardware get pushed.
I’d been meaning to try out SuSE again for a while, and this pushed me over. I backed up my disk and did a clean install.
We’ll see how the new distribution goes.


Got an Eee? Forget Easy Peasy

Filed under: linux — jlm @ 00:56

So, I just upgraded Easy Peasy on my Eee. And surprise, surprise, it broke WiFi again.
Fortunately, there’s a user-contributed fix available, like the other times this has happened!
Unfortunately, the maintainers aren’t adopting it, also just like the other times!

This is a distribution targeting one specific line of netbooks, and in every version of it, WiFi doesn’t work. Scrapheap time for Easy Peasy.


Floating point exception after upgrading libgcc1 (PCLinuxOS) (fix)

Filed under: linux — jlm @ 22:34

I was just upgrading my packages, like I do every so often. This time ’round the package update list was:
bash bluez-utils dkms-ndiswrapper e2fsprogs grub grub-doc libgcc1 losetup
ndiswrapper pclinuxos-release update-notifier

Went ahead, it installed cleanly, but afterwards I was getting floating point exceptions from some programs. ldd shows libgcc_s as a likely culprit, what with the just-done upgrade including
libgcc1-4.4.1-1pclos2010.i586 ############################## [100%]

Play around with apt-get, to see if I can get an older version from apt — uh oh, apt-get says floating point exception when invoked. Grab a Mandriva RPM from the net, give it to rpm — rpm dies with floating point exception. No problem, I’ll install the files by hand, just extract them with rpm2cpio — which hits a floating point exception.

Finally, I wise up, scp libgcc1_s.so.1 from a Debian system.
cd /lib
sudo mkdir brokengcc1
sudo mv libgcc_s* brokengcc1
sudo cp /tmp/libgcc_s.so.1 .
sudo chmod 0755 libgcc_s.so.1

And everything is working again, at least enough to tide me over until PCLinuxOS fixes the libgcc1 package. If anyone else is stuck by this, the libgcc I used is here.


Upgrade season

Filed under: linux — jlm @ 12:44

So, I’ve done a bunch of upgrades to my systems lately. After Ubuntu broke my X again somehow going from Intrepid to Jaunty (this time not recognizing my input devices), I switched over to PCLinuxOS (2009.2). I’m still getting used to it. The apt-rpm stuff seems to work well, and stuff I had to fight to get going in Ubuntu, like flashplayer and xmms, just work. Java actually runs, and there’s a desktop link to the magic for getting OpenOffice working. On the other hand, the package repository feels a lot smaller, not having programs I’ve long used like calc, ccrypt, dict, and procmeter.

WordPress had a series of security vulnerabilities, so I’ve updated to the latest version. As a plus, it finally knows about the system’s timezone database, so is no longer the only program you have to adjust an hour whenever daylight savings starts or stops. The WordPress upgrade process is getting easier, manual editing of the mysql db no longer needed. Hopefully one of these days they’ll simplify it down to “apt-get upgrade”-level, and it can keep itself up to date the same way everything else does.

I also upgraded the Easy Peasy (formerly known as Ubuntu Eee) install on my EeePC. I can’t speak about the install problems I noted in my last post on Easy Peasy, but most of the runtime problems seem to have been fixed — except the inability to turn the WiFi on! Another user put together a fix in February, but unincorporated by the maintainers. I find this bug just as staggering to find today as I did last December. How can this still not work out of the box after all this time?


Intrepid Ibex woes

Filed under: linux — jlm @ 15:38

I just upgraded my Ubuntu install from Hardy to Intrepid. (Jaunty was recently released, so I expected Intrepid to be very smooth by now.) Instead, I got the worst upgrade experience I’ve ever had with Ubuntu, by far.

First, X didn’t come up, leaving me staring at the console login after reboot. Checking Xorg.0.log, it said something about RgbPath being an illegal directive. Looking at the changes the updater had made to the xorg.conf file, it hadn’t done anything about that line. I tried replacing the updater-edited version with the one from Hardy, still choked on RgbPath. I removed the RgbPath directive, and now it aborted on ‘Module "type1"‘. At this point I remember an LWN article about how recent X servers tried to autodetect everything and do the right thing if there were no xorg.conf file, so I moved it out of the way, started X, and huzzah, it worked.

Next, trying to do anything with the package manager errored out and I had a bunch of unconfigured packages. This turned out to be due to the preinstall script for openjdk-6-jre-headless consistently crashing (incidentally producing a multi-page error message containing an unsymbolized stack trace and a memory mapping dump, guaranteed to scare away non-developers), and a bunch of packages depending on openjdk-6-jre-headless, particularly OpenOffice. Uninstalling openjdk-6-jre-headless (and scrapping OpenOffice in the process) got my system back to a state where the package manager was happy.

I consider these two problems each a major lose. Intrepid’s Xorg doesn’t work with Hardy’s xorg.conf, and the update manager doesn’t fix it up. To fix it you have to either edit xorg.conf or know a not-well-publicized feature of Xorg. To even start diagnosing you have to know about Xorg.0.log and how to start the X server. Ubuntu is supposed to be targeting people who aren’t comfortable with a command line, and here it is dumping them at one after the upgrade without a map! And due to the second problem, I now don’t have OpenOffice on my system (though I do prefer AbiWord and Gnumeric, so that’s not as great a loss for me as for some).


Command-line wifi without nm-applet

Filed under: linux — jlm @ 13:43

If you use a Linux laptop, you probably have an ambivalent relationship with nm-applet, “Network Manager”, that thing which connects to your access points. Or often doesn’t, because — well, no one knows why, because nm-applet is fussy and tight-lipped.
Fortunately, you can do everything it does in the shell, if you know how. Here’s how:

  1. iwlist scan to scan the environment for WAPs
  2. iwconfig ath0 essid XYZ where XYZ is the ESSID from the scan that you want to connect to
  3. ifconfig ath0 up (turns the interface on)
  4. dhclient (registers with the WAP and gets an address)

Voilà, you’re connected (or at least have a meaningful error message), while nm-applet is still running around flailing its arms.
(I used ath0 as the interface in my example, but your interface might have a different name, like wifi0 or wlan0. Check by running ifconfig. Interface-affecting commands require root.)


Recommended software: rsnapshot

Filed under: linux — jlm @ 20:26

rsnapshot is a fantastically simple, easy-to-use application for performing backups of one computer to another. It uses rsync so that the data sent over the wire is encrypted and only that of an incremental backup. It uses hardlinks across snapshots for unchanged files, so you have full snapshots for all the backups kept, at only a fraction of the diskspace otherwise needed.

It has turned my remote backups from a pain to a simple matter of running a command every day or two and entering my password. Entering my password manually is the only deficiency I find with it. The rsnapshot docs recommend making a passphraseless ssh key for it to use, but I don’t trust that. Sometime I’ll have to look into if I can make a ssh key which’ll only allow rsnapshot to perform its rsync download, not log in or run other commands.

Powered by WordPress