Smokes your problems, coughs fresh air.

Author: Rowan Rodrik (Page 21 of 27)

Rowan is mainly a writer. This blog here is a dumping ground for miscellaneous stuff that he just needs to get out of his head. He is way more passionate about the subjects he writes about on Sapiens Habitat: the connections between humans, each other, and to nature, including their human nature.

If you are dreaming of a holiday in the forests of Drenthe (the Netherlands), look no further than “De Schuilplaats”: a beautiful vacation home, around which Rowan maintains a magnificent ecological garden and a private heather field, brimming with biological diversity.

FlashMQ is a business that offers managed MQTT hosting and other services that Rowan co-founded with Jeroen and Wiebe.

Gentoo update: e2fsprogs blocks e2fsprogs

Yesterday evening, I dropped by at Wiebe‘s with my laptop to start updating our Gentoo systems together. I hadn’t updated this machine since first installing it in spring last year, so I expected quite a few problems. The first blockage that we both had to solve was caused by e2fsprogs.

Wiebe searched the forums for help and found an unfortunate abundance of it. Eventually, I decided to give one of the many contradictory tips a try, although it seemed risky.

$ emerge --unmerge --ask --verbose e2fsprogs

Until you reinstall e2fsprogs, you won’t have any of the ext2/3 utilities such as e2fsck. So, reinstall immediately:

$ emerge --oneshot --ask --verbose e2fsprogs

This will remove libcom_err and libss, and replace them with e2fsprogs-libs, thus solving the blockages.

Wiebe tried an alternative route by first unmerging com_err and ss, and then replacing e2fsprogs. This didn’t work as expected, probably because he had kerberos in his use flags. libkerberos used libcom_err, which broke wget. Scp’ing the distfiles to him didn’t work either (OpenSSH also has kerberos support). Neither did mounting an USB stick with the files. Luckily, Thunderbird still worked, so I emailed the distfiles and the problem was solved. We found it amusing to have to use e-mail while being in the same room. 😉

The reason why this blockage occurred is not entirely clear to me. What I do understand is that com_err and ss were both provided by the e2fsprogs project and are now deprecated in favor of e2fsprogs-libs. Also, it’s clear that the new libraries are binary compatible with the old libraries or his system would have remained unusable, even after merging e2fsprogs-libs.

Before we tackled this problem, I had only updated portage and net-print/foomatic-db-ppds (also a blocking situation). Afterwards, I had just some motivation left to update krb5. Which leaves another 282 packages for the next get-together.

Moving my traditional website content over to my blog

Cool URLs don’t change, but the relevance of my content does (and it’s declining). www.bigsmoke.us consists of content that has mostly never been updated. That’s why I want to move it over to my blog here.

I think one of the advantages of a blog is that it’s quite clear what gets published when. You can add this information to the pages of a good old fashioned static website, but it’s just not quite the same. One of the reasons is that, on my blog, my guideline is that posts are not edited anymore after hitting the “Publish” button.

Why blog posts shouldn’t change what they say

Once a post is published, it can be commented on below the post or from within elsewhere on the world wide web. If, after publication, a post changes significantly, it becomes very unclear what is being cited / commented on. Of course, simple formatting changes or grammar/spelling corrections are not considered significant changes, but changing the meaning of what is being said is.

(Because blog posts are so temporal it is habitual that if you do have to commit corrections which change the meaning of the text, you notify the readers of your post of this by adding an Update notification at the top or the bottom of your post. Examples of this are abound on the web. Here’s one example.)

GNU Screen within Screen within […]

GNU Screen is great. So great that I find myself always using it. (Pressing the Window key and T launches an XTerm with a new Screen ready on my system, while I have to add Shift if I don’t want the screen.) This means that when I login into a some other machine through SSH—an occasion for which Screen is particularly useful—I will often end up with nested screens. So which Screen will receive my Ctrl+a presses?

The answer (courtesy of Google and Yacin Nadji) is that Ctrl+a will target the outer screen. Each a that you add after that will go down one nesting level.

Not that I don’t still find controlling nested screen confusing, but now at least I don’t feel helpless and stuck whenever it happens. 😉

Extra tips

  1. Visible captions make it easier:

    GNU Screen within Screen with captions

    GNU Screen within Screen with captions

    (If you don’t know how to configure Screen with captions, I’ve blogged about his previously.)

  2. Debian Administration, a very high-quality site has an article about GNU Screen.

Images not showing after upgrade to MediaWiki 1.13

When I upgraded two of my MediaWiki installations[1, 2] a while ago, images were no longer being displayed. I found out that this was due to some problem with a change to the image.image_name column.

Gladly, the fix was easy (adopted from the message in the mailing list):

ALTER TABLE image ADD COLUMN img_name2 varchar(255); 
UPDATE image SET img_name2=img_name;
UPDATE image SET img_name=img_name2;
ALTER TABLE image DROP COLUMN img_name2;

My quest for the ultimate Bash prompt

On my new laptop (a Lenovo T61) I was still using the default Gentoo prompt in Bash. This was kind of a shame since my last Gentoo installation (on what is now my sister’s Ubuntu machine) had a beautifully customized prompt. It was time to dig up the old escape codes.

The old

To recover my old prompt I didn’t even need to go rummaging through old files. All I had to do was to find an old forum post on the Gentoo forums. But, I noticed immediately that I didn’t like this old prompt so much anymore. It had too much stuff and it didn’t have very strong root warning signals.

My old Bash prompt

My old Bash prompt

My old Bash prompt as root

My old Bash prompt as root

The new

My new Bash prompt

My new Bash prompt

For my new prompt I used the PROMPT_COMMAND environment variable. The command in this environment variable is always run before the prompt is displayed. This means that, if you set the PS1 environment variable from this command, you can change your prompt depending on circumstances.

I pushed the dollar (or hash)-sign all the way to the left because I often type in very long commands. A little more space is used if there are background jobs, but only if there are background jobs.

My new Bash prompt with background jobs

My new Bash prompt with background jobs

You should never be root for too long, so I made being root very noticeable (and even slightly annoying):

My new Bash prompt as root (and with background jobs)

My new Bash prompt as root (and with background jobs)

The following is the code I use to create the prompt. Stick it wherever you want it (e.g. in your user’s bashrc or in the system-wide bashrc) and adjust it to look nice and play nice with the rest of your environment. The code isn’t pretty, but it does what it has to. 😉

prompt_command {
  XTERM_TITLE="\e]2;\u@\H:\w\a"
 
  BGJOBS_COLOR="\[\e[1;30m\]"
  BGJOBS=""
  [ "$(jobs | head -c1)" ]; BGJOBS=" $BGJOBS_COLOR(bg:\j)";
 
  DOLLAR_COLOR="\[\e[1;32m\]"
  [[ ${EUID} == 0 ]] ; DOLLAR_COLOR="\[\e[1;31m\]";
  DOLLAR="$DOLLAR_COLOR\\\$"
 
  USER_COLOR="\[\e[1;32m\]"
  [[ ${EUID} == 0 ]]; USER_COLOR="\[\e[41;1;32m\]";
 
  PS1="$XTERM_TITLE$USER_COLOR\u\[\e[1;32m\]@\H:\[\e[m\] \[\e[1;34m\]\w\[\e[m\]\n\
$DOLLAR$BGJOBS \[\e[m\]"
} PROMPT_COMMAND=prompt_command

More info

If you want to learn more about customizing your prompt, there’s an article up at IBM’s website. From it, I stole this nice color table:

Console color codes table

Console color codes table

Another tip: you can type man console_codes for everything about … console codes.

GNU Screen window captions as XTerm tabs

XTerm is my favorite terminal emulator and I love GNU Screen. So, imagine my joy when I found out that Screen can persistently show window captions ([Ctrl+A]: caption always).

GNU Sreen with default window captions (in XTerm)

Now I wouldn’t loose track of my windows so easily. No more detours through the Window-list, and it gets better; from the Screen manual, I learned that I could set the caption to a string. Look what [Ctrl+A]: caption '%w' does:

GNU Screen with simple window captions (in XTerm)

Cool! I could finally have my XTerm tabs. 🙂 Just recently, I was telling Wiebe—in reply to a complaint of him about getting lost in Screen’s window list—how cool it would be if you could have a terminal emulator display a tab for each screen window. Now I can tell him, instead, that tabs in a terminal emulator are a superfluous feature.

My current configuration

GNU Screen with window captions (in XTerm)

This last example is done with the following Screen command: caption always "%{= kB}%-Lw%{=s kB}%50>%n%f* %t %{-}%+Lw%<" There are more examples in the manual page. Enjoy your tabs!

XTerm is favorite

XTerm is know to most X-Windows users as that ugly terminal with the strange scrollbar and the unreadable font. And it doesn’t even have tabs! But, I think it’s the best damn terminal emulator in the world. It just doesn’t appear that way at first.

By default, XTerm comes with warts:

  • It has an ugly, small font.
  • What’s up with the black on white? I’m a 1337 h4x0r and I want a black background, damnit!
  • Double-click Selections is unintuitive.
  • Where are the tabs?

