Copy VMWare Server virtual servers (Ubuntu) between physical machines, avoid locking errors and fix missing eth0

I needed to copy a virtual Ubuntu Server install from our backup store to a new physical server (server A) as our old server (server B) suffered a major failure and wouldn’t even boot. This meant copying the whole VMWare directory containing the Ubuntu virtual machine from the backup store (a USB harddrive in this case) to the new physical server (server A). I had installed the free VMWare Server on both server B and A so that if anything happened to server B I would be able to get up and running quickly on server A.

Note: I am assuming you can install and configure VMWare Server for Windows, which is what I’m using here.

Once I copied the whole directory from the backup store to server A’s VMWare directory (in this case c:vmware) I then used the VMWare web interface to “Virtual Machine – Add Virtual Machine to Inventory” which allowed me to select the .vmx file in my datastore that corresponded to my copied Ubuntu virtual machine.

On trying to start the virtual machine I get a warning message and a choice:

msg.uuid.altered: This virtual machine may have been moved or copied. In order to configure certain management and networking features VMware Server needs to know which. Did you move this virtual machine, or did you copy it? If you don’t know, answer “I copied it”.

I select “I copied it” and then click “ok”, which then brings up an error:

“Power On Virtual Machine” failed to complete

If these problems persist, please contact your system administrator.
Cannot open the disk ‘C:vmwareVIRTUALSERVERNAMEVIRTUALSERVERNAME.vmdk’ or one of the snapshot disks it depends on. Reason: Failed to lock the file.

Ok, so it seems that because I copied the virtual server from the backup store it also included the .lck directories, which are used while the server is running. The simple fix is to delete these directories in C:vmwareVIRTUALSERVERNAME and allow VMWare server to rebuild them. Once I had deleted the two directories “VIRTUALSERVERNAME.vmdk.lck” and “VIRTUALSERVERNAME.vmem.lck” I could start the virtual machine.

I then ran into another problem, which was that my network instance eth0 was not being set up correctly even with VMWare Server set to use “Bridged” networking which worked on the old server. Running “ifconfig -a” showed that eth0 wasn’t there and it didn’t have the static IP I had given it previously in “/etc/network/interfaces”. The loopback interface, l0, was there but not eth0.

Orzeszek has an easy solution for this, which is to delete the “/etc/udev/rules.d/70-persistent-net.rules” file and “sudo reboot” to allow Ubuntu to rebuild the file with the correct MAC address, set up by VMWare Server when we originally added the virtual machine to the inventory. Now everything should be working perfectly.

Some people have reported other errors, which can be fixed by changing the name of eth0 in “/etc/network/interfaces” to eth1, which I didn’t need to do but you might.

 

Remote Connection to Oracle from Linux (Ubuntu) Using SQL*Plus

I followed instructions from the Oracle documentation to connect to our remote server with a public IP address from home and check that everything was running ok. It is easy when you know how, as usual!

First off, make sure you have enough swap space (over 1GB) to install the Oracle Express Client. I didn’t have enough so had to use a livecd and a third party partition manager to resize my swap partition to a reasonable size.

Next up I downloaded the Oracle Express Client from Oracle themselves (click here to download it) and installed it using the ubuntu package manager. Easiest way, double click on it, click install!

Now the oracle client is installed you have SQL*Plus, a command line interface to your remote and local databases. It isn’t great to use, no command completion, no remembering previous commands but it is the quickest way to get a SQL command line interface.

Open up SQL*Plus (in the main menu > Oracle Client 10g Express Edition > Run SQL Command Line) and now you have a SQL> prompt. This is where you enter “connect” and your connection string and user details etc. For example, connecting as “sys”:

connect sys/password@ip.ad.dre.ss/instancename as sysdba

The oracle default instance name (if you installed the example database) is “orcl”. So if your password is “foobar” and your ip address is “192.168.1.1″ then you need to type into the command prompt:

connect sys/foobar@192.168.1.1/orcl as sysdba

Of course you can change the login to whoever you want and if you look at the documentation you will  find a better way to do this in future using a connection identifier. If you are successful then SQL*Plus will say “Connected.” and you now have a connection, it’s just like being there.

To test out your connection as “sys” try typing the following (thanks Viktor) into the terminal to list all the current schemas/users in the database:

select username from all_users;

You should get a list back and the number of rows selected (about 27 rows if you installed the example database). Now you know how to connect you can run any SQL commands (inc PL/SQL etc) you want plus all the SQL*Plus commands, which I am just beginning to get to grips with.

Getting suspend working in Ubuntu with VAIO vgn-s3hp

After trawling the forums I found an acpi-support config that worked and allowed me to suspend and hibernate in ubuntu 8.04.

sudo gedit /etc/default/acpi-support

Then edit the acpi-support file so it looks like:

# Comment the next line to disable ACPI suspend to RAM
ACPI_SLEEP=true

# Comment the next line to disable suspend to disk
ACPI_HIBERNATE=true

# Change the following to “standby” to use ACPI S1 sleep, rather than S3.
# This will save less power, but may work on more machines
ACPI_SLEEP_MODE=mem

# Add modules to this list to have them removed before suspend and reloaded
# on resume. An example would be MODULES=”em8300 yenta_socket”
#
# Note that network cards and USB controllers will automatically be unloaded
# unless they’re listed in MODULES_WHITELIST
MODULES=””

# Add modules to this list to leave them in the kernel over suspend/resume
MODULES_WHITELIST=””

# Should we save and restore state using the VESA BIOS Extensions?
SAVE_VBE_STATE=true

# The file that we use to save the vbestate
VBESTATE=/var/lib/acpi-support

/vbestate

# Should we attempt to warm-boot the video hardware on resume?
POST_VIDEO=true

# Save and restore video state?
# SAVE_VIDEO_PCI_STATE=true

# Should we switch the screen off with DPMS on suspend?
USE_DPMS=true

# Use Radeontool to switch the screen off? Seems to be needed on some machines
# RADEON_LIGHT=true

# Uncomment the next line to switch away from X and back again after resume.
# This is needed for some hardware, but should be unnecessary on most.
# DOUBLE_CONSOLE_SWITCH=true

# Set the following to “platform” if you want to use ACPI to shut down
# your machine on hibernation
HIBERNATE_MODE=platform

# Comment this out to disable screen locking on resume
LOCK_SCREEN=true

# Uncomment this line to have DMA disabled before suspend and reenabled
# afterwards
# DISABLE_DMA=true

# Uncomment this line to attempt to reset the drive on resume. This seems
# to be needed for some Sonys
# RESET_DRIVE=true

# Add services to this list to stop them before suspend and restart them in
# the resume process.
STOP_SERVICES=””

# Restart Infra Red services on resume – off by default as it crashes some
# machines
RESTART_IRDA=false

# Switch to laptop-mode on battery power – off by default as it causes odd
# hangs on some machines
ENABLE_LAPTOP_MODE=true

# Spindown time on battery
SPINDOWN_TIME=12

UPDATE:

If you have success with this and are active in the community it might be a good idea to update the people on the Ubuntu forums. I’m pretty sure I’m not the only one that’s had to do this to get standby working! I’ve had problems with Hibernate since posting this, seems it is still a bit flaky, and gives me a psychadelic screen (like its breaking and fading to white) occasionally.