|
|||||||
| Tutorials & Guides Contributions welcome! Please check the rules & guidelines for posting |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Before I start, I would like to thank Pureh@te for his video tutorial that covers this. GREAT JOB
![]() When I could not find a written Tutorial that included the persistent changes, and was done from start to finish on a Linux box, I decided to write my own so here it is. On a side note, this is the first Tutorial I have ever written, so any feedback would be appreciated ![]() For this Tutorial I will be installing BT3 on a 2 GB Flash Drive. Feel free to use a drive with more capacity, I recommend that you have at least 2 GB's. Now lets get started. Download the BT3B USB version. Open a terminal and wget it. Code:
wget http://www.remote-exploit.org/cgi-bin/fileget?version=bt3b-usb Once you have downloaded the file. place it in a directory of your likings and forget about it for the time being. We will need to split our 2GB drive into 2 separate partitions. One partition will be 1.10 GB's on a FAT32 file system, and the second will be the remainder of the free space as an Ext 3 filesystem. I will be using "fdisk, mkfs, & fsck" to setup the partitions. Insert your drive into the nearest USB port and lets- Create the Partitions Open a terminal and type the following command: Code:
fdisk /dev/sdb This is the fdisk prompt: Code:
Command (m for help): Code:
Command (m for help): p Disk /dev/sdb: 1998 MB, 1998585344 bytes 255 heads, 63 sectors/track, 242 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xa62da6ab Device Boot Start End Blocks Id System /dev/sdb1 * 1 132 1060258+ b W95 FAT32 /dev/sdb2 133 242 883575 83 Linux You will then be asked for the partition number that you want to delete. Code:
Command (m for help): d Partition number (1-4): Once there are no partitions, the output of "p" will be: Code:
Command (m for help): p Disk /dev/sdb: 1998 MB, 1998585344 bytes 255 heads, 63 sectors/track, 242 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xa62da6ab Device Boot Start End Blocks Id System Code:
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-242, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-242, default 242): +1080M I know the first partition should be FAT32 and is clearly Linux, don't worry we are getting to that Again type "n" and answer the questions. Code:
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (133-242, default 133): Using default value 133 Last cylinder or +size or +sizeM or +sizeK (133-242, default 242): Using default value 242 Code:
Command (m for help): p Disk /dev/sdb: 1998 MB, 1998585344 bytes 255 heads, 63 sectors/track, 242 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xa62da6ab Device Boot Start End Blocks Id System /dev/sdb1 1 132 1060258+ 83 Linux /dev/sdb2 133 242 883575 83 Linux Type "t" and enter, then answer the questions: Code:
Command (m for help): t Partition number (1-4): 1 Hex code (type L to list codes): b Changed system type of partition 1 to b (W95 FAT32) Now we will make the first partition bootable. Type "a" and enter the partition number that you want bootable. in this instance it will be 1. Code:
Command (m for help): a Partition number (1-4): 1 Code:
Command (m for help): p Disk /dev/sdb: 1998 MB, 1998585344 bytes 255 heads, 63 sectors/track, 242 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xa62da6ab Device Boot Start End Blocks Id System /dev/sdb1 * 1 132 1060258+ b W95 FAT32 /dev/sdb2 133 242 883575 83 Linux Type "w" and enter Writing the Filesystems For this task we will be using "mkfs" At the terminal type: Code:
user@laptop:~$ mkfs -t vfat /dev/sdb1 Code:
mkfs.vfat 2.11 (12 Mar 2005) Code:
mkfs -t ext2 /dev/sdb2 Code:
mke2fs 1.40.8 (13-Mar-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
56896 inodes, 226918 blocks
11345 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=234881024
7 block groups
32768 blocks per group, 32768 fragments per group
8128 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Check The Filesystems At the Terminal type: Code:
fsck -y /dev/sdb1 Code:
fsck 1.40.8 (13-Mar-2008) dosfsck 2.11, 12 Mar 2005, FAT32, LFN /dev/sdb1: 0 files, 1/264543 clusters Code:
fsck -y /dev/sdb2 Code:
fsck 1.40.8 (13-Mar-2008) e2fsck 1.40.8 (13-Mar-2008) /dev/sdb2: clean, 11/55328 files, 6071/220893 blocks "cd" to the directory where you have the downloaded BT3 rar file, and run unrar. Code:
unrar x bt3b141207.rar Once the unpacking is completed OK we need to start copying files to our drive. "cd" into the unpacked directory and copy "boot" and "BT3" directories to the first partition of your flash drive. So type: Code:
cp -r boot /media/disk Code:
cp -r BT3 /media/disk We need to "cd" to the first partition of the flash drive. So type: Code:
cd /media/disk Code:
cd boot/syslinux In the terminal type: Code:
chmod 777 lilo Code:
chmod 777 syslinux Code:
nano syslinux.cfg Code:
LABEL pchanges MENU LABEL BT3 Graphics mode with Persistent Changes KERNEL /boot/vmlinuz APPEND vga=0x317 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw changes=/slax/slaxsave.dat autoexec=xconf;kdm Code:
LABEL pchanges MENU LABEL BT3 Graphics mode with Persistent Changes KERNEL /boot/vmlinuz APPEND vga=0x317 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw changes=/dev/sdb2 autoexec=xconf;kdm We need to go back up one directory to run the bootinst.sh script So: Code:
cd .. Code:
bootinst.bat bootlilo.sh dos isolinux mt86p vesamenu.c32 bootinst.sh chain.c32 initrd.gz modules syslinux vmlinuz Code:
./bootinst.sh Code:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Welcome to Slax boot installer
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This installer will setup disk /dev/sdb1 to boot only Slax.
Warning! Master boot record (MBR) of /dev/sdb will be overwritten.
If you use /dev/sdb to boot any existing operating system, it will not work
anymore. Only Slax will boot from this device. Be careful!
Press any key to continue, or Ctrl+C to abort...
Code:
Flushing filesystem buffers, this may take a while... Setting up MBR on /dev/sdb... The Master Boot Record of /dev/sdb has been updated. Activating partition /dev/sdb1... No partition table modifications are needed. Updating MBR on /dev/sdb... Setting up boot record for /dev/sdb1... Disk /dev/sdb1 should be bootable now. Installation finished. Read the information above and then press any key to exit... Reboot your machine and test out the stick If anyone has any questions or are not clear on any part of this Tutorial I will answer any of your questions to the best of my ablility. Last edited by pureh@te; 06-08-2008 at 08:29 AM. |
|
|||
|
Quote:
System: Ubuntu v8.04 (essentially fresh/vanilla) Backtrack v3 final [Excluding hardware information] Input: Code:
./bootinst.sh Code:
bash: ./bootinst.sh: Permission denied root@(Your ad here):/media/disk/boot# Code:
root@(Your ad here):/media/disk/boot# chmod +x bootinst.sh root@(Your ad here):/media/disk/boot# ./bootinst.sh Can't find device to install to. Make sure you run this script from a mounted device. Code:
#!/bin/bash set -e TARGET="" MBR="" # Find out which partition or disk are we using MYMNT=$(cd -P $(dirname $0) ; pwd) while [ "$MYMNT" != "" -a "$MYMNT" != "." -a "$MYMNT" != "/" ]; do TARGET=$(egrep "[^[:space:]]+[[:space:]]+$MYMNT[[:space:]]+" /proc/mounts | cut -d " " -f 1) if [ "$TARGET" != "" ]; then break; fi MYMNT=$(dirname "$MYMNT") done if [ "$TARGET" = "" ]; then echo "Can't find device to install to." echo "Make sure you run this script from a mounted device." exit 1 fi |
|
|||
|
I've had problems with the bootinst.sh when running it from distros other than BT. You should try to boot off a BT cd and run the script. When I ran the script from my slackware 12.1 system I got a "bad interpretor" error message. Same on gentoo. In both cases running it while booted off a bt cd succeeded.
I noticed you have your disk mounted in media. Does ubuntu automount(hal) external drives? If it does, this might possibly be the cause of your problem. You should "cat /proc/mounts" and see if your drive is listed. The "mount" command with no arguements will show you the same info. Possibly it is mounted with the noexec flag. I don't use ubuntu, or an auto-mounter of any kind. If it writes an entry in /etc/fstab it might shed a little light on your problem. Plugging in your drive then running "dmesg" might also be helpful. Maybe you could shutdown the auto-mounter and mount your drive manually. Or you could just boot off a bt cd and run the script. Good Luck |
|
|||
|
fdisk returns:
Code:
Disk /dev/sdb: 1998 MB, 1998585856 bytes 16 heads, 32 sectors/track, 7624 cylinders Units = cylinders of 512 * 512 = 262144 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdb1 1 4121 1054960 b W95 FAT32 /dev/sdb2 4122 7624 896768 83 Linux Code:
. . . . /dev/sdb1 on /media/disk-1 type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1001,utf8,umask=077,flush) Code:
root@(Your ad here):/media# mount /dev/sdb2 mount: can't find /dev/sdb2 in /etc/fstab or /etc/mtab root@(Your ad here):/media# umount /dev/sdb1 umount: /dev/sdb1: not mounted |
|
|||
|
Quote:
Here is my bootinst.sh: Code:
#!/bin/bash
set -e
TARGET=""
MBR=""
# Find out which partition or disk are we using
MYMNT=$(cd -P $(dirname $0) ; pwd)
while [ "$MYMNT" != "" -a "$MYMNT" != "." -a "$MYMNT" != "/" ]; do
TARGET=$(egrep "[^[:space:]]+[[:space:]]+$MYMNT[[:space:]]+" /proc/mounts | cut -d " " -f 1)
if [ "$TARGET" != "" ]; then break; fi
MYMNT=$(dirname "$MYMNT")
done
if [ "$TARGET" = "" ]; then
echo "Can't find device to install to."
echo "Make sure you run this script from a mounted device."
exit 1
fi
MBR=$(echo "$TARGET" | sed -r "s/[0-9]+\$//g")
NUM=${TARGET:${#MBR}}
cd "$MYMNT"
clear
echo "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
echo " Welcome to Slax boot installer "
echo "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
echo
echo "This installer will setup disk $TARGET to boot only Slax."
if [ "$MBR" != "$TARGET" ]; then
echo
echo "Warning! Master boot record (MBR) of $MBR will be overwritten."
echo "If you use $MBR to boot any existing operating system, it will not work"
echo "anymore. Only Slax will boot from this device. Be careful!"
fi
echo
echo "Press any key to continue, or Ctrl+C to abort..."
read junk
clear
echo "Flushing filesystem buffers, this may take a while..."
sync
# setup MBR if the device is not in superfloppy format
if [ "$MBR" != "$TARGET" ]; then
echo "Setting up MBR on $MBR..."
./boot/syslinux/lilo -S /dev/null -M $MBR ext # this must be here to support -A for extended partitions
echo "Activating partition $TARGET..."
./boot/syslinux/lilo -S /dev/null -A $MBR $NUM
echo "Updating MBR on $MBR..." # this must be here because LILO mbr is bad. mbr.bin is from syslinux
cat ./boot/syslinux/mbr.bin > $MBR
fi
echo "Setting up boot record for $TARGET..."
./boot/syslinux/syslinux -d boot/syslinux $TARGET
echo "Disk $TARGET should be bootable now. Installation finished."
echo
echo "Read the information above and then press any key to exit..."
read junk
Quote:
If you were to try and copy the files to /dev/sdb1, stdout would tell you that it is not a directory Code:
bash: cd: /dev/sdb1: Not a directory Code:
user@lappie:~$cd /media/disk/boot Code:
user@lappie:/media/disk/boot$sudo ./bootinst.sh
|
|
|||
|
Got problems....if I use /sdb2 it doesn't save....
So i've booted without saving and noticed that sda2 is the linux partition and sda1 is the vfat.... so i've tryed to use /sda2 but the boot process hangs with the message: mount: mounting aufs on union failed Fatal error occoured - can't setup union (aufs) Please reboot.... Any idea? -----------------------edit------------------------------------------------------ Just manually create in ext2 partition the "changes" folder... --------------------------------------------------------------------------------- Please add the trick in the main thread! Last edited by michelinok; 06-26-2008 at 12:26 PM. |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|