Tag Archives: ubuntu

>Windows 7 / Emacs / Ubuntu



The Dell is back in Windows land, with Windows 7 installed. I’m using it with the setup I detailed here and everything works as expected.

 A word about Emacs. I spent quite a bit of time over the last couple of months sorting out the mish mash of different emacs configs I had running. Now there is one config which handles everything I want it to. Whereas before I used to keep the configs in svn, this time I am using Dropbox to share the configs between Ubuntu, Windows and Mac and the .emacs (currently 211 lines long) works perfectly between all three. So when I add a keybinding or piece of emacs code into one they appear on all four machines. Losing version control doesn’t bother me so much, I rarely want to look back through versions – having everything applied immediately is much more useful.

The Ubuntu VM’s I am using on the Windows machine have Dropbox linked through the vmware shared folders. With my current setup I can create a fully working Ubuntu 8.04 environment with all my emacs customisations in less than five minutes.

If you expand that picture you’ll see it’s using ECB mode – something which I used for a few years but stopped using some time ago when I had some issues with it. Starting from the top left and going down and then across we have.

1. ECB Directories window

2. ECB Current directory window

3. ECB Methods and variables browser (showing items for the DateTime.py file)

4. ECB History Window (files recently visited)

5. DateTime.py (something I am actually editing!). Although it’s not switched on here I have flymode on which is linked to various utilities that can display PEP8 infringements or syntax errors inline.

6. DIRED view of a directory I am working in.

