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

# 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!


5 Responses to “Useful Linux VM Tweaks, Part 1”

  1. Forbes Guthrie Says:

    This is one of the little things I like to do, a useful reminder of being root (and it looks pretty :))

  2. mastrboy Says:

    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. Steve Chambers Says:

    Is that it?

    hhehehehe 😀

  4. Martin Says:

    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 Says:

    just stumbled upon a similar article:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: