Tag Archives: linux

mosh : The answer to ssh annoyances

I got to know about mosh recently from a tweet by gaveen. Mosh is a replacement to the good old ssh command. It solves some of ssh’s biggest annoyances.

mosh handles connections internally

When you’ve ssh’ed to a server and your internet suddenly drops, that ssh connection gets broken. With mosh, you wouldn’t have to worry about this because it will silently connect you back to the server once the internet is back and you won’t even know. So even if you sleep the computer, when you wake it up again the connection would be back on just as you left. When you open up your laptop in a meeting or a conference, that connection will still be there. I haven’t closed one mosh connection to the Best At LK server in more than a month!

mosh echoes keypresses instantly

Another headache with working on ssh connections is the lag while typing. If you type in something it will take some moments to reflect, which can be really annoying. Mosh’s work around for this is giving an instant response to typing. 90% of the time, what the server would do is just echo the key you typed. So why not do that without waiting for a response from the server? Mosh underlines those keystrokes till the response comes, so you would know. Rest of the time when the keypress does something else, mosh would adjust accordingly after the response comes.

Getting started

If you use a debian-based distro (like Crunchbang or Ubuntu), you can install mosh with apt-get.

sudo apt-get install mosh

For other distros and operating systems, the homepage has installation instructions.

If you’re feeling rather adventurous, or you’re the type that needs to stay in the edge, you can clone the mosh git repo and build it. The build instructions are in the home page as well.

Note that you have to install mosh in your server as well. Worry not, it doesn’t run as a daemon. It starts up only when you connect to the server.

Now ssh to the server using mosh, instead of ssh.

mosh user@111.222.333.444

Mosh respects ~/.ssh/config as well! So you can continue using your favorite aliases.


Mosh needs to open a UDP connection. In an ordinary vps this wouldn’t be a problem, but if it’s an important production server the server admin might not be willing to open up a UDP port. If you don’t have any contact with the admin, you might be out of luck.

In Amazon EC2 instances, the UDP ports are usually closed at the beginning. To open them up, add a ‘Custom UDP Rule’ in the Security Group settings in EC2 dashboard. In the rule, set the range of ports as 60000-61000.

Quantal Quetzal – the all new Ubuntu 12.10

It’s been 5 days since Ubuntu 12.10 (aka Quental Quetzal) was released and I downloaded the ISO on 19th, but got the time to install only today. Finished the install just 30 minutes back from the time I started writing this. By the way, the following ain’t gonna be a review, just some stuff I did after installing and the problems I had. If you want a review let me google that for you.

Ubuntu no longer fits in a CD. It’s got bigger (that’s what she said). The ISO is 800 MB now, so if you’re not installing online, you need to create a DVD or a USB.

I had previously fucked up the whole 12.04 install by messing up with xorg.conf, compiz and even wine, so formatted /home as well. A fresh install, literally. It went without a hitch.

Was expecting everything to work smoothly after the install, but some did not. Nvidia drivers do not come by default (which is normal) but they did not appear under Additional Drivers as well. I tried sudo apt-get install nvidia-current and restarted, but the screens were messed up. Unity launcher was hidden and the screen resolution was fixed. A bit of googling showed that this was a known bug in the kernel. The following workaround solved the problem:

sudo apt-get install linux-headers-3.5.0-17-generic
sudo apt-get remove nvidia*
sudo apt-get install nvidia-current

The dual monitor setup got detected and the display was set to TwinView automatically, so had no need to do them manually as I’ve mentioned previously in the other blog. Anyway when you move the mouse from one monitor to another, there’s this deceleration which is a headache. This could be disabled by going to Displays and turning off Sticky Edges.

I keep the Unity launcher on both desktops coz it’s more convenient that way

Installed ubuntu-restricted-extras next. Nothing special there.

Then I downloaded the Google Chrome deb and tried to install, but this gave ‘The package is of bad quality’ error. As it turns out, this is also a known bug and continuing with ‘Ignore and install’ is the way to go.

The next step was to completely remove Ubuntu One. Coz that’s how we roll. The command is:

sudo apt-get purge ubuntuone*

In Quental, there’s this new Online Accounts section, in which you can log into most services like Twitter, Google and Facebook. After logging in I noticed that the Messaging icon was missing from the top panel. This could be turned on by going to Broadcast Preferences and checking Start service at login.

Some of the things I’m gonna do next are installing the blinking messaging menu icon and installing some cool stuff like Everpad, fogger, pinta, clementine, rubygems, ttytter and apvlv. And ccsm of course (just noticed it’s missing). Then enable wobbly windows. And then edit /etc/fstab to my liking perhaps. I may post some tips on new features, workarounds, etc in Accidents Happen.

Since it’s been less than hour, it’s too soon to tell how good Quental is compared with Precise (12.04). Anyway I’m disappointed by the nvidia issue. Fuck you nvidia!

LXDE on Ubuntu

The laptop won’t let me dual boot. That’s coz the lappy isn’t actually mine, it’s the office laptop. So I was running Ubuntu in Virtualbox all this time. Ubuntu 9.10  (I know!). But then I switched to 12.04 – Precise Pangolin. Unity is pretty cool now compared to what it was back then in 11.04. However it’s a no-no for running in a VBox. Switched to gnome classic sans effects which improved the performance drastically.

I had used LXDE for a few months about an year back in my netbook. So I thought, why not give it a go again? Without removing the existing gnome packages, I typed,

sudo apt-get install lxde-core

into the terminal. It gave me the LXDE desktop, but that’s as far as it went. Just the desktop. No Leafpad, no PCMan, no LXTerminal, nothing. Hey, that isn’t LXDE! What’s LXDE without Leafpad or PCMan? So I went ahead and typed,

sudo apt-get install lxde

and, voila, here I have what I wanted. (Lesson: don’t install lxde-core, just use lxde and it gives you everything)

LXDE desktop on Ubuntu
From left to right, Leafpad, PCMan file browser and LXTerminal (click to enlarge)

Okay, the interface isn’t as polished as that of gnome, that’s a given. It’s only supposed to be lighter and faster. But unfortunately it felt like the system isn’t much comfortable having LXDE around. It felt like the kernel’s carrying a bulk. Not as smooth as the classic gnome experience. I know this isn’t the way it’s supposed to happen, so I’d try this for two or three days and switch back to gnome. Good thing I didn’t remove the gnome packages before installing.

Oh wait, perhaps it’s a good time to try out XFCE!

Unity 2D

It was a bumpy ride. Unity, Gnome 2, LXDE and KDE. I tried almost all the popular environments (except XFCE, of which I had heard a lot of bad things).

KDE is perhaps the most attractive of these, but, sadly, it’s too heavy for a netbook. LXDE is light-weight indeed, but I had trouble running several applications with it. For example I couldn’t get gPodder to work no matter how hard I tried, and ibus was buggy.

I was going to test run Gnome 3 but @kau_mad said otherwise, so gave up. Which left me with two options: Unity and Gnome 2.

Unity was originally intended for netbooks. (This was the default environment in Ubuntu Netbook Remix, remember?) Stuff like global menu bars were made with small screens in mind. Unity works, but I found it a bit too sluggish. The solution? Unity-2D.

Unity-2D is a clone of Unity intended for low power computers like netbooks. While Unity has been written with GTK, Unity-2D uses the QT toolkit. It doesn’t require GPU acceleration , something which netbooks and other low-end machines can’t provide.

To install Unity-2D in Ubuntu 11.04, all you have to do is to install the package “unity-2d-default-settings” from the Software Center. Log out and choose Unity-2D as the desktop environment. The interface is quite similar to Unity, but it may not be as slick as Unity is. For example you won’t get those lovely fading effects. However it’s able to provide you with the maximum possible Unity experience.


The Kewl desktop environment – KDE

So I wanted to get some first hand experience on KDE. To install KDE in Ubuntu what you need is to install the kde-desktop (or  kde-netbook in my case) package from the repos. Once installed, log out and choose KDE before logging in.

KDE is the sex! There’s absolutely nothing so beautiful like it! Due to the restrictions in my netbook most of the effects won’t work for me, but still it looks marvelous. Sad to find that it’s being underrated in the FOSS world.

KDE desktop in my netbook

KDE’s however not so sweet with resources. The environment is heavy, perhaps even heavier than gnome. But I can’t make up my mind to leave it and go back to LXDE. The performance loss is quite worth the sacrifice, if you ask me.

Moving to Lubuntu

