Disabling NumLock Key

For me, the NumLock and CapsLock keys are relics of the past, and are now the two most annoying keys on the standard keyboard. Every time I want to type in a number with more than say 3 digits, I find it easier to use the number pad, but I find i am forced to look down and check the num lock light status and/or attempt to type to see if num lock is activated, or otherwise risk having to re-type everything because numlock was off. Which surprising is most of the time for some reason, even though I ensure num-lock is activated on boot-up in the bios. Caps lock key is not as bad, I don’t seem to bump that on as much as the num-lock key but heck, when was the last time you actually wanted to write an entire sentence in ALL CAPS? I hope not recently. Anyway, there’s an easy way to disable these keys on Windows and Linux as follows:

Linux (Mint)
1. Open Keyboard Layout preferences
2. On the Layouts tab, press ‘Options’, then you can configure caps lock and numlock to behave more sensibly as shown in the following two screenshots:

linux-caps-lock

linux-num-lock

Windows 7
To do this on Windows 7:

Download NumLocker, install and configure via system tray icon.

I also tried SharpKeys but it didn’t work for me after rebooting.

Ctrl+Alt+F7 on Linux

Apparently Ctrl+Alt+Fx keys on linux switch console sessions and #7 happens to be the main windowing session. So pressing this sends all your screen black and pauses all apps with no instructions. Which is pretty frightening really. Luckily you can get back by pressing Ctrl+Alt+F8. Hopefully you have a second computer or tablet/phone handy to find this blog post if that happens 🙂 BTW I’m using Linux Mint, YMMV with other distros.

Git Bash Scripts

Using git as your source control, but have to use it on Windows? You may want to run some shell scripts like I did in git bash console (msysgit). I found that chmod does not actually work to add the executable bit to the file permission, but provided you add

#! /bin/bash

as the first line in your script file, you don’t even have to use chmod, Mingw32 automatically adds that bit in this case and you can execute immediately.

Source: msysgit on google groups

GVFS folder moved from ~/.gvfs

Network shares were previous mounted under a hidden folder in your home directory called gvfs. In recently distros of Ubuntu and those based on it, such as Mint, this directory has now moved to:

/run/user/[username]/gvfs/

and the name of the folder under there for each share is really complicated, like:

smb-share:domain=yourdomain.com,server=hostname,share=files,user=username

which is really not very nice. So you should make a symlink to it like this:

ln -s "/run/user/[username]/gfvs/smb-share:domain=yourdomain.com,server=hostname,share=files,user=username" ~/files_on_hostname

or something similar.

Missing cursor in SSVNC session on Linux

When I use SSVNC to open a session on a remote linux box, my mouse cursor often appears as a single pixel dot (no arrow) which is extremely difficult to see. I found that to solve it, the easiest thing to do is press F8 after your connection has started, then deselect ‘Cursor Shape’ from the SSVNC popup window that appears, then click the mouse once (within the client window) to get your cursor to switch to an arrow.

Wish I could make it do that by default…

VNC to Linux Mint Mate gives ‘Connection Refused’

After a fresh install of Linux Mint 15 with Mate, and enabling Desktop Sharing, I was getting ‘Connection Refused’ when trying to VNC from other machines. The same steps on Linux Mint 15 with Cinnamon on the same box showed VNC was working and hence the problem was caused by Mate. After some research it appears this is a known issue, but luckily there is an workaround until it is fixed properly – follow the steps here.

It seems like a lot of people are using an alternative VNC server like tightvnc which gives a different desktop to the console, but for some reason I just want to have one desktop, which is the console one, so if i’m working directly on the machine, I can walk away and work remotely picking up where I left off locally.

Mint continues to be my preferred distro, hopefully this issue is resolved in a future update.

HDD reported as full when it’s not – iNodes

Yes, this can happen, as I just found out – there is something called iNodes in the file-system (in my case ext4), with each file on the partition assigned to an iNode. And each partition has a fixed limit on the number of iNodes.

For example, my 50Gb root partition has 3.2 million iNodes, meaning it can have up to 3.2 million files. Sounds like a lot, but due to one particular program (GreyHole, subject of a future post), I ended up with ~ 3 million files in my /var/spool folder. Once my iNode counter reached max, no new file could be created, with programs reporting ‘Out of disk space’. But df showed me I had plenty of disk space. After I figured out it was iNodes I had run out of, rather than bytes, by using:

df -ih

I knew to look for something that was creating a large number of small files, and once I found the folder with ~3 million files, I just had to delete them. Unfortunately, you can’t just do rm * when there is that many files, I used this solution from stack overflow:

find . -name "*" -maxdepth 1 -print0 | xargs -0 rm

And all was well 🙂

Side node: If your root partition fills up, you may be wondering how to actually perform the since your system probably can’t boot. I’m running Fedora and found that I needed to press ‘e’ repeatedly during the boot sequence which would bring me to the GRUB bootloader. Esapce to cancel any changes, then select your kernel and press ‘e’ again to edit. Then add a space and the word ‘single’ (no quotes) to the end of the line and press Enter. Then press ‘b’ to boot that kernel into ‘single user’ mode, which is runlevel 1 (file systems mounted but not network). This will drop you at a command prompt with access to inspect and modify your file system to either free up space or iNodes, which ever you need to do.

“No Permissions” when listing android devices

When plugging in a new Android device to your computer for debugging, you might see this when executing adb devices:

List of devices attached
???????????? no permissions
13716365315 device

This shows that 2 devices are attached, but only 1 of the two are working / recognised. To solve this you can try killing and restarting the adb server. To do this on linux, change to your android-sdk-linux/platform-tools directory in a terminal shell, then type:

sudo su
adb kill-server
adb start-server

Now try adb devices again and hopefully you see your device ok.

High CPU & freeze with Linux Mint 13 / Cinnamon

Linux Mint is AWESOME. I am running Cinnamon as my desktop session, which is a fork of Gnome 3. It make Linux sooooo usable. I love it 😀 However there were two fairly serious issues that were present in its initial release:

  1. Random system freezes
  2. Your desktop session quite frequenty freezes (reported here), and you can only press Ctrl+Alt+Del to kill the session and return the login prompt. This force closes all apps, which means… Data Loss!! Fortunately, this issue has now been rectified , and by doing a system update (via the integrated update manager app), you’ll get the fix automatically. Do it!

  3. High CPU
  4. This is a currently unfixed issue, reported here. The current solution (that works for me) is to replace the contents of keyboard.gnome-settings-plugin, as described in comment #85 and also disable a num-lock related dconf setting, as described in comment #107. Do it!

With these two MAJOR issues out of the way, I have the best linux desktop experience of 2012. Thank you Linux Mint / Cinnamon team!

Mouse cursor missing using linux VNC viewer

Seems like the best vnc viewer on linux is ssvnc, much better than the basic tightvnc viewer, however both programs can have an issue where your remote mouse cursor is dipayed as a single pixel (dot) instead of an arrow making it extremely difficult to track. In my case I was VNC-ing from a Linux Mint 13 box to a Fedora 14 box. The solution using ssnvc was to press F8 after connecting, and unselect ‘Cursor Shape’ from the popup menu. However changing this option via the F8 menu does means you will have to do this each time you connect. If you have saved a connection profile, from the connection dialog you can click ‘Options…’, then ‘Advanced…’ then ‘Unix ssnvcviewer…’ and tick ‘Use X11 Cursor’. This solved the problem for me for future connection using that profile. You’ll have to do this for each connection profile unfortunately.

If you know of a better vnc viewer for linux that doesn’t have this issue, post a comment!