Default configuration for XTerm 234

But its warts are easily removed.

The font is small and ugly

Easily solved:

$ xrdb -merge
/* I want pretier fonts */
XTerm*faceName: Liberation Mono
XTerm*faceSize: 10
[Ctrl+D]
$ xterm

XTerm with nicer than default font

The black on white is an insult to my 1337ness

No longer so:

$ xrdb -merge
/* I want a 1337-style color-scheme */
XTerm*background: black
XTerm*Foreground: Grey
[Ctrl+D]
$ xterm

Now I can install my 1337 hacking tools in style! (If only I could install 1337 hacking skills as easily.)

1337-style XTerm

Double-click selections are unintuitive

Most terminal emulators let you double-click to quickly select words. XTerm does this as well, but its definition of a “word” is a bit narrow if you’re used to other programs. The good news is that XTerm is extremely configurable in this sense. It lets you decide what to select on double-click, on triple-click, all the way up to 5 clicks. You can define the boundaries of the selection by means of presets such as line, group and page, but what I like best is its ability to use regular expressions. This lets you do cool things, like, for example, using one click to select a word, two clicks to select a sentence, and three clicks to select a paragraph.

My own configuration is a bit simple, probably a testimony to how little code I write these days:

$ xrdb -merge
/* The selection only stops at spaces and newlines */
XTerm*on2Clicks: regex [^  \n]+
[Ctrl+D]

Where are my tabs

You should really be using GNU Screen instead, which has too many advantages to name here. It even allows you to do Remote pair programming over SSH.

If you use Screen within an XTerm, be sure to add to following to your X configuration.

$ echo "XTerm*metaSendsEscape: true" | xrdb -merge

Otherwise, you might find yourself unable to control Screen

Saving your configuration

Ready to save your precious configuration?

$ xrdb -edit .Xdefaults

You’re done. It’s time to go brag to your friends.

Getting my sister to forget the Google Desktop newsticker

My sister was so fond of the RSS feature that came with Google Desktop’s sidebar that she kept it permanently visible at the right side of her screen. (What a news junkie!) Now that I got her stuck with Linux, she misses her precious Google Desktop and I’m trying to figure out an alternative for her.

For those who want to truly stay on top, just pointing Firefox to Google Reader occasionally isn’t good enough. (I know: I’m slow. I like it that way.) I had heard of various Firefox add-ons to aggregate your RSS feeds in the sidebar, but the sis had thought of this already and didn’t like to have something permanently filling up space at the left. Ok, I can understand. I thought there must probably be some Firefox add-on to move the whole damn sidebar to the right and of course there is; it’s called RightBar.

Screenshot of the RightBar Firefox Addon

Screenshot of the RightBar Firefox Addon

The extension is so simple that you could achieve the same by adding a few lines to the userChrome.css file in the chrome subdirectory of your Firefox profile directory:

/* Change the sidebar's position */
#browser {
-moz-box: reverse;
}

(If the file doesn’t exist yet, create it from a copy of userChrome-example.css.)

What’s left now is to choose which feed aggregator extension for Mozilla Firefox to use. So far, I’ve only tried Sage (based on a five-star rating and familiarity with the name). It seems to work quite well, although, really, I still prefer just visiting Google Reader every once in a while. I mean: I’m a man, I don’t multi-task, I can hardly single-task.

I’m going to forward these suggestions to my sister, probably just to see them ignored for one crucial oversight: the sidebar doesn’t look very different. One of the things she liked about the Google Desktop, she told me, is that it looked very different from the rest of the stuff on her screen, causing a minimum of distraction. Probably I’ll end up recommending some kind of gDesktlet. (Or is there something better-looking these days?)

The road through Ubuntu

My mom bought a new laptop because of a broken screen on the old Linux machine that she had inherited from me (which wasn’t wasn’t a laptop, so I’m sure that the Golden Arrow of Consumption can explain why she didn’t just replace the screen, although the new boyfriend who is kind of Windows-but-not-Linux-literate qualifies as a more probable reason for getting a laptop that is needlessly dragged down by Vista).

I was a little surprised by her move. The first computer my mother learned turning on was this computer back when I was still using it. Of course it was running Linux at the time. Before I gave it to her, I replaced Gentoo Linux with Ubuntu Linux, and, honestly, she never had any problems with it that were not hardware-related. (Ok, there was that one time when there was some junk stuck in the print spool without a user-friendly path to getting rid of it, but you could argue that this was really due to a junk printer. (On the subject of print spools: my friend Wiebe complained to me a while ago that when the queue in their WorkCentre Pro 232 gets stuck, Xerox engineers have to come in to replace the whole damn control board; apparently, just plugging in a terminal with shell access isn’t possible.)) She was comfortable with and used to Linux. But, alas, she’s in love with someone who is less than comfortable with Linux and there’s always that male ego thing.