7. irc (#django channel on freenode)

8. Editing the hosts file. This is actually in sudo mode, using tramp. Means I can go sudo and edit a file without starting another terminal up.

The Dell’s 1920×1080 resolution makes this worthwhile. I can reboot this machine into Mandriva and have the same development environment straight away. Or switch to the Mac, Ubuntu desktop or even Ubuntu Netbook and have it all working exactly the same. Very nice.

>pg_top on Ubuntu Hardy – Postgres top utility

>This morning I got pgtop working but had some questions which I forwarded to the author Cosimo Streppone. In his very polite reply he pointed out I should really be using pg_top (note the hyphen) so I then set to getting that to work on Ubuntu Hardy Heron.

Download the latest release from the site above (I downloaded pg_top-3.6.2.tar.gz) and then

tar -zxpvf pg_top-3.6.2.tar.gz
cd pg_top-3.6.2

It’s very possible you might get some errors during this. The three I had were

configure: error: no acceptable C compiler found in $PATH

You don’t have the basic build tools installed. Do.

sudo apt-get install build-essential

Also during config

configure: error: pg_config not found

Get the postgres dev libs – do

sudo apt-get install libpq-dev

During make I got a heap of errors – starting with

gcc  -Wall -g -L/usr/lib -lpq  -o pg_top color.o commands.o display.o getopt.o screen.o sprompt.o pg.o pg_top.o username.o utils.o version.o m_linux.o -ldl -lm 
display.o: In function `display_move':
/home/icottee/pg_top-3.6.2/display.c:257: undefined reference to `tgoto'
/home/icottee/pg_top-3.6.2/display.c:257: undefined reference to `tputs'
display.o: In function `display_write':
/home/icottee/pg_top-3.6.2/display.c:387: undefined reference to `tgoto'
/home/icottee/pg_top-3.6.2/display.c:387: undefined reference to `tputs'

The solution I found was to

sudo apt-get install libncurses5-dev

Then rerun config AGAIN and do a make.

Now I could

pg_top --help

And all was good. Read the web page for info about what you can do with it. But in short you can see all running postgres processes, see what they are doing, examine their query plan, what locks they have and examine table and index statistics of the relevant tables. Full info and screenshots can be found here.

>Old rails, rake – running on Hardy

>From my own benefit … to help with installing and maintaining our old ruby apps, do this

sudo apt-get install rails rubygems irb ruby
sudo gem install -y rails --version=1.2.3
sudo gem install -y rake --version=0.7.3
sudo gem install -y postgres-pr

The problem with this is that it’s not sitting in your path and Ubuntu will keep asking you to install rails via apt. So

sudo ln -s /var/lib/gems/1.8/bin/rails /usr/local/bin/rails
sudo ln -s /var/lib/gems/1.8/bin/rake /usr/local/bin/rake

>Welcome from the MacBook Pro

>It arrived a day late and is looking pretty cool so far.

So I’m typing this with MarsEdit first of all to see how I get on what that.

What have I noticed about the new machine. Some random comments made in no particular order. Here’s the low down on the specs of the Machine.

Model Name: MacBook Pro
Model Identifier: MacBookPro4,1

Processor Name: Intel Core 2 Duo

Processor Speed: 2.4 GHz

Number Of Processors: 1

Total Number Of Cores: 2

L2 Cache: 3 MB

Memory: 4 GB

Bus Speed: 800 MHz

It has a 250GB hard drive, 5400 RPM

I’ve been through a number of laptops in the last couple of years. I had the MacBook which replaced my old iBook and died a horrible death. Which was replaced by a Sony Vaio VGN-FE41Z. And I’ve also been running the Dell Inspiron 630m which I think become my second favorite laptop ever, just behind the 12″ iBook before it too popped it’s clogs. So maybe over three years I’ve had five major laptops – running a mixture of OS X, Linux and Windows (XP and Vista).

I had a bit of a epiphany regarding laptops a short time ago. Because even though I was loving Hardy Heron on the Dell I realised that linux laptop compatibility is a lottery – unless you get one with Ubuntu preinstalled which limits somewhat your choice of machines, trying to get all your laptop features running can become something of a fulltime job. Even on the Dell resume/suspend didn’t work (although it did under Gutsy 95% of the time – I suspect I tweaked something in the past which I’ve since forgotten). So upgrades are exciting times with new treats and old ones sometimes taken from you. The Dell 630m was great but even it was showing it’s age. I was plotting what to replace it with and was thinking of something like my last week’s Vista setup but on a much nicer spec machine. You have all the drivers provided, suspend works, you can buy some crappy bargain bit of hardware not wondering if you’ll ever be able to use it. So if the “X Server, VMWare” trick works and you can use Ubuntu easily within a windows environment it makes sense to go the Windows route.

Because the only other option is the Apple route and I swore to the gods I wouldn’t give them my money again until they sorted out their production process … i.e. I won’t buy a MacBook until they start making them reliable and resilient. We’ve bought so many of them and had so many problems and the Apple Care they provided wasn’t much use either because you have to sit there arguing that, no, you didn’t crack the front casing of it and this is a problem that thousands of others have suffered from. And they still don’t believe you. And why don’t we just buy Dell’s instead because you can get cheap accidental damage cover with that. And actually Vista is not that ugly. It’s quite nice. But it’s slow. And not very reliable. And 3GB of RAM is about your max. Oh and Steve Balmer.

Apple are evil. Microsoft are evil. Ubuntu are not evil (or at least, if they are, they’re keeping it quiet so we don’t feel bad about using an evil os). But we have to use evil hardware with the good software and maybe something won’t work properly. Hmmm … Apple.

Am I rambling?

Anyway, on the spur of a moment decision I went back to Apple. I bought a MacBook Pro because I was not aware of them suffering the same monumental build quality issues as the MacBook. It’s a Unix based laptop. It has a great screen and a great keyboard. It has good battery life. It’s fast. I was in Japan when the other laptop died and I could easily get a US keyboard and a worldwide warranty. I love OS X.

I’ll blog a bit shortly when I have my same Ubuntu VMWare setup up and running. I’ll blog a little bit later, maybe in a couple of months, when I’ve worked out whether this is really changing my life. If it can and I can reduce my laptops to one again, I’ll be a happy man.

>Ubuntu / Vista / VMware / Xming

OK, I’ve been using this setup for over a week. I’m a developer /sys admin who needs a Linux environment and who is stuck with just a Vista laptop. So here’s my solution. Certainly not a perfect solution but a lot better than some I’ve used in the past.

The idea is that we run Ubuntu (or any Linux disto) within a VMware machine (I assume the free VMware player would work for this, but i’m using VMware workstation). We then install the free X server Xming and use that to start X applications from the Ubuntu machine. In reality I use this for two main reasons – running Emacs with a Linux backend and controlling ssh tunnels. I can do both of these things natively in Windows or using Cygwin but both are painful in real life. And if all your live deployments have Ubuntu at the backend, you really want the same for your development environment.

First thing you need to do is install Linux on your Vmware machine. I use the Hardy Heron server install as it’s a lot lighter than the desktop and we don’t want to run a linux desktop anyway. Yes, a desktop inside a desktop could be construed as cool for the first day or so if you have never done it before but it soon becomes a pain in the arse. There are some other versions of Ubuntu which are even more stripped down but we use Ubuntu Server for our normal server installs so I went with that.

My Vista laptop has 2GB of RAM and is dual core. In the VM I assign both processors and 512MB of memory. I also preallocated the disk to try and eek some more performance out of it (60GB in this case). See my comments later on performance. For networking I used Host. If you are moving your laptop around a lot this may be a small pain as you’ll need to keep an eye on the ip address your VM is given each time. Probably better solutions for this.

Make sure you install the ssh server. On Gutsy and Hardy it’s an option you get at the end of the install process. Otherwise “apt-get install openssh-server”.

On Hardy Heron default server install, once it’s up and running, the important setting to change is


add the entry

   X11UserLocalhost yes

and then do

   apt-get install xauth

Now install Xming and Putty. We’ll use Putty to ssh into VMware and launch our apps. The settings you need in Putty are wonderfully described here along with other useful troubleshooting tips which may be of use if you are not going the Ubuntu route. On Ubuntu I just needed to do what I’ve described above.

Start up Xming. Now, using Putty, log into your VM. The first time you log in, if you’ve done what I’ve outlined, you’ll see a message saying words to the effect that .Xauthority is being created. Now launch an X app. You might want to “apt-get install x11-apps” and launch xclock as a test. Revel in it’s minimalistic glory. If you don’t see xclock appear then check if Xming is trying to tell you something – check if the Xming window is flashing at the bottom of the screen for example.

If that doesn’t work, check out the Xming web site or post a question here.

Now you can install anything you want to run. In practice, for me, that’s meant

  • emacs
  • Firefox
  • gSTM

I have Firefox installed, as I sometimes need to browse sites through the tunnels I create with gSTM. gSTM is a Gnome app. Here it is running, on my Vista desktop. On the right hand screen you can see the obligatory x apps running which are of little use at all. The putty session on the right screen lower is running top on the VM. The upper putty session is connected to a remote system behind a remote system via the tunnel manager.

It’s not without it’s problems. The screen shot at the start of this post shows me running Emacs and running some unit tests within Emacs which are doing a lot of python and postgres processing. Check out the cpu and RAM usage in the sidebar widget at the right. At that stage the machine was somewhat sluggish although useable. Certainly after a day of heavy development I found a good reboot of the whole setup (from Vista downwards) would help. Having more RAM in the laptop would also benefit although having a 3GB limit with 32bit Vista sucks. In short, you’re using a VM and you’ll be taking a slice (maybe I should say ‘a chunk’) off your performance compared to just running Linux directly.

Two other issues. Not major but to be kept in mind. I find that over the course of a day I end up with a lot of Putty sessions open. I might be able to manage these better if I spent some time looking at it – and it doesn’t help that I launch my X apps from Putty as well. Xming goes with a launcher program which I haven’t tried yet. That might be useful.

Final issue is copying and pasting. Sometimes this seems hit and miss but frankly that’s not a lot different from what I experience in native Ubuntu. Ctrl-Insert and Shift-Insert sometimes had to be done a few times before something would wake up to what I was doing. This is something I could improve if I had the time (so you can see it wasn’t that big a deal).

I’ve been laughed at once already today for saying this, but I’ll say it again. I like the look of Vista and I’ve grown really attached to that sidebar (can somebody recommend a Mac solution to give me similar functionality). But Ubuntu is damn pretty as well. More importantly, if you’re running Vista natively then you don’t have to sit there for HOURS on end loading up drivers to get your audio working with your webcam and – oh – that makes the wireless drop out. Hang on, I’ll recompile the wireless module – that’s better. Oh, the webcam’s gone again – and where did the memory card support go to? And don’t even BEGIN to talk to me about hibernation. God that drives me mad. Dual boot is a pain in the arse as well. I just want to sit in one environment working.

So if I need native Vista to get the most out of my laptop my two current options are Cygwin and this. Cygwin is great if all the stuff you need is available in it. It sucks like a hoover if you start having to compile stuff natively under cygwin. Does for me anyway.

Having the VM as your development environment also makes it a lot easier to move it around to new machines. We’ll see how that pans out later today when the new MacBook Pro is due to arrive.

This time last week I was wondering whether I could make this environment my full time environment. I nearly can. In the end the problems are not so much with the solution as with the laptop. It needs a bit more power and it needs more RAM (and I can only go up one more GB easily). Also (this is a Sony Vaio VGN-FE41Z) the fan is bloody loud. I usually sleep with the laptop next to my head. The noise is getting annoying.

So the MacBook Pro is arriving today. I’ll gain more power, illuminated keyboard, Mac loveliness and maybe (maybe) a quieter fan. We’ll see. But I’m intending on trying a similar setup on the Mac as well. I’ll let you know how I get on. If anybody else is running a similar setup as this on their Windows system let me know how I can improve performance.

>Cyrus IMAP on Hardy Heron

>So you’ve just installed cyrus imap on Hardy Heron and you can’t seem to connect. You try a test telnet session and get

icottee@ijcdev:~$ telnet localhost 143
Connected to localhost.
Escape character is '^]'.
* BYE Fatal error: can't write proc file
Connection closed by foreign host.

Take a look in /var/log/mail.err and you’ll see stuff like

May 19 22:13:15 ijcdev cyrus/imap[8316]: DBERROR: dbenv->open '/var/lib/cyrus/db' failed: Permission denied
May 19 22:13:15 ijcdev cyrus/imap[8316]: DBERROR: init() on berkeley
May 19 22:13:15 ijcdev cyrus/imap[8316]: DBERROR: reading /var/lib/cyrus/db/skipstamp, assuming the worst: Permission denied
May 19 22:13:15 ijcdev cyrus/imap[8316]: locking disabled: couldn't open socket lockfile /var/lib/cyrus/socket/imap-1.lock: Permission denied
May 19 22:13:15 ijcdev cyrus/imap[8316]: IOERROR: creating /var/lib/cyrus/proc/8316: Permission denied
May 19 22:13:15 ijcdev cyrus/imap[8316]: Fatal error: can't write proc file
May 19 22:13:15 ijcdev cyrus/master[8260]: process 8316 exited, signaled to death by 11

The solution is simple

chown -R cyrus /var/lib/cyrus

I’d give cyrus a restart after that as well.