Tag Archives: Ubuntu

Getting your locale right

So, you get this annoying error (in Debian, some Ubuntu, or perhaps any other Linux or even Unix system):

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

Perhaps you get it when running apt-get?
You Google for answers and you find nothing useful and/or just contradictory information?
You are connecting over SSH?
You are connecting from another system (like Mac OS X)?
Read on…
In it simplest incarnation, the problem looks like this.

$ man some-none-existing-program
man: can't set the locale; make sure $LC_* and $LANG are correct
No manual entry for some-none-existing-program

$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

What happens here, in the second case is that “UTF-8” is not a valid LC_CTYPE (in Debian) and since LC_ALL is not set it can not fall back properly. That is all. Why is LC_CTYPE invalid? Perhaps because you have used ssh from Mac OS X (or something else):

mac $ locale

mac $ ssh user@debianhost

The point is, here LC_CTYPE=UTF-8, and it is valid in OS X. But it is not valid in Debian. That is all there is to it. Try:

# This will fix the problem
mac $ LC_CTYPE=en_US.UTF-8 ssh user@debianhost

# This will produce the problem even from a Debian machine
debianclient $ LC_CTYPE=UTF-8 ssh user@debianhost

# This will (kind of) eleminate the problem when already logged in
$ LC_CTYPE=en_US.UTF-8 locale
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)

So, the problem is that all the guides on the internet presume you have a problem with your locales on your server, which you dont! The locale is probably fine. It is just that the ssh client computer has an LC_CTYPE which does not happen to be valid on the server.

The Debian Locale guide itself is of course correct. And it states that you should not set LC_ALL=en_US.UTF-8 (!). That is however the only “working” answer I found online.

I guess the easiest thing is to add a line to your .profile file (on the server):

$ cat .profile 

If you are not using a bourne-shell you probably know how to set a variable for your shell. Any other method that will set LC_CTYPE to a locale valid on your Debian machine will also work. Clearly, you dont need (and you probably should not) set LC_ALL.

Not happy with en_US.UTF-8?
Not everyone use the American locale. To find out what locales are available/valid on your system:

$ locale -a

Want others?

$ sudo dpkg-reconfigure locales

or read the Debian Locale Guide.

Eee701 in 2015

My eee701 is not doing very much anymore, but sometimes it is handy to have it around. I have not upgraded it since Lubuntu 13.10, and that version is not supported anymore. I found that:

  1. Since 13.10 is abandoned upgrading with apt-get generated errors.
  2. 15.04 Lubuntu desktop ISO complains that the hard drive is less than 4.1Gb.
  3. 14.04.2 Lubuntu desktop ISO complains that the hard drive is less than 4.5Gb.

Thus, the standard upgrade or installation paths were blocked. And I was not very interested in putting lots of effort into getting my eee701 running a current system.

Instead, i tried the Ubuntu mini-iso. That was very nice! The iso itself is written with dd (rather than the Startup Disk Creator) to USB drive. The installation is text (curses) based, but very guided (just like Debian). I choose a single 4GB ext4 partition for root, no swap (since I have 2GB RAM) and “Xubuntu minimal” desktop. Keyboard, Wifi and timezones were all correctly set up. When installation was complete and system restarted I had 1.8Gb used and 1.7Gb available. Not even a web browser was installed, but Xubuntu itself was fine.

Not bad at all!

Seeding Xubuntu and Lubuntu

It is not much I do to contribute to the Ubuntu community so when Ubuntu 15.04 was released a few weeks ago I downloaded 4 isos with bittorrent and kept seeding them for the benefit of Ubuntu users.

Now (2015-05-10):

Image                                Size     Ratio
lubuntu-15.04-desktop-i386.iso      696Mb       120
lubuntu-15.04-desktop-amd64.iso     690Mb      60.0
xubuntu-15.04-desktop-i386.iso      970Mb      68.5
xubuntu-15.04-desktop-amd64.iso     963Mb      68.2

Does this mean anything?

If the ratio has anything to do with the popularity of different ubuntu versions:

  1. It surprised my that Lubuntu is so popular
  2. It surprised me that i386 is still very popular

