Friday, February 13, 2009

Reanabling FCKEditor for MoinMoin Wiki

The Costs of Free Software

FCKEditor, the rich text editor feature in MoinMoin wiki has been removed from the Debian/Ubuntu distributions from a decision the maintainer(s) made after notification of a security issue of enabling it. Obviously I wasn't the only person who got annoyed by its removal, given that the rich text editing feature has been the first place why many, like I, have used the wiki altogether.

So even the 'free' as in 'freedom' in software turns out to be not so free anyway - given that I had no freedom in weighing my own pros and the cons of dealing with the potential security problem. For me, the answer is clear as day - the wiki is only used in a secured local area network and has no editing rights, not even reading rights to anybody outside the intranet - so why should anybody dictate that I can't use FCKEditor with MoinMoin?

(No) thanks to them, this post wouldn't have existed if not for the shortsightedness in destroying the appeal of what otherwise would be an attractive software package. For all that FOSS is worth, it's main Achilles heel is certainly the lack of attention to the needs of end customers. That's why FOSS companies have to make their money out of service - because there is none!

How to Reanable FCKEditor for Debian/Ubuntu's MoinMoin

The workaround to using Debian/Ubuntu's version of MoinMoin is downloading the current version from the website and install it. Converting it to use your existing settings should be a relatively painless task.

Download the package
and install a local version of MoinMoin. Follow the same instructions as given on how to install as given in BasicInstallation section. I'll assume that you've installed it in /usr/local/ as was given in the example:

% python setup.py install --prefix='/usr/local' --record=install.log

Using /usr/local will separate the Debian/Ubuntu copy from your self installed copy.

You can then proceed on to installing MoinMoin using the same instructions from Ubuntu 7.04 - the instructions are still valid, but the thing that you have to watch out is to remember to replace all references of /usr/share/ with /usr/local/share.

In addition, you will have to modify the moin.cgi file. In downloaded version, it does not point to the /etc/moin configuration path. In order to reuse your old configuration, add the following line in red into your moin.cgi file:

#sys.path.insert(0, '/path/to/wikiconfigdir')
#sys.path.insert(0, '/path/to/farmconfigdir')
sys.path.insert(0, '/etc/moin')

This will make the wiki start reading from the /etc/moin directory like your Debian/Ubuntu package does.

Debian/Ubuntu has made further changes in the configuration to ensure you don't use the GUI editor, so you have to revert them back by adding or modifying the two lines your /etc/moin/mywiki.py file:

# The GUI WYSISYG editor is not installed with Debian.
# See /usr/share/doc/$(cdbs_curpkg)/README.Debian for more info
editor_force = True
editor_default = 'text' # internal default, just for completeness

editor_force=False
editor_default='gui'

Once the changes are made, restart apache, and FCKEditor should be reenabled again.
Wednesday, February 11, 2009

Setting Dual-Head Displays with Radeon HD 3650 in Ubuntu Linux

I'm using a Sapphire's ATI Radeon HD 3650 card, which may help you if you are using the same thing and want to set up a dual-head display properly.


