Check if a server is about to run fsck

Couple of weeks ago I installed some updates to my server. And when I restarted it, it didn’t came up. To make things worse, the IPMI console decided to go on strike so I couldn’t see what’s really going on. I presumed that the system isn’t responding because of some kernel panic. After a while, I gave up for that night in hope the in the morning the IPMI would be sorted out. To my surprise, the IPMI was still out of work, but the server was up again. Apparently, the system wasn’t stuck on kernel panic, but on fsck‘ing the harddisks. So in order to avoid such problems in the future I looked for a way to tell when the system is going to run fsck after the next reboot (I also had the IPMI fixed).

 $ sudo tune2fs -l /dev/sda6

In the output you will find the following lines:

Mount count:              2
Maximum mount count:      36
Last checked:             Tue Jul 26 04:49:18 2011
Check interval:           15552000 (6 months)

“Maximum mount count” is the number of mounts after which the filesystem will be checked by fsck. “Check interval” is the maximal time between two filesystem checks. The command also lets you see the actual mount count since the last check and when it took place.

Missing *.la files

Sometimes when you compile a package it fails and complains it can’t find an *.la file for some library that is installed. Recently I had it when compiling dev-libs/gobject-introspection which complained about missing libpng14.la. The solution for this is to run:

sudo lafilefixer --justfixit

It won’t create the .la file, but it will fix the libtool references so nothing points to it so packages will compile fine.

Deleting Comments from Tickets in Trac 0.12

About a year ago I wrote about a way to delete comments from tickets in Trac prior to version 0.12 (as it didn’t exist back then). Basically the method was to directly delete the comment from the database. Lately, spammers have been harassing one of my Trac installations, bypassing the spam filtering, and changing ticket properties. The old method wouldn’t revert those changes. After searching for a solution, I found a little documented option in Trac 0.12 that allows to delete comments and revert changes to tickets.

To enable it, go to the admin panel->Plugins->Trac 0.12 and enable TicketDeleter under tracopt.ticket.deleter.*. This will add a “Delete” button right next to the “Reply” and “Edit” buttons of every comment. It will also revert any changes to the ticket properties.

See #3641 and [9270] for the relevant ticket and changset in Trac’s own Trac.

LaTeX for TiddlyWiki – A MathJax Plugin

Update: The MathJax Plugin for TiddlyWiki has a new home: https://github.com/guyru/tiddlywiki-mathjax
Some time ago I came across MathJax, a nifty, Javascript based engine for displaying TeX and LaTeX equations. It works by “translating” the equation to MathML or HTML+CSS, so it works on all modern browsers. The result isn’t a raster image, like in most LaTeX solutions (e.g. MediaWiki), so it’s scales with the text around it. Furthermore, it’s quite easy to integrate as it doesn’t require any real installation, and you could always use MathJax’s own CDN, which makes things even simpler.

TiddlyWiki with the MathJaxPlugin
A tiddler with LaTeX equations.

Continue reading LaTeX for TiddlyWiki – A MathJax Plugin

Using Monospaced Font in the TidddlyWiki Editor

By default, TiddlyWiki uses its default fonts (Arial or Helvetica) for it’s tiddlers editor. While these fonts are more than fine as default font for the text in tiddlers, I found it much less convinient when editing tiddler’s. Furthermore, it’s even a bad choice when one has code snippets in his tiddlers.

The following code snippet solves the problem by resetting the font used in the editor to monospaced font. Just add the following snippet:

/*{{{*/
.editor {
    font-family: DejaVu Sans Mono, Courier New, monospace;
}
/*}}}*/

To your StyleSheet tiddler (or create it if it doesn’t exist yet). Now the next time you’ll edit a tiddler you will do it using a monospaced font.

Temporary Disabling Bash History

Say that you’ve got to pass some password as command line argument to something. It would probably be a bad idea to store it in your ~/.bash_history, but clearing the file isn’t desired either. So you need to temporary disable the command history for the current session. You can do it by unsetting the HISTFILE environment variable.

unset HISTFILE

The result is that while the session is active you can access the history as usual, but it won’t be saved to the disk. History for other sessions, will behave as usual.

iproute2 Cheatsheet

The iproute2 package offers the ip utility, which is a modern replacments for tools such as ifconfig, route, arp and more. It allows to configure addresses, links route and arp tables. The only problem is that its documentation can be quite confusing. This post is intended to be a task-oriented guide to this utility, it’s far from complete and I intend to update it from time to time.
Continue reading iproute2 Cheatsheet

Kernel Configuration and nvidia-drivers

This is more of a note to myself, as I keep forgetting this. The propriety NVIDIA drivers, provided by the x11-drivers/nvidia-drivers dislikes alternatives. It will refuse to build against a kernel with the rivafb (CONFIG_FB_RIVA) and nvidiafb (CONFIG_FB_NVIDIA) built in or built as modules. Both can be found (and unset) under:

Device Drivers
-> Graphics support
   -> nVidia Framebuffer Support
   -> nVidia Riva support

Eject Your Kindle and Reconnect under Linux

I am Your User suggested a method to eject your Kindle in Linux. While his method works, you don’t need to specify the partition number. E.g.

$ sudo eject /dev/sdd

where /dev/sdd is the device file of the Kindle.

But what if you want to reconnect it back without plugging in and out the usb cable? You can add the -t switch.

$ sudo eject -t /dev/sdd

Even though it prints the following error:

eject: CD-ROM tray close command failed: Input/output error

it works, and the Kindle reappears in KDE.