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.

Android header preferences on small screen / phone

Short version: If your android preference headers are displaying on a small screen, but not opening the associated preference fragment when clicked, make sure you don’t have launchMode attribute set on your preferences activity in your AndroidManifest.xml file.

Long version: The concept of two-pane preferences of course applies to large screen (tablet) devices, where the left hand-side is a list of ‘headers’ and the right hand side is an associated preference fragment. Google’s built-in template for ‘SettingsActivity’ shows how this can be implemented such that when the activity is displayed on a small screen (e.g. phone) the preference headers are not displayed and instead all preferences are shown on the one screen, separated by categories. To do this they force you to use a deprecated API, which is pretty ugly. Additionally, this only makes sense when you don’t have many preferences. Once you have a large number of preferences, it may make sense to use headers on a small screen, which was the case for me, however it wasn’t working. The headers were displaying fine, but whenever I tapped one, nothing would happen, the onCreate() method of the associated fragment would not be called. By trial and error I finally found that I had

android:launchMode=”singleTask”

in my manifest file. As soon as I removed that attribute, preference headers worked on a small screen fine.

“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.

No mobile data access on Android phones

I just got a bueat new phone, the HTC Desire X, but one day two I suddenly had no internet access when on a mobile network (wifi was fine). The ‘Mobile Network’ setting was switch ON and toggling this switch didn’t do anything. I learned you have to check your APN (Access Point Name) settings by going into the Mobile network settings, then ‘Access Point Names’ and I saw that there was nothing listed there! Hit ‘Menu’ key and there’s an option to ‘Reset to defaults’. After I did this, my network operator’s settings appeared (Virgin Mobile Australia) and all was well!

VMWare Networking Conflict

If you have both VMWare and VirtualBox installed, you may find that VMWare virtual machines can’t get an IP address. If you get a 169 address it means a DHCP server could not be found, which basically is game over for networking. Check the VM properties (after shutting down the VM), go to the networking option and choose “Configure Adapters”. By default all adapters are selected, but you should disabled all except your real adapter (in my case, RealTek).

vm-networking-issue

BSODs with Crucial M4 SSD

If you are getting frequent random blue screens with error KERNEL_DATA_INPAGE_ERROR 0x7A and you have a Crucial M4 SSD, you might want to update the firmware for the drive. Crucial have acknowledged the issue and released a firmware update which fixes it. After applying the update, my machine has been running for 6 or 7 hours whereas previously it could not get past 1 hour before crashing… so far so good. Get the update from Crucial here.

Find was stopped in progress in VS

There has been a bug in Visual Studio since the 90s where you are searching in files, but the find operation stops very quickly after starting (and hence gives no results). The output window shows ‘Find was stopped in progress’. This is caused by pressing Ctrl+ScrollLock (usually done inadvertently when Ctrl+Break). The solution is to press Ctrl+ScrollLock again, then you should be able to ‘Find in Files’ again.

HDDs you shouldn’t buy

My server had 7x2Tb WD Green (EARS/EARX) HDDs. I selected them because they were cheap and supposedly power saving. However this was a mistake, as I have found out the hard way, now that 4+ have died in the past year. Apparently these drives have a firmware ‘feature’ that parks the heads on the drives after 8 seconds of inactivity. EIGHT SECONDS. Which means these drives are certainly NOT suited to a NAS / storage pool setup or OS partition since wear on the disk will be large. They are really only useful as backup drives that don’t get used much. Supposedly you can use wdidle3.exe from Western Digital to increase or disable this 8 second timeout, but I haven’t tried it yet. Instead I’ve been replacing failing drives with Hitachi Deskstar drives, which from my recent research, may last 3+ years as opposed to 1.5 years max lifespan for WD green drives. I also bought 3x2Tb Seagate Barracuda HDDs as backup drives, and 1 of those 3 failed within the first year.

So, here’s my advice: If you want your drive to last more than 1.5 years before failing, don’t buy Seagate Barracuda or WD green drives.

UPDATE: I just noticed that the WD-EAR drives are running hotter than Hitachi, a good indicator for Hitachi so far:

wd-hot