From my experiences, I found that Ubuntu versions 7.10, 8.04 and 8.10 will get the card to work straight out of the box, but I had no luck to get it to work for dual displays perfectly except for version 8.10 (You'll still need some modifications to xorg though, see below).

For the two older version 7.10 and 8.04, the closest thing that I have come to making it work on the older versions is by downloading and installing ATI's driver straight from their support site.

With the older versions, both the xserver-xorg-fglrx (did not work - black screen) and the xserver-xorg-fglrx-envy (defers to the Mesa driver, making it horridly slow) packages weren't the most fruitful experiences when I tried installing them, so avoid unless you're keen on experimenting.

Installing via the ATI Installer

I'll recommend not to use this option if you have planning to upgrade to Ubuntu 8.10. There are a few quirks with the installer version that will not work well with your window manager if you wanted a rotated screen (See later section).

The steps are straightforward in this case: just execute the downloaded installer and follow the instructions. It's important to note the that the uninstaller is located at /usr/share/ati/fglrx-uninstall.sh, which may become necessary to do to prevent conflicting installations if you decided to apt-get from Ubuntu's repository later.

Upgrading and Installing from Ubuntu 8.10's Repository

These steps are probably not necessary if you've installed Ubuntu 8.10 fresh, but may be essential if you got here through an upgrade path like I did.

The main things you want to apt-get are: xorg-driver-fglrx, jockey-common, jockey-gtk. As a non-dependent package, jockey-common is surprisingly crucial to getting your setup to work, as it contains working versions of amdpcsdb and various important files in /etc/ati.

Once you the packages installed, if you are running gnome, go to 'System -> Administration -> Hardware Drivers' and you should see the ATI Driver available for installation. Click on 'Activate' to download the driver and install. It may take a while before the installation completes.



After the installation, you may be prompted to restart your machine. Before you do, just check that the 'fglrx' driver is mentioned in /etc/X11/xorg.conf. Check that the following line is present in your "Device" Section, eg:


Section "Device"
Identifier "Configured Video Device"
Driver "fglrx"
EndSection


Add the line in red into your xorg.conf if it isn't present. Here's an example xorg.conf that may help. Once you are done with the changes, restart your machine.

Checking that fglrx Driver is Running

With luck, your X should be running on your system after the installation. The first thing to do is you check that you have the 'fglrx' driver running. You should get something like this from the output of 'fglrxinfo':


% fglrxinfo
display: :0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: ATI Radeon HD 3600 Series
OpenGL version string: 2.1.8087 Release


You can also run fgl_glxgears to verify that the card is running correctly visually.

Setting up the Dual Display Configuration

( Update: Compiz does work OK with dual-display, and out of the box as well, just not with rotated-screens. If you don't use rotated screens, this should be fine, so skip the following section. )

The dual-head display set up does not work well with the compositing manager - this is troublesome for Gnome because the default manager is Compiz. You'll have to pass the eye-candy and rely Metacity instead. If you don't, your reconfigured X server either conks out with a backtrace failing on some deprecated calls, or you're greeted with just a wallpaper background or a black screen.

To get access to the settings, you'll need gconf-editor which is an X application, so you should change this setting before you try restarting X in dual-head mode.

Run gconf-editor and change the key value in /desktop/gnome/applications/window_manager/default and /desktop/gnome/applications/window_manager/current from '/usr/bin/compiz' to '/usr/bin/metacity'



Next is to make changes in your xorg.conf file. While ATI provided the default tools like 'aticonfig' and ATI's Catalyst Control Centre ('amdcccle'), I'll recommend you avoid them for now (see Troubleshooting for why).

Here's an excerpt from my xorg.conf as an example:


Section "Device"
Identifier "ATI Radeon HD 3650 [0]"
Driver "fglrx"
BusID "PCI:1:0:0"
Screen 0

# only need to set it one time for a dual-head card
# Option "UseFastTLS" "1"
# Option "VideoOverlay" "on"
# Option "OpenGLOverlay" "off"
EndSection

Section "Device"
Identifier "ATI Radeon HD 3650 [1]"
Driver "fglrx"
BusID "PCI:1:0:0"
Screen 1

# Rotation: Not supported as an option directly at the moment
# Option "RandRRotation"
# Option "Rotate" "CCW"
EndSection

Section "Monitor"
Identifier "Monitor 0"
EndSection

Section "Screen"
Identifier "Screen 0"
Monitor "Monitor 0"
Device "ATI Radeon HD 3650 [0]"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
Option "DPMS"
EndSection

Section "Screen"
Identifier "Screen 1"
Monitor "Monitor 1"
Device "ATI Radeon HD 3650 [1]"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
Option "DPMS"
EndSection

Section "ServerLayout"
Identifier "Default Layout"
Screen "Screen 0"
Screen "Screen 1" RightOf "Screen 0"
EndSection

Section "ServerFlags"
# have to disable xinerama if I want screen rotation
Option "Xinerama" "off"
EndSection


The full xorg.conf file can be found here. Make the relevant changes, keep your fingers crossed, and restart your computer.

Screen Rotation

If you've managed to get this far, I'd assume that you have your dual head display working by now. If you wanted more fun out of your display, you can try the rotation capabilities provided by randr. The randr extensions are disabled by default; if you tried xrandr without enabling the extensions you're going to get this message:


% xrandr --output default --rotate left
xrandr: output default cannot use rotation "left" reflection "none"


To enable the randr extenstions, use the 'aticonfig' tool:


% aticonfig --set-pcs-str='DDX,EnableRandr12,TRUE'


Restart X or your computer after you made the changes.

While the ATI installer versions works without a hitch on older versions of Ubuntu, rotation is the only case it doesn't work right. For your window manager to detect it's dimensions properly, you'll have to install Ubuntu's version of fglrx, which somehow takes care of the rotation properly compared to the ATI installer version. Rotation also will not work if you are running in Xinerama configuration - you'll end up with areas on your workspace not being accessible by your mouse.

While Gnome allows the option to change its screen rotation from its menu, it doesn't seem to be able to rotate the screen even when the option is set. This means the screen you want rotated will always start landscape every single time it starts up. At least xrandr now can detect all the screens that you have available on your card and perform rotation on it:

% xrandr
Screen 1: minimum 320 x 200, current 1024 x 1280, maximum 1280 x 1280
DFP1 disconnected (normal left inverted right x axis y axis)
DFP2 connected 1024x1280+0+0 left (normal left inverted right x axis y axis) 338mm x 270mm
1280x1024 60.0*+ 75.0 75.0 70.0 60.0*
1280x960 60.0 60.0
1152x864 75.0 70.0 60.0
1280x768 59.9
1280x720 60.0
1024x768 75.0 75.0 72.0 70.1 60.0
800x600 72.2 75.0 70.0 60.3 56.2
720x480 60.0
640x480 75.0 72.8 75.0 60.0
640x432 60.0
640x400 75.1 59.9
512x384 60.0 74.9
400x300 75.0 60.7
320x240 75.6 60.0
320x200 75.5 60.1
CRT1 disconnected (normal left inverted right x axis y axis)
CRT2 disconnected (normal left inverted right x axis y axis)
TV disconnected (normal left inverted right x axis y axis)

To do rotation, you'll have to invoke this command every single time you log in:


% xrandr --output DFP2 --rotate left


Replace DFP2 with whatever screen xrandr reports you have.

Troubleshooting

1) There are a few times I had my run-ins with the utility tools ATI provides. Firstly with 'aticonfig'. While it proves useful sometimes, at others, it screws up your xorg.conf configurations. What I'll recommend is that you play around with aticonfig, and copy the relevant parts it generated into your own xorg.conf file, instead of relying on it blindly.

2) The other tool, ATI's Catalyst Control Centre ' - amdcccle', is just pure evil IMHO. The ATI drivers install an important file called '/etc/ati/amdpcsdb', which it loads independently from xorg.conf. If you're finding that X isn't working anymore even with an xorg.conf file you know to have worked previously, it's most likely that the amdpcsdb has been corrupted, which I find that happening from tinkering around with amdcccle, which is probably the biggest time wasted in trying to hunt down spurious problems.

If your card hangs even if Sysreq keys doesn't work no matter what xorg.conf parameters you've changed, the first thing is probably to try to restore the database. The way I got it to work again was by coping over the amdpcsdb.default file to amdpcsdb, eg:


% cp /etc/ati/amdpcsdb.default /etc/ati/amdpcsdb


Do make backups of the original file before you do that, I'm not responsible for any loss or damage it would cause!

3) If X turns into a black screen after you've logged out, try adding or modifying the following line inside /etc/gdm/gdm.conf to true:


# If you are having trouble with using a single server for a long time and want
# GDM to kill/restart the server, turn this on. On Solaris, this value is
# always true and this configuration setting is ignored.
AlwaysRestartServer=true


 
Monday, February 09, 2009

Confessions of a 'Ctrl-Alt-Del' Addict

Growing up in a world where MS-DOS was the first operating system I've ever used certainly leaves me rather brain-damaged when it comes to the 3-finger salute of 'Ctrl-Alt-Del'. That key combination literally is the 'One Keystroke That Rules Them All' - more or less, it's the last thing that will probably still work in the face of a catastrophic computer failure.

Obviously, I never did wean off from my un-elite MS heritage, so it should come as no surprise that I sometimes still use 'Ctrl-Alt-Del' to solve my problems in Linux. Still, it's nice to know that Linux on the whole has always been accommodating enough to include that magic keystroke to satisfy the likes of people like me - most distributions secretly sneak in a line in /etc/inittab (or /etc/event.d for Ubuntu's Upstart) to make it reboot should I fancy myself into fondling those keys when my urge arises, although I must say I have less urges to do so these days ever since I've migrated to Linux, so thanks for asking!

Even when in graphical mode (it's called 'X-Windows' by the way, but you can simply call it 'X' if you want to be a smarty pants, but calling it 'Windows' is plainly an insult!), most window-managers still associate it with some behaviour, like invoking 'xkill' or popup for a shutdown menu. I think some window-managers even invoke the screensaver for that! (I don't even want to go there - that's just plain wierd!)

Shame to say, I've only recently discovered the equivalent of 'Ctrl-Alt-Del' in the Linux world after using it for 8 years!

The magic keys are known as 'System Request' (Sysreq) keys, the all powerful keystrokes a man can invoke (then pray) if your system ever gets f**ked or becomes totally unresponsive. Before you even hit the power switch, try holding down the 'Alt-PrintScreen' keys, and type in the following letters: r-s-e-i-u-b

A good way to remember it is by the phrase:

"Reboot System Even If Utterly Borked"

With luck, that will try to kill all processes gracefully, sync all data to your drives, unmount them, and reboot your system. There's more to the Magic Sysreq keys than I have let on, and more details can be found here.

There are a few other neat tricks with the Sysreq keys, like killing off errant applications that's chewing off too much of your system memory with 'Alt-PrintScreen' + r-f.

A pity that I've only learnt it after such a long while, for it would have been really helpful when I was tearing my hair off a while ago when Rubygems was chewing up all my free memory and thrashing my harddisk from all that silly swapping.
Saturday, February 07, 2009

Ubuntu 8.04's Generic Kernel Hangs Machine

(Updated: To solve your problem, upgrade to Ubuntu 8.10. The newer kernel does not suffer from the problem mentioned below)


If you are using a Vostro 200, this post may apply to you, but bear with my few paragraphs of rant before I give you a fix to the problem. :)

Bloody linux has done it again, borking up my machine during an upgrade cycle. That's always why I'm hesitant on upgrading unless there is no choice. I'll leave the FOSS purists to argue about the concept of 'free' in whatever way they like, but I've always been mindful that there is a hidden cost involved in using Open Source software - you're paying it with your time as a guinea pig for the developers to solve the problems you've encountered.

One way to mitigate that cost is by not using the most cutting edge versions of software - in that way, you're relatively safe from any initial teething issues that still needs to be fixed. But the bad news is, stable/working probably equals to 5 years or more in the FOSS world, and computer hardware moves faster than that.

Given the fast turnover of computer peripherals, no sensible shop will stock 5 year old hardwares to sell it to you, and hence my problems started when I added a new ATI Radeon card to the system. The last known working kernel for the Vostro had been 2.6.22-14-generic, which I had found out a long time ago when I had 'apt-getted' a 2.6.22-16-generic kernel. The obvious quick-fix then was to be make GRUB boot my older kernel, to which I left it at that.

But given that I had installed a new card and needed to install ATI's newest driver, the driver installer, in cahoots with dkms, decided that I wanted a 2.6.22-16-generic kernel module, which obviously screws up X, and hangs my machine whenever the xserver tries to start.

So I'm left with the situation that either the kernel will hang, or X will. Greeeeat.

Since I had been holding off upgrading from Gutsy to Hardy for a long while, I decided to take a gamble to see if the upgrade to a newer kernel would have solved the problem, since it's probably 1 year past the last release cycle. But it turns out to be a real awful mistake - upgrading to 2.6.24-23-generic still screws up the SATA controller, ejecting me to busybox's prompt after giving the following messages:

ata1.00: qc timeout (cmd 0x27)
ata1.00: failed to read native max address (err_mask=0x4)
ata1: failed to recover some devices, retrying in 5 secs

