Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Thursday, December 18, 2008

When VMware meets Ubuntu

VMware is a cool thing. Only after you have a few gigs of RAM and dual/quad-core, that is. Although it is a proprietary technology, it does have a free server version that is tremendously helpful to me, both in daily programming work and casual time-killing.

Ubuntu is another cool thing, which I enjoy using at the moment. But it has certain ``problems'' (or maybe ``features'' that I'm not used to). One of them pops up when I use VMware server 2.0 on Ubuntu 8.10.

In short, everything went fine (well, almost), except that I found my UP arrow key is gone, and my DOWN arrow key becomes the Windows key in my guest XP.

This was not a new problem. I had the same problem with previous versions of VMware and Ubuntu, but unfortunately forgot what the solution was. I had a one-line script that reads:

setxkbmap -rules xorg -layout "us" -model pc

which I remember solved one of the previous problems, but it didn't work anymore.

Googling on VMware and Ubuntu gives me a lot of information, so much so that I couldn't find relevant solution easily. Eventually I came across this howto:

How to VMWare Server 2.0 on Ubuntu 8.10

This basically says that adding the following line in /etc/vmware/config would solve the problem for VMware server (VMware Workstation requires a bit more work).

xkeymap.nokeycodeMap = TRUE

This one-line solution solved my keyboard problem. I'm really glad that someone took the trouble to write this howto to help people like me, who have problems remembering every detail.

Monday, December 15, 2008

Fine Tuning Locale in Ubuntu GNU/Linux

http://isis.poly.edu/~qiming/fine-tuning-ubuntu-locale.html

0. Background

A few years ago, I was quite frustrated in configuring locale settings in Debian when I switched from RedHat (not that it was any easier for RedHat), so much so that I ended up writing my own mini howto on it, hoping it would be useful to folks like me.

I also tried Gentoo for a couple of years, but gave up the idea of compiling everything from the source and the long process of installation (I could have used the binary packages but that would sort of defeat the purpose, wouldn't it?). Configuring locale in Gentoo was quite straight forward, though.

Recently I lean more on Ubuntu, mainly for its effortless installation and configuration processes. Although I lost a little of control as what should and should not be installed on my system, but with cheap hard drives and CPUs today, that seemed to be a reasonable trade-off.

1. Locale configuration problems in Ubuntu

Locale configuration in Ubuntu was, as in Gentoo, quite straight forward, provided that you use the default gdm, since it allows you to specify a locale at the login window, and Gnome handles locales pretty nicely. For example, scim would be run (and working nicely) when I chose "zh_CN.UTF-8" as my locale. It should be pretty much the same for kdm and KDE but I didn't try.

However, a couple of little tricks I used to play with Debian wouldn't work in Ubuntu. For example, in Debian I could have set the locale to "C" and still have scim working on my browser and gnome-terminal, whereas in Ubuntu scim simply wouldn't work that way.

Also, when I set the locale to zh_CN, I lost control of menu displays and error messages. Although it wouldn't hurt to read error messages in Chinese, it sometimes requires a bit of guess work to decipher what they really mean, especially those errors and warnings emitted from gcc.

Ocasionally you would need to copy/paste the messages to your browser to google about a solution to your problem, and error messages in Chinese (which is not standardized in anyway) just wouldn't help.

Most importantly, when you want to view man pages, having a locale other than "C" could make it complain and refuse to work. Same goes for programs like aspell.

In Debian I could put something in /etc/X11/Xsession.d/ to fine tune the locale settings (as I explained in the mini howto) But it didn't seem to work in Ubuntu (at last for for some release versions that I tried). In some cases I could work it around using the enstart.sh script as in the mini howto, but it's troublesome.

2. Fine Tuning

In the end, I figured out that /etc/environment is the right place to place the locale settings. Basically I inserted the following lines into the file but leave "LANG" and "LANGUAGE" unchanged:

LC_MESSAGES="C"
LC_COLLATE="C"
LC_CTYPE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"

(EDIT: Actually, only LC_MESSAGES is required in most cases. Putting all of them here may confuse Ubuntu as I recently found out.)

After that, log out of Gnome (which seems to have the side effect of restarting gdm, otherwise I may have to restart it manually), and log in back again, and menu items, error messages, man pages, etc., would be displayed in English, without affecting scim.

A minor (but surprising!) problem is that the /etc/environment file does not support usual variable substitution as in a shell script. So I cannot put something like

ENCODING="C"
LC_MESSAGES=$ENCODING
...

as I did in the mini howto. What happens to the Least Surprise priciple, I wonder.