There are, however, a number of factors that could disturb the correlation between my ratio and the true popularity of different Ubuntu flavours:

  • The way Lubuntu vs Xubuntu push people to the torrent (rather than the direct http/ftp) download, I found it harder to find the Lubuntu torrent, though.
  • Lubuntu and Xubuntu may have different audiences, with different attitude to torrent downloads.
  • i386 and amd86 may have different audiences as well
  • If more downloaders mean more seeders, and people on average seed close to 1.0 (or even above) then my Ratio may mean very little.
  • The tracker may have identified me as a stable seeder and sent downloaders of less popular images (both to download and seed) my way, in an attempt to provide equally good service for everyone (no idea if trackers do this).

The i386-heaviness of Lubuntu indicates that there should be correlation between general popularity and my Ratio.

Xubuntu on Unsupported MacBook

Last week I wrote about installing Mac OS X Mavericks on my MacBook 2007 (MacBook 2,1). That went fine… but… for a computer I mostly use in my lap, in the living room, no decent Internet Video performance (like YouTube) feels disappointing (it was not good before I upgraded to 10.9 either).

So, I decided to install Xubuntu on it. First the conclusions:

  1. Xubuntu runs nicely on the MacBook2,1.
  2. Video works fine, much better than on Mac OS, and also suspend/sleep, audio, WiFi seems perfect. I have not tried the webcam.
  3. I ended up using Xubuntu 14.04.1, the 32-bit i386 edition.
  4. Booting and partitioning is not trivial.
  5. International Apple Keyboards are always a challenge in Linux.

Now to the details.

Xubuntu version
The 32-bit EFI and 64-bit CPU that causes problems for current versions of Mac OS is also an issue for Xubuntu. I downloaded and burnt DVD-isos to try different versions. The 64-bit Xubuntu does not boot easily but the 32-bit versions are just fine. For a computer with 2.5Gb RAM as I have, the practical disadvantages of running it in 32-bit mode instead of 64-bit are insignificant.

A nice thing with Xubuntu is the Live-mode; you can start the DVD and test the full system before deciding to install. Of course performance when starting applications suffer. I first installed 14.10; the Live system worked perfectly, but I had video problems (screen was black after system was completely started) after installation and decided to try 14.04.1 instead, which worked just fine. Since 14.04 is a long-term-release it might just be the better choice anyway.

There used to be x64-Mac-images, that fixed the 32-bit-EFI-64-bit-kernel problem but they are not available anymore.

Finally, I think it is quite safe to assume that you will be fine with Ubuntu, Kubuntu or Lubuntu if you prefer them to Xubuntu.

Keyboard issues
I have a Swedish keyboard on my MacBook, and the AltGr (just named Alt on the Mac) does not work out of the box. This cause problems to type particularly the following characters: @$|[]\{}~.

I found it best to just use Generic 105-key PC keyboard and standard Swedish layout. After that a little xmodmap-hack is required.

Put the following in a file called .Xmodmap in your home directory:

keycode 64 = Mode_switch
keycode 11 = 2 quotedbl at at
keycode 13 = 4 dollar 4 dollar
keycode 16 = 7 slash bar backslash
keycode 17 = 8 parenleft bracketleft braceleft
keycode 18 = 9 parenright bracketright braceright
keycode 35 = dead_diaeresis dead_circumflex dead_tilde dead_caron

The first row maps the left Alt ley of my keyboard to something called Mode_switch. The other rows indicate what happens when pressing the buttons 2,7,8 and 9.

The following information from “man xmodmap” was useful in finding the above solution:
Up to eight keysyms may be attached to a key, however the last four are not used in any major X server implementation. The first keysym is used when no modifier key is pressed in conjunction with this key, the second with Shift, the third when the Mode_switch key is used with this key and the fourth when both the Mode_switch and Shift keys are used.

The internet is full of sources telling to use ISO_Level3_Shift. It did not work for me and the above manpage told me exactly what I needed to know.

There are also sources telling you other names than .Xmodmap (like .xmodmaprc , .xmodmap), that also do not work.

Before you are ready to write your .Xmodmap file you can test one by one:

xmodmap -e "keycode 64 = Mode_switch"
xmodmap -e "keycode 11 = 2 quotedbl at at"
xmodmap -e "keycode 13 = 4 dollar 4 dollar"
xmodmap -e "keycode 16 = 7 slash bar backslash"
xmodmap -e "keycode 17 = 8 parenleft bracketleft braceleft"
xmodmap -e "keycode 18 = 9 parenright bracketright braceright"
xmodmap -e "keycode  35 = dead_diaeresis dead_circumflex dead_tilde dead_caron"

The command xev is very useful to find out what keycode corresponds to a physical key on your keyboard.

Partitioning – The hard way
From the beginning, before ever playing with Xubuntu on the computer, I had the following partitions:

1: EFI (small, hidden in Mac OS)
2: Mac OS 10.9 System
3: Mac OS 10.7 System
4: Apple boot (small, hidden in Mac OS)

When I first installed Xubuntu I deleted partition 3 and replaced it with three partitions:

3: biosboot (small, required by EFI)
5: Linux SWAP (4GB)
6: Linux /

That was ok. But when I later deleted those partitions from Mac OS X because I thought that was more safe, the Apple boot partition (#4) disappeared. If it was this thing then perhaps it is ok. Mac OS still boots.

I always choose manual partitioning, and to install the Linux Bootloader (GRUB) on the Linux root partition (/dev/sda6). I have no idea what happens if it is installed on another partition, and particularly not on /dev/sda itself.

rEFInd – The hard way
The recommended way to boot Xubuntu on a Mac is to use rEFInd. Apples EFI-implementation is not supposed to be very competent at booting other systems. So I installed rEFInd (0.8.4) using the install.sh script from Mac OS X. Very easy, and it worked right away. Problems started later.

My first installation of Xubuntu was 14.10, and as mentioned above it had video problems. So I reinstalled 14.04.1 instead of 14.10, same partitioning, and everything was fine. Except rEFInd displayed TWO linux systems as well as Mac OS to boot. This disturbed me enough to decide to delete all traces of Xubuntu and reinstall.

I ended up in the following situation:

  • I have not managed to get rid of the last Linux-icon in rEFInd.
  • I have ended up with a partly broken rEFInd, it displays the error message:
    Error: Invalid Parameter while scanning the EFI directory
  • rEFInd does not boot Xubuntu.
  • I can not uninstall rEFInd as described in its site, by removing the directory EFI/refind, because it does not exist (there are just some rEFInd config files in the EFI directory).
  • I read that efibootmgr can be used form Linux to clear parts of NVRAM, but it is not supposed to have much effect on a Mac anyways. And I failed to use efibootmgr on Live-Xubuntu.

The rEFInd errors actually disappeared by themselves after I had used (started) Mac OS a few times.

Partitioning and rEFInd – the Easy way
I think you will be safe if you do:

  1. Make empty space on the disk, after the Mac OS partitions.
  2. Install rEFInd from Mac OS
  3. Install Xubuntu 14.04.1 i386 (32-bit), let Xubuntu install side by side and take care of partitioning and boot devices

This finally worked for me. My partition table is now:

Number  Start   End    Size    File system     Name                  Flags
 1      20,5kB  210MB  210MB   fat32           EFI system partition  boot
 2      210MB   120GB  120GB   hfs+            Customer
 3      120GB   120GB  1049kB                                        bios_grub
 4      120GB   317GB  198GB   ext4
 5      317GB   320GB  2651MB  linux-swap(v1)

Xubuntu on a MacBook mid 2007 (MacBook2,1) rocks. Better than Mavericks. But dual booting and rEFInd is not completely predictable. The good thing is that it is not very easy to end up with a complete unbeatable computer at least.

Installing Citrix Receiver 13.1 in Ubuntu/Debian

The best thing with Citrix Receiver for Linux is that it exists. Apart from that it kind of sucks. Last days I have tried to install it on Xubuntu 14.10 and Debian 7.7, both 64-bit version.

The good thing is that for both Debian and Ubuntu the 64-bit deb-file is actually installable using “dpkg -i”, if you fix all dependencies. I did:

1) #dpkg --add-architecture i386
2) #apt-get update
3) #dpkg -i icaclient_13.1.0.285639_amd64.deb
  ... list of failed dependencies...
4) #dpkg -r icaclient
5) #apt-get install [all packages from (3)]
6) #dpkg -i icaclient_13.1.0.285639_amd64.deb

