Thursday 11 November 2010

vPro Woe

Soooo... vPro is a nice handy way to reboot & diagnose PC problems before the o/s loads... you can remote into the bios etc...

One problem if you need to use it to remote a PC into PXE boot (for RIS / WDS) is the lack of F12 passthrough! Suggested fixes from the msg boards suggest simply setting the client to one time boot to PXE then set the PXE server to auto it... not possible in all environments as you may have clients (like here) always going to PXE...

So we hack around it! Using rom-o-matic.com's PXE boot disk creator with custom script on the end -

ifstat
ifopen
dhcp net0
chain n12\i386\startrom.com << this points to a different dir on the RIS filesystem (standard would be OSChooser\i386\startrom.com) where startrom.n12 has been renamed to startrom.com (the standard way to get PXE clients to network boot automatically) *edit* Found out if you simply put the path as OSChooser\i386\startrom.n12 you won't need the extra directory...

So now you can remote the client (I'm using radmin viewer) & redirect to the boot image (iso) and voila! it "auto" F12's and you're into the OSChooser.

Now just need to fix the network driver conflict in the next phase!

Friday 22 October 2010

Grub / Chroot problems

"block device: Not found or not a block device." when trying to install GRUB whilst chrooted... run these commands before -


mount --bind /proc /mnt/sysimage/proc
mount --bind /dev /mnt/sysimage/dev
mount --bind /sys /mnt/sysimage/sys


Thanks novell :D

Thursday 5 August 2010

Running Linux Installers from Windows Remote Installation Service (RIS)

There may be a time when you need to use some ancient Windows software to deploy a Linux O/s... setting up a Linux PXE / TFTP system is no fun at all and far too obvious a solution! Anyway here's how to use RIS (WDS running in Legacy) to launch a Linux network install (or could be a LiveCD etc...)


RIS looks for a .sif file in your images folder, so make a new folder for your install then create a /i386/templates/pxelinux.sif file (you can call it whateveryoulike.sif) and it needs the following -

[OSChooser]
Description="Whatever You Are Installing"
Help="Linux install blah blah blah"
LaunchFile="%INSTALLPATH%\%MACHINETYPE%\templates\pxelinux.0"
ImageType=Flat
Version="1.00"
 Version can be whatever you like, as can the description and help. You need to copy pxelinux.0 from your distro to \templates and from there it basically runs the same as it would on a Linux PXE/TFTP server... so have a look at instructions on how to get that working from there.

pxelinux.0 looks for a pxelinux.cfg directory which usually has a file "default" which is a plaintext file detailing the boot menu and pointing to the relevent initrd.img file you're trying to load... there will probably be one of these files in your linux distro's isolinux dir and you can mess around with it to give different boot options.

Anyway thats basically how it's done, information from a variety of sources and some trial and error!


Wednesday 4 August 2010

Steam Page

My Steam profile... I can occasionally be found on there shooting zombies in L4d2

Original Name

Bandcamp page

I'll be posting the tracks I make over @ bandcamp -
longtom.bandcamp.com

Have to offset the massive geekery somehow!!!

Fedora 13 Kickstart Disk Partitioning

Work asked me to create an auto install of Fedora 13 that resizes a Windows XP install automagically... here's the results of some hair pulling and tomgeekery!!!

In your ks.cfg -
%pre
#get partition scripts / files
wget -P/tmp http://IPADDRESS/partition.sh 
sh /tmp/partition.sh >> /tmp/partition.log
 partition.sh -
#!/bin/bash
##############################################################################
#Made by Long Tom 2010
#Script resizes 160GB Windows disk to 80GB ntfs, 76GB linux & 4GB swap
#Procedure (tested manually)
##resize windoze partition
#ntfsresize -f -s 80G /dev/sda1 (works)
#Now fdisk - Delete sda1, recreate new NTFS at half size and toggle bootable
#parted can now use free space
##make a root linux partition
#parted mkpartfs primary ext2 start end
#partition remaining for swap
#parted mkpartfs primary linux-swap start end
##format the filesystems, installer can change to ext3 / 4 later on
##############################################################################

##########    Getting the numbers

#First need to get disk size(s)   
dev=`fdisk -l | grep -m 1 Disk | grep bytes | awk '{print $2}'`    #gives something like - Disk /dev/sda: 500.1 GB, 500107862016 bytes
bytes=`fdisk -l | grep -m 1 Disk | grep bytes | awk '{print $5}'`

dev=${dev%:}    #strip of : from end

#get RAM
mem=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'` #gives memory in kB

#echo "$memk"

let kbytes=$bytes/1000

echo "First disk drive $dev"
echo "Total size $kbytes kB"
echo "System memory $mem kB"    #we'll use this as swap partition size

#so half size of disk -
let halfPartSize=$kbytes/2

echo "Windows partition will be $halfPartSize kB"
echo "Swap will be $mem kB"
echo "Linux will be whatever's left!"

one="1"

dev1=$dev$one    #gives /dev/sda1
let halfPartSizeK=$halfPartSize*1000    #ntfsresize needs kb

##########    Resize windows partition
echo "Now running ntfsresize -f -s $halfPartSizeK $dev1"
ntfsresize -f -s $halfPartSizeK $dev1

##########    Check to see if previously partitioned - if so skip fdisk +hope!!!

#if [`fdisk -l | grep sda2`

##########    Make fdisk.commands file with fdisk scripting

K="K"
plus="+"
halfPartSizeK=$plus$halfPartSize$K
linuxK=$plus$mem$K
#swapStartK=$plus$swapStart$K

echo "d" > /tmp/fdisk.commands    #delete
echo "n" >> /tmp/fdisk.commands    #new
echo "p" >> /tmp/fdisk.commands    #pri
echo "1" >> /tmp/fdisk.commands    #num
echo "1" >> /tmp/fdisk.commands    #start
echo $halfPartSizeK >> /tmp/fdisk.commands    #end
echo "t" >> /tmp/fdisk.commands    #type
echo "7" >> /tmp/fdisk.commands    #ntfs
echo "a" >> /tmp/fdisk.commands    #boot
echo "1" >> /tmp/fdisk.commands
echo "n" >> /tmp/fdisk.commands    #new
echo "p" >> /tmp/fdisk.commands    #pri
echo "2" >> /tmp/fdisk.commands    #num
echo "" >> /tmp/fdisk.commands    #start
echo $linuxK >> /tmp/fdisk.commands    #end
echo "n" >> /tmp/fdisk.commands    #new
echo "p" >> /tmp/fdisk.commands    #pri
echo "3" >> /tmp/fdisk.commands    #num
#echo $swapStartK >> /tmp/fdisk.commands    #start   
echo "" >> /tmp/fdisk.commands    #start   
echo "" >> /tmp/fdisk.commands    #end defaults fine here
echo "w" >> /tmp/fdisk.commands    #write & quit

##########    Now run fdisk

echo "Now running fdisk $dev"

fdisk $dev < /tmp/fdisk.commands

echo "Now running parted to format linux partitions"
parted -s $dev mkfs 3 ext2
parted -s $dev mkfs 2 linux-swap

exit 0
Get that for some dodgy scripting!!! hehehe works though :P