...

ata2.00: qc timeout (cmd 0x27)
ata2.00: failed to read native max address (err_mask=0x4)
ata2: failed to recover some devices, retrying in 5 secs

...

I can imagine Mac users laughing with derision at me right now - 'Get a Mac, it just works!'

After wasting two nights of precious time booting into my old kernel and trying to coax xserver and the fglrx driver to play nice, I decided to revisit the issue of fixing the kernel problem. After a bit of digging, I found the solution in launchpad's bug report: 'Ata Revalidation Failed'. To solve the problem, add the argument 'irqpoll all_generic_ide' into the kernel line in GRUB:

title        Ubuntu 8.04.2, kernel 2.6.24-23-generic
root (hd0,0)
kernel /boot/vmlinuz-2.6.24-23-generic root=UUID= ro irqpoll all_generic_ide
initrd /boot/initrd.img-2.6.24-23-generic
quiet

I don't know what exactly the kernel flag does, but I suppose the SATA controller wouldn't jive with the kernel and needed a jolt of forcible of polling from the kernel for it to work.
Tuesday, February 03, 2009

It's Alive!

In the deep, dark dungeons where a lone man is working in near darkness, only to be briefly illuminated by random arcs of lightning bolts and the cackle of electricity zipping through the air.

This man, who loomed larger than he actually is from the momentary manifestation of his silhouettes, seemed to be working on something rather intently, only to have him stop and suddenly exclaim:

Dr. Frankenstein:
It's Alive!

Frankenstein's monster: Is it, Solaris?

Dr. Frankenstein: No, Ubuntu my friend, Ubuntu!



A Resurrected Sun UltraSparc 5 running on Ubuntu Linux! Woot! :)
Monday, February 02, 2009

Brrrr! It's Cold Today!

Last night, the BBC Met Service reported of snow in several areas in the UK from the Arctic blast. Seems like the Emerald Isle is not immune from it too, look what's outside my window this morning - frost!


A zoom-in shows the football field and rooftops covered in white:


And the pavements:



Addendum : It started snowing today! I was told that this is a rare sight for Dublin, but snow just isn't funny to me! ;-/
Sunday, February 01, 2009

Famous Nerds: Bill Joy

Who is he? Just some guy who brought us BSD, NFS, the UltraSPARC and parts of Java. To the uninitiated, these terminologies probably don't mean much to you, possibly other than Java (Yes, they are the guys who trademarked the name of an island in Indonesia because they couldn't screw around the laws of their own country to name it after a tree).

Besides being the creator of these obscured things, his important contribution to Computer Science to me, is vi, the precursor to the vim editor that I use almost on a daily basis.

Vi is a very old piece of software that was created in 1976. Even as a text editor older than I am, it one of the most remarkable software that I've used. Not that it is the most earth shattering piece of software, but that some people like to argue that Google Earth is more rightly so, yeah right, you laymen. Pfffffffft.

While I find vi archaic enough, vi was born out of Joy's frustrations with another archaic editor called 'ed'. Just to highlight how l33t these guys are, they had to name everything in two archaic letters, just like the 'holy trinity' of Unix commands 'ls', 'cp' and 'mv'.

More talented than the other Bill (That billg@microsoft.com, who was said to have written BASIC over the course of one weekend), Joy known for writing vi over the course of a single weekend too, as well as writing the entire TCP/IP stack of Berkeley Unix by himself.

And he only did so because he thought the TCP/IP stack written by contractors hired by DARPA was inferior. And when asked how he managed to do it, his smug response was, 'It's very simple -- you read the protocol and write the code.'[1]

(Before I get a lawsuit from either 'Bills', I better clarify that most of it probably isn't true. Bill Joy wrote vi in months rather than a weekend, and wrote parts of TCP/IP as opposed to the whole thing. And he probably didn't say that either.)

Just like a smug geek of his days, he's has done the world of Computer Science a whole deal of good by creating a great deal of useful software, unlike today's smug little shit, who is only good at creating useless things that all my friends seem so addicted to. :P

[1] http://dir.salon.com/story/tech/fsp/2000/05/16/chapter_2_part_one/index.html?pn=3