Step (1) and (2) only needed in Debian.

selfservice is hard to get to start from the start menu. And selfservice gets segmentation fault when OpenVPN is on (WTF?). So for now, I have given up on it.

npica.so is supposed to make the browser plugin work, but not much luck there (guess it is because I have a 64 bit browser). I deleted system-wide symbolic links to npica.so (do: find | grep npica.so in the root directory).

#rm /usr/lib/mozilla/plugins/npica.so
#rm /usr/local/lib/netscape/plugins/npica.so

Then I could tell the Citrix portal that I do have the Receiver even though the browser does not recognize it, and as I launch an application I have choose to run it with wfica.sh (the good old way).

keyboard settings can no longer be made in the GUI but you have to edit your ~/.ICAClient/wfclient.ini file. The following makes Swedish keyboard work for me:

KeyboardLayout = SWEDISH
KeyboardMappingFile = linux.kbd
KeyboardDescription = Automatic (User Profile)

The problem is, when you fix the file, you need to restart all Citrix-related processes for the new settings to apply. If you feel you got the settings right but no success, just restart your computer. I wasted too much time thinking I had killed all processes, and thinking my wfclient.ini-file was bad, when a simple restart fixed it.

Installing Ubuntu on Pentium M with forcepae

If trying to install Ubuntu (or Xubuntu, Lubuntu, Kubuntu) 14.04 (or 14.10) on a Pentium M computer, you may get the following error:

ERROR: PAE is disabled on this Pentium M

ERROR: PAE is disabled on this Pentium M

Just restart the computer and when you come to the install menu…


…hit F6 to get a menu of kernel parameters. Now, none of those parameters are what you want, so hit ESC. You should now be able to type forcepae at the end of the kernel command:

Now, hit Return, and startup/installation of Ubuntu should proceed just normally.

PAE is a CPU feature that has been available on most x86-CPUs since the Pentium Pro days. Since Ubuntu 12.10, it is a required feature. Some Pentium M CPUs have the PAE feature implemented, but the processor does not announce the feature properly. Since Ubuntu 14.04 the above forcepae option is available, to allow Linux to use PAE even if the CPU officially does not support it.

This affects mostly laptops from perhaps 2000-2005. These laptops are often good computers with 1400-2000MHz CPU and 512+ MB of RAM. As Windows XP is now officially unsupported by Microsoft owners of such harware might want to install an Ubuntu flavour on the computer instead.

There have been ways to make this work with Ubuntu 12.10-13.10. I suggest, abandon those versions and hacks completely, and make a fresh install of 14.04.

I have written before about Ubuntu on Pentium M without PAE.

Migrating from Windows XP
I would personally suggest Xubuntu or Lubuntu as a replacement for Windows XP: Both should be lightweight enough for your Pentium M computer, and both are easy to use with only a Windows background. Lubuntu is most Windows-like and the lightest of them. Xubuntu is a bit heavier (and nicer), and also resembles Mac OS X a bit.

I suggest the “Try Ubuntu without Installing” option. You will have an installera available inside Ubuntu anyways, and you can confirm that most things work properly before you wipe the computer.

Install Citrix Receiver 13 on Ubuntu 13.10

In this post I will explain how I installed Citrix Receiver (version 13) on Ubuntu 13.10 (Xubuntu x64 and Lubuntu x86 – but keep reading for other Ubuntu variants too).

The quick summary
Go to Citrix Receiver for Linux Download Page. Pick the generic tar.gz-version under 32-bit (yes, do this for 64-bit Ubuntu).


$ cd ~/Downloads

(nasty habit of not including a folder in the tar file:)
$ mkdir citrixtmp
$ cd citrixtmp
$ tar -xzf ../linuxx86-

(install, not as root)
$ ./setupwfc
   (choose 1=install
    answer yes to all questions
    use all defaults
    finally, 3=exit installer)

Now, if you are on 64-bit Ubuntu there are some 32-bit dependencies to take care of:

$ sudo apt-get install libgtk2.0-0:i386
$ sudo apt-get install libxml2:i386
$ sudo apt-get install libstdc++6:i386

If, on the other hand, you are on 32-bit Ubuntu, you can instead install these packages:

$ sudo apt-get install libwebkitgtk-1.0.0
$ sudo apt-get install libxerces-c3.1

Now, (re)start your browser, log in to your Citrix Portal, open an application. Your browser should suggest you open it with wfica.sh (located in ~/ICAClient/linuxx86). Do it – it should work!

You should now be able to use your Citrix applications in a productive way from your Ubuntu computer!

If you are on 32-bit Ubuntu, you should also be able to use the GUI Self Service application (I have not figured out how to fix the webkit dependencies for 64-bit ubuntu).

Feel free to read on for more comments and details.

What is Citrix Receiver and how do I use it

Citrix is a technology that allows an organization (your employer) to package applications (typically Windows applications) and make them available over the intranet or the internet. This way, you can run the applications on a computer without the need to install those application on the computer itself.

I have two ways to access my Citrix Applications.

The first way is via a web based Citrix Portal. I open my web browser, enter the URL of the portal and log in. Now, in the web browser, I see all my applications as icons, and as I click the applications they start in separate windows via Citrix Receiver.

The second way is to launch the Citrix Receiver Self Service application, give the address of the citrix servers and then authenticate. This method can enable “desktop integration” (your Citrix Applications are available via your normal Start Menu or whatever you call it). This Self Service application is new to Citrix v13, and replaced something else in v12.

The Web-browser way is easier to make work. There are unresolved dependency issues with the Self Service program and my solution above.

My #1 priority is to get a working solution at all.

Why not use the .deb packages
The deb-packages are obviously not built for Ubuntu 13.10. I believe they are built for Debian, but this must be confirmed.

The purpose of deb-packages is to automatically resolve all dependencies. But the dependencies are wrong for Ubuntu, and you will need to “force” installation of the deb-packages. In the future, this can leave you with conflicts and confustion.

So, I prefer the generic tar.gz-installation (which also works fine without sudo/being root).

Why not use the 64-bit packages
Well, first there is no generic 64-bit package, so I would end up resolving the dependency problems with the deb-package.

Also, the 64-bit deb-package actually contains 32-bit binaries. It is just the dependencies that are configured against the 32-bit compability libraries in Debian (instead of the standard 64-bit libraries).

So, nothing fun with 64-bit until Citrix actually compiles a real 64-bit binary with no 32-bit dependencies.

Other versions of Ubuntu
I believe what I have written applies not only to Xubuntu, but also Lubuntu, Kubuntu (may require more gtk-installation as it is QT based) and standard Ubuntu, and more. Please comment below if you experience something else.

Other versions of Linux
If you are on Debian or a Debian-derived distribution (like Crunchbang) I guess you should go with the deb-packages.

You really need the Self Service
Consider installing 32-bit Ubuntu on your 64-bit PC. Depending on what computer you have and what you do with it this may be a quite ok idea, or a very poor idea. I can admit I have been running 32-bit Ubuntu on a 64-bit PC for years, at work, specifically because Citrix worked better that way (even the old Citrix Reciever 12 had this issue, even if the Self Service looked different then).

What is the difference between Receiver 12 and 13
If you use Citrix via your web browser, you will not notice much difference (if any).

The Self Service is much different, visually, from the old Receiver. The old one looked like something for SUN Solaris and the 80s (motif-based). The new one looks like some kind of mobile app. I dont know which is worst. Many components are still the same.

If you currently run Citrix 12 and you are happy with it, I suggest you dont upgrade to 13.

Problems installing Citrix Receiver 12
If you want to install the old Citrix Reciever 12, have a look at my old post.

Your browser should allow you to download the ICA file (instead of launching it). Do it – it should be saved to ~/Downloads/lauch.ica. Now try to start it manually with wfica.sh:

$ ~/ICAClient/linuxx86/wfica.sh ~/Downloads/launch.ica

If you are missing dependencies they should show up here.

Final words
I consider this post “work in progress”. I’d like to

  • make Self Service work
  • confirm extra features (audio, drive mapping, etc) that might not work properly with my install above

But I hope it can be helpful even in this state. Feel free to comment!

Upgrade Lubuntu 13.04 to 13.10 on Eee 701

Lubuntu is the perfect distribution for your Eee 701. Now the time has come to upgrade to 13.10, and since I have had a few problems with that before I was a bit reluctant to upgrade my Eee 701, especially since it just has a 4GB SSD.

