LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-07-2009, 10:11 PM   #1
lifeforce4
Member
 
Registered: May 2003
Location: 2:16:840
Distribution: Slackware, CentOS, RedHat, Xubuntu
Posts: 169
Blog Entries: 1

Rep: Reputation: 32
Question Backtrack3 boot from partition.


I followed the steps to boot up BT3 from a partition and everything seems to work out. The problem is when it goes from the live CD part of the boot over to starting the distro it just hangs on the initrd section and wont boot any more. what might cause it to freeze on initrd?

http://wiki.remote-exploit.org/index...boot_from_grub

Is there a form that deals with the backtrack distro?

Thanks,
Kyle
 
Old 01-09-2009, 08:59 AM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
What is written just before it hangs please?
 
Old 01-09-2009, 09:33 AM   #3
lifeforce4
Member
 
Registered: May 2003
Location: 2:16:840
Distribution: Slackware, CentOS, RedHat, Xubuntu
Posts: 169
Blog Entries: 1

Original Poster
Rep: Reputation: 32
Post

Quote:
Originally Posted by Agrouf View Post
What is written just before it hangs please?
Sorry I was not able to write that down the first time. Here is what it's doing and where it seems to hang. When it loads from the CD backtrack works just fine and gets past this part but from the hard drive it does not. I don't know if this has anything to do with it but it loads like most standard CLI distros it does not have the backtrack boot splash but I just figured that's because I'm using grub instead of lilo.

Code:
...
* looking for data directory
* using BT3 data from /mnt/sda7/BT3
* setting up directory for changes
* changes not writable, using memory only
* setup union directory (using aufs, with udba=none)
* inserting all modules and creating live filesystem
* -> /base/bin.lzm
* -> /base/etc.lzm
* -> /base/home.lzm
* -> /base/lib.lzm
* -> /base/opt.lzm
* -> /base/pentest.lzm
* -> /base/root.lzm
* -> /base/sbim.lzm
* -> /base/srv.lzm
* -> /base/usr.lzm
* -> /base/var.lzm
* -> /modules/milw0rm.lzm
* copying content of rootcopy directory
* copying liblinuzlive library to union
* creating /etc/fstab
* changing root directory...
linuxlive end, starting the Linux distribution
Usage: init 0123456SsQqAaBbCcUu
_(this is just the cursor flashing)
Thank you,
Kyle
 
Old 01-09-2009, 09:37 AM   #4
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Looks like wrong arguments are passed to init...
Please post your grub's menu.lst file

Last edited by Agrouf; 01-09-2009 at 09:39 AM.
 
Old 01-09-2009, 09:44 AM   #5
lifeforce4
Member
 
Registered: May 2003
Location: 2:16:840
Distribution: Slackware, CentOS, RedHat, Xubuntu
Posts: 169
Blog Entries: 1

Original Poster
Rep: Reputation: 32
Post

Quote:
Originally Posted by Agrouf View Post
Looks like wrong arguments are passed to init...
Please post your grub's menu.lst file
I basically just copied over the grub settings from the offensive-security site.

Code:
title BackTrack 3 Final on (/dev/sda7)
root (hd0,6)
kernel /boot/vmlinuz max_loop=255 initrd=initrd.gz init=linuxrc load_ramdisk=1 
    prompt_ramdisk=0 ramdisk_size=6666 root=/dev/ram0 rw
initrd /boot/initrd.gz
boot
Thank you,
Kyle
 
Old 01-09-2009, 09:53 AM   #6
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
I assume that linuxrc script must be calling init with wrong arguments...
Could you please unpack initrd.gz like this:
gzip -d < initrd.gz | cpio -i --make-directories
And could you please post the content of this linuxrc file please?
 
Old 01-09-2009, 10:10 AM   #7
lifeforce4
Member
 
Registered: May 2003
Location: 2:16:840
Distribution: Slackware, CentOS, RedHat, Xubuntu
Posts: 169
Blog Entries: 1

Original Poster
Rep: Reputation: 32
Question