But, then, who cares? It was good news for my sister. With her having gone through a rally of shitty old machines in just a couple years and this still being an ok-enough machine, I asked her if she’d like a “new” machine running Linux when she called me about one of those typical Windows problems that had just taken out her previous wreck of a machine. Yeah, sure, she’s was more than willing to finally get rid of Windows.

I was glad that my sister didn’t feel the need to inflict the pain of Windows on this poor old machine. This meant I only had to upgrade and reconfigure i a bit. Upgrading Ubuntu to version 8.04 went pretty seamless, because it was a relatively fresh installation where all dependencies where actually marked as “auto”. After moving away some old – uhm – aesthetic imagery, ill-suited for big-sister-eyes, I brought the machine to her place, plugged in her peripherals, connected it to her screen, and tried to boot.

It booted, but GDM wouldn’t start. I had just swapped a Matrox G400 with a noisy GeForce 4 which I had previously assumed to be broken. This assumption actually goes all the way back to before I realized that the screen was broken. When the screen started complaining of “Not Recommended Mode”, one of my first diagnosis was that the GeForce card was borked. This diagnosis was arrived to after first blaming the screen, plugging it in elsewhere, seeing that working, plugging it back in, seeing that working too, then seeing that stop working again, resetting the screen in increasingly complex sequences, seeing it work again, seeing it stop working again, swapping the DVI connection with a VGA connection, and then, finally, swapping the GeForce racehorse with the old Matrox workhorse. Of course the problems returned, but not before another fun round of swapping parts and peripherals because the machine had started crashing. The crashing led me to replacing the power supply, only to find out later that the CPU’s cooling block had someone loosened dangerously. So, with all that in mind, I had now put back to GeForce plaything before I took the whole concoction to my sister. Now, GDM wouldn’t start. (The GeForce graphics worked fine before I moved the machine to her.)

Admittedly, I hadn’t exactly tried booting with the GeForce. (I’m not the rebooting type.) After swapping the card, not being able to use the binary nvidia and an hour or so of messing around, I found that the nvidia kernel module was actually missing. (I hadn’t noticed this because a “find /lib/modules|grep -i nvidia” did show an nvidia entry; had I looked better, I would’ve seen that it was a directory and not a .ko file.) So I performed a reinstall of the appropriate linux-restricted-modules package and—voila!—the files where there (in /lib/modules/2.6.24-21-generic/volatile/).

So I’m at my sister’s and I’m surprised that X won’t start. I try to find the module in /lib/modules/; it’s gone. Then, after reinstalling the package and an extraneous reboot to see it gone again, it dawns on me: what did volatile mean again? (I should really not be telling you this, because it’s fucking embarrassing. 😉 ) Yes, the volatile directory is a tmpfs mount point. When I realized that this was probably due to initramfs, I realized that I know jack about initramfs, except that it makes Grub’s configuration incomprehensible to me.

I tried updating the initrd.img by issuing update-initramfs -u. When this didn’t work, I added the module name explicitly to /etc/initramfs-tools/modules. When that didn’t work, I changed the MODULES option in /etc/initramfs-tools/initramfs.conf to MODULES=dep and pulled update-initramfs through grep to find out if the module was added appropriately: update-initramfs -u -v|grep nvidia. It was outputted and it was the right initrd.img too but still, after booting, the module was missing from the volatile directory.

So, fuck this! I was getting inpatient: cd /lib/modules/2.6.24-21-generic/volatile; mv nvidia.ko ../kernel/drivers/video; depmod -a; reboot and GDM started nicely.

Now I just have to find out why the bloody eth0 interface isn’t ifup’ed at boot. The configuration seems fine to me (although I’m confused by all this new-fangled GUI stuff and by where everything is stored. :-?) For now, I just dropped a script on her desktop called Darn, the network doesn’t work:

#!/bin/bash
gksu ifup eth0

Pure sophistication, isn’t it? I’ve yet to encounter an operating system where solving such problems has any resemblance to anything I’d call user-friendly… For all the polish they add these days, if you can’t go below the hood and bang away at the shell, you’re basically screwed. That’s why I hate Windows so much, because I know nobody who can get under its hood.

« Older posts Newer posts »

© 2024 BigSmoke

Theme by Anders NorenUp ↑