The restrictions in my netbook made me convert my Ubuntu install into a Lubuntu. For this, you don’t need to manually download Lubuntu and install. All you need is to install Ubuntu first and run the command in this Psychocats page titled ‘Remove Ubuntu’.

And, voila, you get a pure LXDE desktop!lubuntu desktop

It may not look as pleasing as classic Gnome or Unity, but it’s quite usable and has a memory footprint as low as 100MB. PCManFM replaces Nautilus as the file manager. The window manager becomes Openbox.

The main problem I had to deal with was connecting to internet using my USB modem. The solution was to install the script they give in www.sakis3g.org. It automatically recognized my Dialog broadband connection. I

There is no Software Center in Lubuntu, only the Synaptic Package Manager. If you want you can search and install software-center from the Synaptic Manager.

 WARNING: When you install lubuntu-desktop with the above method, most of the apps that come bundled with Ubuntu are uninstalled. eg: LibreOffice is completely removed and AbiWord is installed instead.

Linux to Windows transition

So I had to install Xilinx 13.1 for our final year project and only the Windows version was available. Which means I had to install Windows 7 in the laptop alongside Ubuntu.

Oh, the woes in Windows. As I’ve mentioned in a previous post, you get totally bewildered and frustrated in this proprietary operating system.

First, there’s no Compiz. The desktop and windows look pretty ugly. Thanks  to aero the ugliness is reduced a bit.

Then there are no multiple workspaces. Can you just imagine? Having to work in a single desktop?! But thankfully there’s a solution available, albeit a less-than-perfect answer to the problem. You can install this little piece of software and it will give you something similar to multiple desktops. Not as good or native as in linux anyway.

And the next problem was the lack of double-finger scrolling. Again a small software comes to the rescue. Still it’s less-than-perfect.

Viruses? Yes, you have to be wary of those creatures in this less secure operating system. Installed Microsoft Security Essentials just in case.

I hold no grudge against Windows. I’ve used it since the 95 version and I won’t hesitate to say it’s a good operating system. It’s just that you don’t get the good feel or ease you get in linux. Hope they learn from peers like linux and OS X and improve the OS in the upcoming versions at least.

Fixing the Windows MBR using a Ubuntu Live CD or USB

This friend of mine had installed Windows and Fedora side by side on his laptop and wanted to remove the Fedora installation. Removing Fedora is quite easy. All you have to do is to go to Disk Management from Windows (Run -> diskmgmt.msc), find the Fedora partitions, delete them and format as new drives.
However, this also removes the MBR of the machine. To restore the MBR, the accepted method is to use a Windows CD. We didn’t have that luxury. Fortunately we had a Ubuntu Live USB in hand.

The method to fix the MBR is:
1. Boot the machine using the Live USB/CD.
2. Install lilo

sudo apt-get install lilo

3. Fix the MBR using lilo using the command:

sudo lilo -M /dev/sda mbr

Works like a charm!

Playing MIDI files in Ubuntu

I was taken by surprise when I found out that I could not play MIDI audio in my Ubuntu box. Apparently it has to do with your sound card. But still..!

One of the simplest methods to play a midi file in Ubuntu is to install timidity. Yeah, lovely name that. 😀

sudo apt-get install timidity timidity-interfaces-extra

You can play a midi file directly from the command timidity followed by the file name. For example,

timidity awesometune.mid

Or, if you want a GUI, you can simply type

timidity -ig

and an old-fashioned window will pop up.

Happy listening! 😀

Installing SCID in Ubuntu

SCID is a free, cross-platform chess database application. Can be used to edit PGN files and do loads of other stuff.

Unfortunately there is no PPA or deb files available to install the app in Ubuntu, so you have to get the tarball available at the site and install manually. If you try to configure the tarball you’ll get an error saying that it cannot find Tcl and Tk in the system, even though you have Tcl/Tk installed. The reason is you need to have the developer channels of Tcl/Tk installed for SCID.

Here’s how to install SCID in Ubuntu:

1. Install Tcl/Tk developer channels using the command:

sudo apt-get install tcl8.5-dev tk8.5-dev

(8.5 is the latest release)

2. Download the SCID tarball and extract in a temporary location

3. Go to the extracted location in a terminal and enter the following commands:

./configure BINDIR=/usr/local/bin

sudo make install

To run SCID, press Alt+F2, type scid and press enter.