Quote:
Originally Posted by Agrouf View Post
I assume that linuxrc script must be calling init with wrong arguments...
Could you please unpack initrd.gz like this:
gzip -d < initrd.gz | cpio -i --make-directories
And could you please post the content of this linuxrc file please?
When I tried the command "gzip -d < initrd.gz | cpio -i --make-directories" it creates a folder and file with weird characters. Also I cant seem to find the linuxrc file which is weird I updated locate and then did a search for it.

Thank you,
Kyle
 
Old 01-09-2009, 10:32 AM   #8
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Did you pick the right initrd.gz which is located in /boot in the /dev/sda7 partition?
If so, try this:
gzip -d initrd.gz
mkdir /mnt/initrd
mount -t ext -o loop initrd /mnt/initrd
Look for linuxrc in /mnt/initrd

Last edited by Agrouf; 01-09-2009 at 10:37 AM.
 
Old 01-09-2009, 10:36 AM   #9
lifeforce4
Member
 
Registered: May 2003
Location: 2:16:840
Distribution: Slackware, CentOS, RedHat, Xubuntu
Posts: 169
Blog Entries: 1

Original Poster
Rep: Reputation: 32
Thats correct, I mounted /dev/sda7 to /mnt/hd then went to /mnt/hd/boot/ where there was the initrd.gz file. I'll take a screen capture so you can see what it looks like all the files and how the names are. I'll add the link to the image in this post.

Thank you,
Kyle

http://img134.imageshack.us/my.php?i...file001sk9.png

I tried to mount the initrd but it was saying unknown filesystem type 'ext'. I'm using my slackware on the laptop to run these commands just to let you know its not a live cd.

Last edited by lifeforce4; 01-09-2009 at 10:48 AM. Reason: Added screen capture.
 
Old 01-09-2009, 10:43 AM   #10
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Sorry, I edited my post after you read it.
Please do this:
gzip -d initrd.gz
mkdir /mnt/initrd
mount -t ext -o loop initrd /mnt/initrd
Look for linuxrc in /mnt/initrd
 
Old 01-09-2009, 10:54 AM   #11
lifeforce4
Member
 
Registered: May 2003
Location: 2:16:840
Distribution: Slackware, CentOS, RedHat, Xubuntu
Posts: 169
Blog Entries: 1

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by Agrouf View Post
Sorry, I edited my post after you read it.
Please do this:
gzip -d initrd.gz
mkdir /mnt/initrd
mount -t ext -o loop initrd /mnt/initrd
Look for linuxrc in /mnt/initrd
Haha sorry about that I also edited mine after I saw you made changes to yours. I tried those commands but run in to the problem when trying to mount initrd. It says "mount: unknown filesystem type 'ext'" which i dont understand since my fs is all ext3.

Thank you,
Kyle
 
Old 01-09-2009, 11:00 AM   #12
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
try ext2 and ext3
 
Old 01-09-2009, 11:05 AM   #13
lifeforce4
Member
 
Registered: May 2003
Location: 2:16:840
Distribution: Slackware, CentOS, RedHat, Xubuntu
Posts: 169
Blog Entries: 1

Original Poster
Rep: Reputation: 32
Post

Quote:
Originally Posted by Agrouf View Post
try ext2 and ext3
I tried ext3 and it was not working but ext2 did. Anyway here is the linuxrc file in its full. There is a lot in here.
Code:
#!/bin/ash
# Initial script for Linux Live operating system
# Author: Tomas M <http://www.linux-live.org/>

export PATH=.:/:/usr/sbin:/usr/bin:/sbin:/bin

mount -n -t proc proc /proc
mount -n -t sysfs sysfs /sys
mount -n -o remount,rw /         # for the case we forgot rw boot option
ln -sf /proc/mounts /etc/mtab    # this allows us to use umount -a

. liblinuxlive # it requires proc to be mounted

header "starting Linux Live scripts <http://www.linux-live.org/>"

# Don't print kernel messages to konsole now.
# Syslog will reset printk settings, no need to remember it here anymore.
echo "0" >/proc/sys/kernel/printk

# Load essential drivers, like CDROM drivers, aufs/squashfs etc,
# use mdev to create /dev/ devices and setup it as a hotplug-handler
modprobe_essential_modules
mdev_start_hotplug

# /usr is compressed in initrd so it must be mounted from /usr.lzm
mount_initrd_loops

# Then load drivers for data storage and input devices
modprobe_usb_modules
modprobe_pcmcia_modules

debug_shell

# make sure ext3 partitions are not mounted using ext2 driver,
# and vfat partitions are not mounted using msdos driver
echo -e "ext3\next2\nvfat\n*" >/etc/filesystems

mkdir -p $UNION
mkdir -p $MEMORY

debug_shell

# Find livecd data directory
echolog "looking for data directory"

# First, try from= boot argument, if given
DATAFROM=$(cmdline_value from)

if [ "$DATAFROM" ]; then
   DATAFROM=$(find_in_computer $DATAFROM)
   if [ "$DATAFROM" ]; then
      mount_device $DATAFROM $LOOPMOUNT # mount again, it may be loop device
      if [ $? -eq 0 -a "$(find_modules $LOOPMOUNT/$LIVECDNAME)" != "" ]; then
         echolog "found in $DATAFROM"
         DATA=$LOOPMOUNT/$LIVECDNAME
      else
         fumount $LOOPMOUNT
         fumount $MOUNTDIR/*
      fi
   fi
fi

if [ "$DATA" = "" ]; then
   # from= is not used or it didn't contain valid data
   DATA=$(find_in_computer $LIVECDNAME/$LIVECDSGN)
   DATA=$(dirname $DATA 2>/dev/null)
fi

if [ "$DATA" = "" ]; then fatal \
"$LIVECDNAME data not found.
You are maybe using an unsupported boot device (eg. SCSI or old PCMCIA).
Workaround: Copy the directory $LIVECDNAME from your boot device to an IDE/SATA
disk, eg. to /mnt/hda1/$LIVECDNAME or C:\\$LIVECDNAME. Then try to boot again."
fi

echolog "using $LIVECDNAME data from $DATA"

debug_shell

echolog "setting up directory for changes"
CHANGESVAL=$(cmdline_value changes)

if [ "$CHANGESVAL" ]; then
   CHANGESMNT=$(find_in_computer $CHANGESVAL)
   echolog $CHANGESMNT
fi

debug_shell

mount_device "$CHANGESMNT" $MEMORY # removes $MEMORY if CHANGESMNT is wrong

# test if the filesystem is writable so changes can be stored to it
touch $MEMORY/empty 2>/dev/null && \
rm -f $MEMORY/empty 2>/dev/null

# if changes can't be mounted or the filesystem is not writable,
# fallback to the default: tmpfs
if [ $? -ne 0 ]; then
   echolog "changes not writable, using memory only"
   fumount $MEMORY
   mkdir -p $MEMORY # mount_device might removed it

   RAMSIZE=$(cmdline_value ramsize)
   if [ "$RAMSIZE" = "" ]; then RAMSIZE="60%"; fi
   mount -t tmpfs -o "size=$RAMSIZE" tmpfs $MEMORY
   XINO=$MEMORY
   mkdir -p $CHANGES
else
   # So it is writable, we will keep the filesystem mounted.
   # Check if it supports links and chmod.
   # If not, overmount CHANGES using posixovl
   echolog "testing the filesystem for posix compatibility"
   touch $MEMORY/.empty1 && \
   ln -sf $MEMORY/.empty1 $MEMORY/.empty2 2>/dev/null && \
   chmod +x $MEMORY/.empty1 2>/dev/null  && \
   test -x $MEMORY/.empty1 && \
   chmod -x $MEMORY/.empty1 2>/dev/null  && \
   test ! -x $MEMORY/.empty1 && \
   rm $MEMORY/.empty1 $MEMORY/.empty2 2>/dev/null

   if [ $? -ne 0 ]; then
      echolog "not compatible - starting posixovl"
      rm $MEMORY/.empty1 $MEMORY/.empty2 2>/dev/null
      mkdir -p $CHANGES
      posixovl -F $CHANGES
   fi
fi

# $UNION will be used as a root directory, livecd modules will be added soon
echolog "setup union directory (using aufs, with udba=none)"

debug_shell

mkdir -p $IMAGES

# store the xino file in memory in all cases, it's faster and safer
if [ "$XINO" != "$MEMORY" ]; then
   mkdir -p $XINO
   mount -n -t tmpfs tmpfs $XINO
fi

# mount aufs using the writable branch as the first one (leftmost/topmost)
mount -t aufs -o nowarn_perm,udba=none,xino=$XINO/.aufs.xino,br:$CHANGES=rw aufs $UNION
if [ $? -ne 0 ]; then fatal "can't setup union (aufs)"; fi

debug_shell

# If toram or copy2ram boot parameter is present, copy all fs modules to RAM.
# (skip modules from /optional/ which are not listed in load= boot option)
# Finaly modify DATA variable so it will point to correct directory
if [ "$(cmdline_parameter toram)" != "" -o "$(cmdline_parameter copy2ram)" != "" ]; then
   echolog "copying data to RAM, this may take some time..."
   mkdir -p $COPY2RAM

   # make sure it's in RAM even with changes= parameter
   if [ "$CHANGESMNT" ]; then mount -t tmpfs -o "size=$RAMSIZE" tmpfs $COPY2RAM; fi
   copy_to_ram $DATA $COPY2RAM

   cd_autoeject 1
   fumount $DATA
   fumount $MOUNTDIR/*
   rmdir $MOUNTDIR/* 2>/dev/null # mounted device names are empty, remove them
   DATA=$COPY2RAM
   cd_autoeject 0
fi

debug_shell

# DATA contains path to the base directory of all fs modules which need
# to be mounted and inserted into live filesystem. Do it now.
echolog "inserting all modules and creating live filesystem"
union_insert_modules $UNION $DATA $IMAGES

# the $MEMORY directory can contain $MEMORY/modules too
# in the case if changes= boot argument is used. If not, it doesn't hurt
union_insert_modules $UNION $MEMORY $IMAGES

debug_shell

echolog "copying content of rootcopy directory"
cp -af $DATA/rootcopy/* $UNION 2>/dev/null # may be empty
echolog "copying liblinuxlive library to union"
cp -af /liblinuxlive $UNION/usr/lib/
debug_shell

echolog "creating /etc/fstab"
echo -ne > $UNION/etc/fstab
fstab_update $UNION

# everything is ready now, so we may unload unused kernel modules
# and do some cleanup, unmount few things which are no longer needed.
rmmod_unused_modules
fumount /usr
fumount /sys

# More likely these directories aren't there.
# Even if they are, this won't hurt.
mkdir -p $UNION/boot
mkdir -p $UNION/proc
mkdir -p $UNION/sys
mkdir -p $UNION/dev
mkdir -p $UNION/tmp
chmod 0777 $UNION/tmp

# Boot will contain whatever was in ./boot directory in the bootable media
# Error output goes to null, as nothing is mounted with copy2ram
mount -n -o rbind $(dirname $DATA)/boot $UNION/boot 2>/dev/null

debug_shell

# Union contains all the files and directories unioned from all modules.
# Change root directory to it, and move initrd's root to /mnt/live/initramdisk
# Finaly execute /sbin/init to start the distribution.
echolog "changing root directory..."

cd $UNION
mkdir -p $INITRAMDISK

# Copy all dev files (found by mdev) to unioned dev directory
# so at least disk devices exist (your Linux may need them)
if [ ! -e /dev/console ]; then mknod /dev/console c 5 1; fi
cp -fdR /dev .

# find chroot and init
if [ -x bin/chroot ]; then  CHROOT=/bin/chroot; fi
if [ -x sbin/chroot ]; then  CHROOT=/sbin/chroot; fi
if [ -x usr/bin/chroot ]; then  CHROOT=/usr/bin/chroot; fi
if [ -x usr/sbin/chroot ]; then CHROOT=/usr/sbin/chroot; fi
if [ "$CHROOT" = "" ]; then fatal "Can't find executable chroot command"; fi
debug_shell

# Union contains all the files and directories unioned from all modules.
# Change root directory to it, and move initrd's root to /mnt/live/initramdisk
# Finaly execute /sbin/init to start the distribution.
echolog "changing root directory..."

cd $UNION
mkdir -p $INITRAMDISK

# Copy all dev files (found by mdev) to unioned dev directory
# so at least disk devices exist (your Linux may need them)
if [ ! -e /dev/console ]; then mknod /dev/console c 5 1; fi
cp -fdR /dev .

# find chroot and init
if [ -x bin/chroot ]; then  CHROOT=/bin/chroot; fi
if [ -x sbin/chroot ]; then  CHROOT=/sbin/chroot; fi
if [ -x usr/bin/chroot ]; then  CHROOT=/usr/bin/chroot; fi
if [ -x usr/sbin/chroot ]; then CHROOT=/usr/sbin/chroot; fi
if [ "$CHROOT" = "" ]; then fatal "Can't find executable chroot command"; fi

if [ -x bin/init ]; then INIT=bin/init; fi
if [ -x sbin/init ]; then INIT=sbin/init; fi
if [ "$INIT" = "" ]; then fatal "Can't find executable init command"; fi

# time to end Linux Live scripts and start the distribution itself,
# using /sbin/init or whatever was found.
header "linux live end, starting the Linux distribution"
mount -n -o remount,ro aufs .

# We will copy init from the distro to initrd (there should be 2MB free)
# This allows us to use the cleanup script during reboot, as init will be
# started from memory and not from the union and /union will not be busy.

cp -af $INIT /bin
if [ $? -eq 0 ]; then
   pivot_root . $INITRAMDISK
   exec $CHROOT . $INITRAMDISK/bin/init <dev/console >dev/console 2>&1
else # If copying fails, start init directly.
   pivot_root . $INITRAMDISK
   exec $CHROOT . $INIT <dev/console >dev/console 2>&1
fi

header "!!ERROR!!"
fatal "You are not supposed to be here, something went wrong!"
Thank you,
Kyle
 
Old 01-09-2009, 01:53 PM   #14
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Sorry for the late response.
I don't know which init it is trying to launch but something is weired.
Do you have an etc/inittab file in /mnt/initrd?
please try this:
add a runlevel in your linuxrc file:
add the '4' in both those 2 lines (at the end of the file):
exec $CHROOT . $INITRAMDISK/bin/init 4 <dev/console >dev/console 2>&1
exec $CHROOT . $INIT 4 <dev/console >dev/console 2>&1
then unmount the initrd:
umount /mnt/initrd
then gzip it:
gzip -9 initrd
and replace your initrd.gz with this one
and lastly try to boot.
Please report what it does.

Edit: forget it, read next post

Last edited by Agrouf; 01-09-2009 at 02:00 PM.
 
Old 01-09-2009, 01:59 PM   #15
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Quote:
Originally Posted by lifeforce4 View Post
title BackTrack 3 Final on (/dev/sda7)
root (hd0,6)
kernel /boot/vmlinuz max_loop=255 initrd=initrd.gz init=linuxrc load_ramdisk=1
prompt_ramdisk=0 ramdisk_size=6666 root=/dev/ram0 rw
initrd /boot/initrd.gz
boot
Hey! Wait a minute...
Did you put 2 lines for the kernel line?
Forget all what I told earlier!
You should only put one like this:
Quote:
title BackTrack 3 Final on (/dev/sda7)
root (hd0,6)
kernel /boot/vmlinuz max_loop=255 initrd=initrd.gz init=linuxrc load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=6666 root=/dev/ram0 rw
initrd /boot/initrd.gz
boot
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
backTrack3 and 2 juanfernando Linux - Wireless Networking 7 04-24-2009 11:10 PM
dual boot pclinuxos2007 with backtrack3 on laptop?MBR-MENU.LST newalien Linux - Newbie 2 09-04-2008 02:44 AM
LXer: Running Backtrack3 in VMware LXer Syndicated Linux News 0 08-17-2008 03:20 PM
ACPI woes, & xserver won't recognise touchpad on backtrack3 + eee pc. klauswunderlich Linux - Laptop and Netbook 1 05-07-2008 02:12 AM
Unable To Connect To Internet On Backtrack3 robyrulz Linux - Networking 3 01-07-2008 02:20 AM


All times are GMT -5. The time now is 04:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration