Useful Linux VM Tweaks, Part 1

I’ve called this Part 1 because as I mess around more with Linux VM’s I have no doubt there will be more posts like this one. Don’t expect anything earth shattering in them either… this is all easily obtainable info, it wouldn’t surprise me if I get comments suggesting better ways to do what I have done (and I encourage such comments so I can learn!).

For this first installment, I’m going to cover a very small customisation I make to the startup scripts on my Linux template machine, which is currently based on Ubuntu 8.04.3 JeOS edition.

At this point in time, I basically only make 2 small changes. First, to save me from having to login and run ifconfig to find out what IP address the VM has, I modify /etc/issue to display the IP address above the login prompt. The other thing that really bothers me is the PC speaker beep. Yes I know you can disable this by adding an option to the .vmx file, but I would rather do it within the VM so I (or other people) can deploy via OVF and get a consistent result without needing to modify .vmx files. So I remove the module that is responsible for enabling the PC speaker.

So here is what I add just above the exit 0 line of /etc/rc.local

# Clear screen
clear


# Build /etc/issue
HEADER="Ubuntu 8.04.3 LTS \l"
KERNEL=`uname -sr`
IP=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
echo "$HEADER :: $KERNEL :: $IP" > /etc/issue
echo >> /etc/issue


# kill pc speaker
rmmod pcspkr

Which produces the following nice looking screen, ready for me to SSH into the box

If you have any similar favourite small tweaks for Linux VM’s, please share them in the comments!

This entry was posted in Uncategorized. Bookmark the permalink. Both comments and trackbacks are currently closed.

5 Comments

  1. Posted January 13, 2010 at 4:31 am | Permalink

    This is one of the little things I like to do, a useful reminder of being root (and it looks pretty :) )
    http://www.vreference.com/2008/04/16/command-prompt-colours/
    Forbes.

  2. mastrboy
    Posted January 13, 2010 at 9:13 am | Permalink

    i usually do the following for linux vm’s:

    - set noatime in /etc/fstab for disks

    - increase read-ahead:
    blockdev –setra 4096 /dev/{sda,sda1,sda2,sdb,sdb1}

    - change scheduler for disk
    echo deadline > /sys/block/sda/queue/scheduler
    echo deadline > /sys/block/sdb/queue/scheduler

    - decrease need for swapping when enough memory is installed
    sysctl -w vm.swappiness=0

  3. Posted January 13, 2010 at 6:23 pm | Permalink

    Is that it?

    hhehehehe :-D

  4. Martin
    Posted January 13, 2010 at 8:50 pm | Permalink

    in order to make it more generic grab information form lsb-release

    # Build /etc/issue
    KERNEL=`uname -sr`
    . /etc/lsb-release
    IP=`ifconfig eth0 | grep ‘inet addr:’ | cut -d: -f2 | awk ‘{ print $1}’`
    echo “$DISTRIB_DESCRIPTION :: $KERNEL :: $IP” > /etc/issue
    echo >> /etc/issue

  5. mastrboy
    Posted January 18, 2010 at 11:39 am | Permalink

    just stumbled upon a similar article: http://peterkieser.com/technical/vmware-server-issues/

  • I wrote a book! Well, some of it…