Installing Backtrack 4 beta to virtual disk (disc) on Microsoft Virtual Machine (Virtual PC).

I don't know if this is going to be relevant for anyone, but after hours of sweating I thought I'd at least share my experience setting up BT4b on MS VPC.

First, I assume you have already installed Virtual PC and understand the in's and out's of it.

Secondly my setup so you can compare with your own.

OS: Win XP Pro SP2
CPU: AMD Athlon 64 Dualcore 5600+ (2.9ghz)
On-Board Chipset: Nvidia 7025, nForce 630a
PCI-X: Radeon X1650 (Swanky hey, :-( lol)
Memory: 2GB
HDD: 150GB Sata

MS-VPC: 2007

Note: my onboard graphics are disabled, I'm using only the Radeon.

As I have never done this before my first task was to at least get BT4b running from the cd and into the kde. I decided to mount the ISO in Windows using Magic Disc and run from their.

These steps got the live cd running in graphical mode:

Create a new VM in VPC.
Create a FIXED SIZED virtual disk (I chose a size of 2GB), We'll need 4GB later though so set that now if you want!!
I allocated 512MB of MEMORY, We'll need 1024MB later, see further below for any error details in doing this!!
Set the display mode to use "GUEST OS RESOLUTION"

Start the VM and select the "CD" option ensuring the disk drive you have BT4b on is being used by the VM, if it isn't then select "Use Physical Drive: x" from the "CD" menu.

Ok, so BackTrack booted up and I got the login screen "root" and "toor" got me to the shell. I typed "startx" to run graphics mode. It wasn't having it.
I got a different error depending where I looked "Screeninit Failed...." etc. There is nothing initially in the xorg.conf file which I didn't realise. So I tried fixvesa and fixvmware. Neither helped.

After googling (many dead ends) it turned out to be a section named "Files" in the xorg.conf file after doing fixvesa. So at the shell:

# fixvesa
# nano /etc/X11/

Ensuring the "X" in X11 is capitalised!!! (So, i'm new to all this :-) )

The file opens with nano, I deleted everything between:

Section "Files"



I also deleted the tag names aswell.

Now hit [CTRL+X], you'll be prompted to save the file, enter "Y" and hit [ENTER]. You're back to the shell & the file's saved in memory.


# startx

Fingers crossed, and Voila. Oh the relief, better Chocolate!!

I was up and running and feeling very pleased, however I like things to do what they say on the tin. So this fixvesa and editing a file malarkey wasn't quite Ronseal for me. I needed that file to be permanant. The only way forward was to have a permanantly edited copy of xorg.conf. I needed to install the live CD to a disk (a virtual disk). A tad out of my depth here but still.........

The lost hours I spent running into problem after problem, mainly I had issues mounting and partitioning the virtual disk. Then at the eleventh hour I came across the hard drive install guide over at:
Google: backtrack 4 install (Second, [sub] link)

Now there where a few issues with this that I need to address:

1. Ensure your virtual hard drive is minimum 4GB, Minimum, you'll want more depending what you intend to do, but that's up to you!!

2. Allocate 1024MB memory to your VM, 512MB won't cut it. Ensure you are not running anything else in Windows except the VM and the PDF guide or this guide. If you are running applications in Windows you might get an error when you allocate the 1024MB. Unless you have lots of memory to spare I suppose.

3. Stay in text mode when you've logged into BT.

4. The guide uses SDA but the Virtual Machine supplies us with a virtual IDE disk not Sata. So anywhere in the guide you need to substitue any occurance of SDA with HDA.

Now you can follow the proper guide making the changes as necessary, but I'll write out how I did it. I'll just write out the key pressess and couple of instructions to keep it short as possible:

////I decided to have 128mb boot partition a 512mb swap and remainder of the 4gig as the main partition, the guide uses 1024MB for the swap though. I however want to copy this VM to my fat32 external (With the hope these VMs are transportable?). So not wanting to exceed the 4gig limit of the Fat32 file system and unsure how much the expanded contents of live cd would take up I decided to half the guidelined swap partition.

//// Login

#Login: Root
#Password: toor

//// Run fdisk utitlity

#fdisk /dev/hda [ENTER]

//// Ensure No Partiton on hda1p4


////Ensure No Partiton on hda1p3


//// Ensure No Partiton on hda1p2


////Ensure No Partiton on hda1p1


//// Create Boot Partition with Size of 128mb on hda1

+128M [ENTER]

//// Create Swap partition with size of 512mb on hda2

+512M [ENTER]

//// Create our main partition, default values assigns remaining disk space


//// Mark the swap partition as a "Swap partition"

82 [ENTER]

//// Mark the boot partition as active


//// Commit the changes

//// Back to the shell

//Constructs the file system on boot partition, I guess!

# mke2fs /dev/hda1

//// Constructs the swap partition and activates it????

# mkswap /dev/hda2
# swapon /dev/hda2

//// Constructs the main file system on our main partition hda3

# mkreiserfs /dev/hda3

//// Make some directories and mount our new partitions

# cd /

# mkdir /mnt/bt

# mount /dev/hda3 /mnt/bt/

# mkdir /mnt/bt/boot

# mount /dev/hda1 /mnt/bt/boot

//// Now copy the OS from memory/cd to our new partition, this takes a while and
//// no progress indication, unless you add | dmesg but that'll use memory and a waste.
//// dunno if there's another command to monitor progress???

# cp --preserve -R /{bin,dev,home,pentest,root,usr,boot,etc,lib,opt,sb in,var} /mnt/bt/

//// Go for a coffee...

//// Now create some more directories, no spaces after the commas!!!

# mkdir /mnt/bt/{mnt,tmp,proc,sys}

//// Set permission for tmp directory, if it doesn't exist you did the last mkdir incorrectly, do it again.

# chmod 1777 /mnt/bt/tmp/

//// God knows what this is doing, seems to work though

# mount -t proc proc /mnt/bt/proc
# mount -o bind /dev /mnt/bt/dev
# chroot /mnt/bt/ /bin/bash

////Right nearly done, I think the last commands somehow put the control of the OS over to our new install??

//// Now the lilo config file you need to change a couple of lines:

# nano /etc/lilo.conf

//// Change only the first to lines, they should look as follows:



////You should be return to the shell #:

//// Now the fstab thingy, I deleted everything from it and replaced it with the information from the BackTrack Install (PDF) guide. Also ensuring any SDA occuranced where changed to HDA. So as follows:

# nano /etc/fstab

//// Delete all text and replace with the following:

/dev/hda3 / reiserfs defaults 0 0 # AutoUpdate
/dev/hda2 none swap sw 0 0
proc /proc proc defaults 0 0 # AutoUpdate
sysfs /sys sysfs defaults 0 0 # AutoUpdate
devpts /dev/pts devpts gid-5,mode-620 0 0 # AutoUpdate
tmpfs /dev/shm tmpfs defaults 0 0 # AutoUpdate

//// Then:


//// You should be return to the shell

# lilo -v
# exit
# reboot

//// All being well and good lilo -v works, I got a warning but nothing important. Reboot, ensuring on the CD menu in your VM that you've Released the drive containing BackTrack 4 otherwise the CD will boot and not the OS.

And with a bit of luck it'll work.


PS: sorry if there's any errors in here and for the shoddy explanations. Hope it might help someone.