Since I installed 13.04 on the Eee, the available disk space has disappeared. It turns out, the kernel has been upgraded several times, but the old versions have not been discarded. You just need the latest version (the one you are running, check with uname -a). If you have more linux-images than needed, purge them. Do the same with linux-headers-packages.

$ dpkg -l | grep linux-image
$ uname -a
$ sudo apt-get purge linux-image-3.8.0-XX
$ dpkg -l | grep linux-headers
$ sudo apt-get purge linux-headers-3.8.0-XX

When it was time for upgrade, I had 1.6 GB (df -h) available on /. To play safe I formatted an SD card (1GB should be enough) and mounted it on /var/cache/apt (where all downloaded packages go during upgrade).

$ sudo apt-get clean
$ sudo mkfs.ext2 /dev/sdb1
$ mount /dev/sdb1 /var/cache/apt

I updated using the normal GUI upgrade program. During upgrade, the peak disk usage (just before cleaning) was less than 550MB on the SD card /var/cache/apt and my /-device was down to 700MB available (so my 1.6GB available in the first place should have been just enough).

The computer restarted nicely. The fact that the SD card was not immediately mounted on /var/cache/apt caused no problems. After upgrade I just had 1.1Gb available on / though. After again purging unused linux-image I was up at 1.2Gb. I wonder where the extra 400Mb went; I found Firefox, and I doubt it was installed in 13.04… removing it saves about 60Mb.

So, the conclusion is that upgrading Lubuntu from 13.04 to 13.10 on your Eee 701 should be just fine, if you have about 1.5Gb available space on /, and if you feel you have about 400MB to spare on the upgrade. A permanent SD card or mini-usb-memory that can host /home, /var, /tmp and/or /usr is of course nice.

Ubuntu 13.10 and GeForce 8200

Update 2015-04-24: Installing 15.04 from scratch worked perfectly.
Update 2014-11-02: Upgrading from 14.04 to 14.10 worked perfectly.
Update 2014-04-27: Upgrading from 13.10 to 14.04 worked perfectly.

As I have written before, Ubuntu has been a little tricky with a GeForce 8200. How about 13.10?

Well, the Live CD (which is a Live DVD, because it does not fit on a CD anymore) works just fine, using the Nouveau driver. That is good news.

I upgraded my 13.04 to 13.10 – upgrade was fine, but X (or whatever it is in 13.10) did not start. I had to do:

  $ sudo apt-get purge nvidia-173
  $ sudo apt-get install xserver-xorg-video-nouveau

That took me to the login window, but after that, black display. At this point I tried a few things, but decided to make a clean install of 13.10 instead.

The clean install went fine. After logging in the first time I logged out again, closed down lightdm and restored my home directory from backup (using rsync). To my surprise, after startig lightdm logging in did not work – just as after my upgrade. It turns out that after deleting ~/cache and ~/.config/xfce4 I could log in again! So, my clean reinstall was probably never needed… I will not know.

Finally, I can mention that to enable Ubuntu One in Xubuntu 13.10, the only thing I did was install ubuntu-one-control-panel-qt. Since I had restored my old home directory, both my Ubuntu One settings and my Ubuntu One files were already there, and it worked perfectly.

Connect to Office Communicator/Lync with Pidgin

This is a post I have wanted to write for a very long time 😀

My company has an Office Communciator 2010 setup, and for a long time I have tried to connect to it with my (X)Ubuntu computer. Pidgin has not worked, and installing Office Communicator 2010 in Wine has not worked either. But now… the stars were obviously aligned, I was lucky to try the right configuration, or some update to the Office Communicator Plugin for Pidgin fixed something. Error messages from Pidgin are usually not very detailed or helpful.

My configuration:

  1. You need the pidgin-sipe package (Xubuntu 13.04)
  2. Username: my email address
  3. Login: username\domain
  4. Advanced:
  5. Server: set this one
  6. Connection Type: TCP
  7. Authentication Scheme: NTML

Of course, your OCS Server might be configured in a different way. But perhaps this is a little helpful to someone. The way I obtained the server address was to run the netstat command on a windows computer before and after starting and stopping the Office Communicator 2010 client.