Server set-up: Fixing locale and unknown key issues on VPS / Ubuntu “cloud” images

Here are a couple of problems I’ve seen with newly created instances of virtual servers, and their solutions.

locale:

When running apt-get upgrade for the first time, many errors appeared regarding an “unset” locale.

My locale is US/English, so the fix was:

sudo locale-gen en_US en_US.UTF-8
dpkg-reconfigure locales

missing keys:

Errors regarding unknown or missing keys.

[MISSINGKEY] is the string in the error message.

apt-key adv --recv-key --keyserver keyserver.ubuntu.com [MISSINGKEY]

Working with dates and timestamps in GNU Linux

With the GNU date command line utility.

Print time as seconds from the epoch, or, “seconds since 1970-01-01 00:00:00 UTC” :

$ date +%s
1365439166

Convert timestamp or epoch dates into familiar day and time :

$ date --date='@1365439166'
Mon Apr 8 11:39:26 CDT 2013

This works under Debian/Ubuntu, and may work under other Unix/Linux systems.

Getting ‘Scroll Lock’ to work under Linux

I’ve got a couple of keyboards with Scroll Lock keys that are not functional by default under Linux.
For my Ubuntu systems, the following procedure worked to fix the problem. After this, the LED for scroll lock lights and the key function as expected.

The steps are as follows:

  1. Find an unused modifier with xmodmap -p
  2. Use xmodmap to assign Scroll_Lock to this modifier
  3. Make the change persistent by adding it to your .Xmodmap file

First, use xmodmap -p to identify an unused mod key.
For example,

$ xmodmap -p
xmodmap: up to 4 keys per modifier, (keycodes in parentheses):

shift Shift_L (0×32), Shift_R (0x3e)
lock Caps_Lock (0×42)
control Control_L (0×25), Control_R (0×69)
mod1 Alt_L (0×40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0×85), Super_R (0×86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)

mod3 is the open modifier. So, we’ll use it with xmodmap -e :

xmodmap -e "add mod3 =Scroll_Lock"

Capitalization is important, so “Scroll_Lock” has to be written exactly as printed.
You can have a space, or no space, after the equal sign.

Check that it works, then add the command content to your home directory (file does not have to exist):

echo "add mod3 =Scroll_Lock" >> ~/.Xmodmap

pink noise

Pink noise can be used to mask distracting sounds in the environment around you. It can be useful for providing a neutral sonic background for concentration.

The program speaker-test comes in the alsa-utils package, and provides pink noise by default. This is described by its man page as “perceptually uniform noise”. There are a number of other options, but for a quick noise generator, speaker-test is very handy.

Command line fun for linux : included utilities

obelix@entity:~$ info util-linux-ng

What’s my ubuntu (or debian) version?

I have a  number of machines running various OS releases. Sometimes I need to check what flavor or relase I’m running on the current machine.
While uname -a will show the Linux kernel version, there are a few ways to get more information.
Here are three possibilities:
cat /etc/issue
cat /etc/lsb-release

and my favorite:
lsb_release -a

Here’s some sample output from lsb_release:
$ lsb_release -a
LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:core-4.0-ia32:core-4.0-noarch
Distributor ID: Ubuntu
Description: Ubuntu 10.04.1 LTS
Release: 10.04
Codename: lucid

The “lsb” in these commands refers to the Linux Standard Base.  For more information, see the Linux Foundation .

lucidor

I’ve been looking at a number of different ebooks and e-readers lately.  Lucidor is a project which is a little better looking than some of the older apps, but it is still pretty early in development.

Here’s a copy of lucidor 0.9, which was difficult to find due to problems with the lucidor site:

lucidor_0.9-1_all.deb

md5sum:  08faa6b60df2dae654e70431aa2e7626  lucidor_0.9-1_all.deb.gz
sha1sum: 0397853f5c4fe013fe36aed71ec0aa219f7f35f2  lucidor_0.9-1_all.deb.gz

installing ntop on Ubuntu : problem with rrd directories

The ubuntu install for ntop is broken without some additional steps.

‘Ubuntu Bloke’ had the easy fix :

"Create the directories that for some reason are not created by the installer
sudo mkdir /var/lib/ntop/rrd
sudo mkdir /var/lib/ntop/rrd/graphics
sudo mkdir /var/lib/ntop/rrd/flows
sudo mkdir /var/lib/ntop/rrd/interfaces
sudo mkdir /var/lib/ntop/rrd/interfaces/eth0
sudo mkdir /var/lib/ntop/rrd/interfaces/ppp0
sudo chmod -R 775 /var/lib/ntop"

Ubuntu 10.04, Lucid Lynx, Released

ubuntu-circle

Lucid Lynx has arrived. The release day was yesterday, though I’ve been running several systems on 10.04 since the alpha stage. It’s well done. I don’t yet have a use for the social networking tools/toys (the gwibber app and indicator-me gnome package), but I’m not unhappy with them either. The server image has been robust so far, but I haven’t thrown too much at it. I’m thinking of putting the netbook edubuntu version (à la the system 76 starling edubook ) on my older laptop to see how that flies.  Looks like fun.

Stanford folding@home and origami on Ubuntu

If you’d like an easy way to run folding to help the Folding@Home Stanford research project, even on a multicore system, ‘origami‘ may be a good soultion. I like it a lot.
It starts on boot-up automatically, can set folding to commence according to a schedule, allows project and stat checks from the command line, and even allows centrally administered group deployments (for example, to a lab full of machines). It does make laptops run pretty hot (as the CPU is engaged doing protein folding simulations), so I limit it to short bursts on laptops, but it can be a great tool to help in contributing to the folding project. You can also set origami to contribute to the TeamUbuntu folding project if you’re interested.

Next Page »