Renaming Linux Volume Groups

Linux Volume Manager provides software RAID and more generally abstraction between OS and disk devices. It is used by default for RHEL/CentOS 6.3 forward.

A cloned a VM will retain the volume group name of the parent. Use the following procedure to change it.

Find the current volume group name. (You can also see the current group name reflected in the output of dmsetup info.)

lvm vgdisplay

Rename the volume group:

vgrename <old_vg_name> <new_vg_name>

Edit /etc/fstab and /boot/grub/grub.conf so that the new volume group devices get used and mounted when the system starts.

Rebuild the initial RAM disk:

mkinitrd <initrd_file.img> <kernel_version>

Reboot and test.

Unicode characters in Gnome/Linux applications

Use ctrl-shift-u followed by the unicode character code in gedit, firefox, gnome-terminal, etc. Leading 0s (after the ctrl-shift-u) can be omitted. Works in webapps like Evernote as well.

Unicode 13 defines 143K+ characters, so you’ll soon need a map: https://www.unicode.org/charts/

u+00bc = ¼

u+00bd = ½

u+00be = ¾

u+2153 = ⅓

u+2154 = ⅔

u+202c = PDF

u+202d = LRO

u+202e = RLO

u+00b0 = °

Roman Numerals:
u+2160 = Ⅰ

in sequence through

u+216f = Ⅿ

Cisco console adapter for use with Ethernet cables

Eliminates the need for a rollover cable or a Cisco console cable. Just use any straight-through Ethernet cable.

In adapter kits, the RJ-45 side of the wires are attached. Plug them into the DB-9 side in the following order:

RJ-45      wire       Serial

1 (RTS)   blue      8 (CTS)
2 (DTR)  orange  6 (DSR)
3 (TxD)   black    2 (RxD)
4 (Gnd)   red        (Unused)
5 (Gnd)   green    5 (Gnd)
6 (RxD)  yellow  3 (TxD)
7 (DSR)  brown   4 (DTR)
8 (CTS)  grey       7 (RTS)

RJ-45 side is the DTE pinout of the Console port of most common Cisco equipment.

Autoformatting in WordPress 3.3

I’ve been modifying the formatting.php file to change how WP reformats text in pages and posts.

As of WP 3.3, the edits need to be made at lines 56 and 57. The static characters are the same but the replacement strings are longer.
The array elements are highlighted red below.

$static_characters = array_merge( array(‘—‘, ‘ — ‘, ‘–‘, ‘ – ‘, ‘xn&#8211;’, ‘…’, ‘“’, ‘\’\”, ‘ ™’), $cockney );
$static_replacements = array_merge( array($em_dash, ‘ ‘ . $em_dash . ‘ ‘, $en_dash, ‘ ‘ . $en_dash . ‘ ‘, ‘xn--‘, ‘&#8230;’, $opening_quote, $closing_quote, ‘ &#8482;’), $cockneyreplace );

Modifying and resizing tif images

Recently,  we had the need to resize some 8-bit greyscale tif images so that they took less space on disk. I had problems doing this since the app that wrote them in the first place used an old jpeg compression routine which was not compiled into the Ubuntu 10.10 tiff libraries.

I ended up installing the following in order on a Centos 5.5 VM. These were the latest releases as of this post.

jpg-8c (from www.ijg.org)

./configure –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man

tiff-3.9.5 (from www.libtiff.org)

./configure –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man –enable-jpeg –enable-old-jpeg

ImageMagick-6.7.0-9 (from www.imagemagick.org)

./configure –prefix=/usr –infodir=/usr/share/info –mandir=/usr/share/man

Once done, I finally found the best way to change the compression without ballooning the resulting file was to use:

convert 4527222.img -colorspace gray +dither -colors 8 -normalize -quality 75% 4527222.tif

( in this example, +dither actually disables dithering, -colors sets the palette to 8 bit and -quality sets jpeg compression to 75%)

This makes the file slightly smaller than the original, so to reduce it further, I used the downsize script from fwmconcepts

./downsize -s 100 4527222.tif 4527222-resize100.tif

Banshee locking up

Banshee 1.5.2 compiled from source code on Ubuntu 9.10 worked flawlessly until a system update around the end of November. From that point on, it locks up randomly when in shuffle mode.

So far I haven’t found out exactly why, and have worked around the issue by killing off the old banshee process and restarting:

kill -9 `pidof banshee-1`

Not elegant but it works…

Banshee 1.5.0 Beta

Compiled and ran this to mixed results.
Seems to allow playlist ordering, but only for imported playlists. Also playlist order was not preserved on import.
The biggest problem was an unhandled exception that caused Banshee to exit as soon as the exception was confirmed.
Happened even after deleting /usr/lib/banshee-1 and ~/.config/banshee-1

Filed bug report 585057 with gnome bugzillla.

FC9 iSCSI initiator tools

The stock FC iSCSI initiator is broken. Go figure.

Apparently it’s calls to sysfs don’t work correctly. The problem is that it’s not readily apparent. For instance, you can successfully send a discovery request to the portal and connect to an iSCSI LUN, but commands would fail completely, such as:

iscsiadm –mode session

iscsiadm –mode node -U all

So you can’t view or disconnect active iSCSI connections.

Fortunately, the fix is pretty easy. Download the updated iSCSI source code from open-iscsi.org. The current version is 2.0-870.2. Compiling against kernel 2.6.26.2 worked out flawlessly for me and so far has resolved the issues I found.