BigSmoke

Smokes your problems, coughs fresh air.

Page 45 of 52

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.

Ultra Cheap dual Eizo monitor setup

As people who know me know, I passionately hate TFT screens, for reasons not relevant right now. It is unfortunate that marketing has caused the superior type of monitor, the CRT, to disappear.

But, there are good sides to it, though. I was walking through a second-hand store the other day and saw and Eizo T961 21″ Flatscreen. Most people wouldn’t want such a thing because of its size, and that was probably the reason it was only 15 euros. I was curious as to its quality, so I bought it.

Aside from a few minor things and after recalibration (which these Eizo CRTs make possible through the on-screen menu), the image quality was very nice. In some respects even better than my own 19″ T766 (but granted, that one was better with it’s old picture tube, which was replaced when I had it repaired).

In any case, I now have a dual Eizo CRT setup, which cost me practically nothing.

Dual Eizo monitor setup

Dual Eizo monitor setup

Edit: I use this image for calibration:

monitor-calibrate

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.

Finding and deleting duplicate files

I needed to remove all duplicates In a collection of hundreds of thousands of files. I first came across this, which generates a script with commented out rm statements, but I quickly found another tool, fdupes, which made life a lot easier for me; I didn’t want manual control. I just wanted to have all the duplicates deleted, except one of them.

Fdupes has a feature to omit the first file in a set. So I made a simple script which found all duplicates, omit the first of the set, and put rm statements before the file names:

#!/bin/sh
OUTF='rm-dups.sh'
 
echo "#!/bin/sh" > $OUTF
fdupes -r -f . |sed -r 's/(.+)/rm \1/' >> $OUTF
chmod +x $OUTF

This script in turn generates another script, which can then be executed, but not before checking if it is actually correct, of course.

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?)

« Older posts Newer posts »

© 2024 BigSmoke

Theme by Anders NorenUp ↑