Nifty tidbits
Nifty tidbits and random thoughts on technology and anything else that catches my fancy
Category Archives: Linux
Yoohooo!! Successfully compiled Android from source
Finally!!!
So my last weekend project had been to compile Android ICS from source. Given that the size of the repo itself is in excess of 6Gigs, just getting it down itself took the better part of Friday night and Saturday night. When I got down to running make on it, it was Sunday afternoon.
Needless to say, things didn’t work too well. I’m running this on a 32 bit Ubuntu 10.04 Virtualbox with a piddly 1GB RAM. When make failed the first time, realized that swap was a measly 300Mb. First steps first, went on to increase memory to 2GB (that’s all I can spare) and increased swap to 2Gs.
Compilation next round started and that failed too – ran out of disk space – and this was Sunday night. Things kind of stayed there and finally this evening, resized the disk in virtualbox to 50Gigs. Again started the compilation and this time ran into linker errors when building webcore. One more round of troubleshooting involved deleting the previously built static library and then running make again. Surprisingly, this time make completed successfully – to the point where I wasn’t sure if it had succeeded or just failed silently on something else.
The next step was to run the emulator to see if it really would boot up. Over at source.android.com, they oversimplify it when they say that you just run emulator from the android root folder. That didn’t work for me – and this time it was because I hadn’t sourced the envSetup.sh file… this thread http://groups.google.com/group/android-platform/browse_thread/thread/91ff18e034acf951 helped in tracking that one down.
So finally, after all that trouble, I have my very own ICS build running!!!!
For now, its onward ahoy to setting up Eclipse and starting with a fix I’ve been mulling about for sometime now..
Signing off from cloud nine
R
Ubuntu, Console VIM – weird characters in insert mode
Now that I feel quite comfy with VIM, over the weekend I needed to edit a config file in my Ubuntu 10.10 Virtualbox machine quickly. Instead of GVim, I just opened the file in console VIM. As I hit i to get into insert mode, a bunch of weird character boxes were inserted. That was not good at all
– just when you think you’re comfortable with something if it does something totally weird. In any case, I was in too much of a hurry to bother and went about editing my file with gVim. Also, backspace was wonky (same weird characters) – so I felt better. For some reason that I fail to understand, why must Linux make proper backspace and delete handling such a pain! In any case, it’s something that I’ve dealt with enough times to know that there’ll be something on Google.
Later on, tried to see what all the fuss was about. Googling around, I found :help :fixdel and that seemed simple enough. Alas, when I tried it out, it didn’t fix the issue at all. Also, I seemed to be getting weird characters just pressing i to get into insert mode – and the VIM wiki page didn’t have anything about that. Neither did Google turn up anything that seemed related.
So today early morning, on a whim, read up a little on VIm terminal handling. I have the following in my .vimrc
set t_Co=256
Maybe it was the color escape code that was coming in – so checked out :echoe &term which returned xterm under gnome-console and builtin_gui under gvim. So I’ve put the following bit in my .vimrc and it seems to have fixed things nicely:
if &term == "xterm"
set term=xterm-256color
endif
Compiling VIM
Running ubuntu 10.10 here and ubuntu repos have only vim 7.2. I’m sure there’s a ppa out there that has 7.3, but thought
that compiling vim from source would be a good exercise – plus I get to compile it with the options that I’d like
rather than relying on someone’s build.
Here’s the options that I enabled:
CONF_OPT_PERL = --enable-perlinterp=dynamic
CONF_OPT_PYTHON = --enable-pythoninterp
CONF_OPT_RUBY = --enable-rubyinterp
CONF_OPT_GUI = --enable-gui=gtk2
CONF_OPT_FEAT = --with-features=huge
BINDIR = /usr/bin
DATADIR = /usr/share
Here’s hte other dependencies I had to install
sudo apt-get install libperl-dev ruby-dev python-dev libgtk2.0-dev
Once you have the deps installed, just run
make
sudo checkinstall
Blogging with Vim
So now I’m in Vim land and this is the first time I’ve gotten far enough to feel a bit comfy. Decided to dust off my blog and start at it again – what better to do it in than in VIM.
So – TA-DA – here’s the first post – courtsey VIM on ubuntu. However, as usual, it was rougher than it’s supposed to be. IN any case, I’ll forget how I got this far the next time so the next few posts will be around recording how to get VIM to post to WP.com blogs.
But before that – the first thing to to is to get the VimRepress plugin. Better if you have pathogen installed, in which case you can do
cd .vim
git submodule add https://github.com/raghur/VimRepress bundle/VimRepress.git
That’s my fork on Github of https://github.com/connermcd/VimRepress.git which fixes a few things:
- Makes VimRepress work properly through a proxy
- Changes the attachment filename to a ‘.odt’ since WordPress.com doesn’t allow a text file attachment.
I still dont have a clue if doing this will break the plugin – but nevertheless, basic case of posting to my blog works and at this stage that seems good enough for me.
PS as you can see from this post – I’ve not yet got a hang of markdown syntax
Dec 29th – PPS a couple of posts and one more tip for WordPress.com. WP.com does <br/> for hardbreaks in the markdown text. Obviously, this doesnt leave the post looking very good. I have the following in my .vimrc to get around this
augroup Markdown
autocmd FileType markdown set wrap
\ linebreak
augroup END
PPS
You will also need to have python markdown installed once you have VimRepress running.
easy_install markdown
A new tool for the toolbox!
Firstly – my VM setup:
I’m running Virtualbox with Xubuntu 9.10 on Win7 host – and its pretty. Its on a office standard issue Dell D531 – meaning they’re AMD Turion X2 TL-60 and 2GB of RAM.
Now the Turion’s supposed to have hw virtualization (AMD-V) however, the moment hw virtualization was enabled in virtualbox and I tried starting the vm, the machine would hard reboot!!!
After searching high and low, turns out that its an issue with Dell bioses and they dont have any updates. Here’s a page that tracks the issue. Imagine my happiness when a couple of days ago, found that dell had released an unofficial bios update (T12).Well, its gone in, and things are running swimmingly well – my VM now has 2 procs, is stable and I hardly feel I’m in a VM
. In fact, this post is coming from the VM – firefox with 12 tabs, a few terminals and emacs running on 600 MB of RAM.
Now let me come to the new tool I was talking about
I like to run the VM full screen – feels best that way. After trying out enough and more of multiple desktop softwares, have finally settled on VirtuaWin – beats the crap out of other tools, systray integration is great, has window rules and so on. Over the past couple of weeks, its come close to the ideal tool – does the job well and you hardly know its there
andLinux with Hardy Heron
andLinux is built on top of co-linux (co operative linux) and basically runs side by side with Windows. andLinux packages the whole thing better (coLinux bundled with Xming and a nice systray app allowing you to launch Linux apps right in windows).
Here’s details on getting off the ground – and the reason that I have this post is that though andLinux comes with an installer application, it still needs some amount of fiddling under the hood to make it work. This post is just to make sure I can go through the process again when the time comes
- When installing andlinux, choose the COFS option for making your hard drive visible in Linux
- Install with the command line option to launch andLinux (do not install it as a service just yet)
- Post installation, tweak andlinux’s network setup – set up a couple of virtual TAP adapter . You will have to tweak things both on the linux side and on the windows side. Basically, you create a 2 TAP adapters – one is a loopback and another for sharing your LAN connection. Your wireless network is shared via Slirp (doesnt need a TAP adapter setup).
- Keep in mind a gotcha – slirp wont allow you to ping – so if you have only slirp working, then try a wget http://www.google.com to check if you have network connectivity.
- Start the andlinux server (or if its already running) make sure that your c drive is shared – on the bash prompt you should be able to do ls /mnt/windows
- do a apt-get update to update your package list. run an update. As of this time, the only prebuilt images on andlinux.org is gutsy.
- do a apt-get install update-manager-core
- run do-release-upgrade – and you should see apt running and updating your system to hardy.
Compact Ubuntu
I’ve always hated the fact that on Ubuntu with the default themes, there’s far too much space wasted. The buttons are too tall, the treeview wastes too much space so that if you’re on eclipse or some other ide, you see a precious few items on the screen.
I’ve been trying to tweak it to no end – even looking to see if there are any ~/.gtkrc-2.0 tweaks. Found a few links such as this Making Eclipse look good on Linux – Max’s blog - however, didn’t really satisfy my need.
And so it stayed until today when I came across Clearlooks Compact Gnome Theme.
I love it – one more for my list of must-haves!
VPN into Windows VPN Server from Ubuntu *Hardy* Intrepid
** Update 2008/11/17 **: Networkmanager is broken in intrepid. To get it working had to install network manager from ppa as given here – http://www.ubuntu-forums.com/showpost.php?s=e0d93c09b8c340976477456593ac4cf7&p=6094870&postcount=5
Ok – this was easy – and while there’s some resources on google, I had to figure out a few itty bitty things for my work VPN setup.
install
- network-manager-pptp
- pptp-linux
Restart network manager with
killall nm-applet
sudo /etc/init.d/dbus restart
nm-applet --sm-disable &
Configure VPN settings
Click on the network manager applet and click on VPN connections
- Create a new VPN connection
- Ensure that you select Refuse CHAP in the authentication tab.
- In the routing tab, you can give netmasks that need to go through VPN – for my work network, I have: 10.10.5.0/24 172.16.106.0/24
That’s it. Now click on the Network applet, and connect to your VPN. In the authentication dialog, use <domain>\username and your windows domain password.
Hardy heron – first impressions
He he
– finally got Ubuntu Hardy heron beta on my home and work laptop. first impressions below:
1. Wubi install from within windows is easy and works great. If after setting up so many boxes, I can go on and on about it, I’m sure that its great help for anyone who’s on Windoze. I mean, the barrier to entry has never gone down so much.
2. I guess once you’ve installed via Wubi and configured your system to your liking, you can uninstall and take an image that you finall install to a dedicated partition – isn’t that just awesome.
3. Comes installed with Firefox 3b4 -which is awesome. Given that FF crashes badly on yahoo, this might be a bummer for many people. Should probably have some first time customization that will let you install Opera.
4. Installation is super fast – took about 10 mins for wubi to install, reboot once, finish installation and reboot again. Grub default to Last selected would probably be a better idea.
The not so good
1. Wifi doesnt work out of the box – didn’t on my Dell Inspiron 1501 or the Dell Latitude D620. Its the ye olde broadcom problem. This is really the BIGGEST turn off. Hope it will get fixed by the time the final release is out. Meanwhile, had to jump through hoops getting ndiswrapper in. I didn’t go the broadcom fwcutter way since that only allows a 802.11b connection from what I read. I’m still not sure what fixed the issue – irrespective, I had to update the system and then things started working like a charm.
2. Compiz configuration isnt installed by default. If this is your first time on Ubuntu and you’ve come this way to see the awesome 3D desktop, then this is a bummer. Finding out what you need to do is a pain too.
I think that’s all there is to it. Its great once wifi starts working normally.
Gnuplot, dstat – easy graphing on Linux
Recently, started fiddling around with how to monitor and graph performance data on linux boxes. Other than the usual tools like top and vmstat, which are either interactive (top) or too textual to do anything much.
First off, vmstat, doesnt lend itself well to graphing without additional scripts to lay out the data so tools like gnuplot can be used. Secondly, and more seriously, it doesn’t include a timestamp in the output.
Looking around a bit found that dstat seems to be a good replacement to vmstat (and iostat) – and the generated data is consumable with gnuplot.
Here’s a quick example of generating graphs for CPU user, system and idle times
dstat -tc 5 500 > dstat.raw
now fire up gnuplot and go ahead and plot it
gnuplot> set xdata time gnuplot> set timefmt "%s" gnuplot> set format x "%M:%S" gnuplot> plot "dstat.raw" using 1:2 title "User" with lines, "dstat.raw" using 1:3 title "Sys" with lines, "dstat.raw" using 1:4 title "Idle" using lines
To make gnuplot generat an output file, you need
gnuplot> set term png
gnuplot> set output “dstat.png”
gnuplot> replot
And you’re done. here’s the graph generated on my machine. There’s loads more that you can do – and admittedly, you can do everything by dumping your file to excel. However, that doesn’t lend itself well to a completely automated process. When you’re doing performance testing and such like, you will likely repeat this enough number of times. Not having to do it manually helps big time!

