On Fri, May 18, 2012 at 06:32:34PM +1000, Jason White wrote:
Colin Fee <tfeccles(a)gmail.com> wrote:
The question that arose was what about network
access? Do you have it? i.e.
is there a tcp/ip stack running and if not how would you load one etc?
What happens if you run ifconfig eth0 or a similar command?
I can't think of a good reason why you couldn't run ip, ifconfig, etc in that
i've done exactly that countless times so that i can do stuff like:
- run wget or whatever to fetch files from the net
- run an apt-get install or upgrade
- scp or rsync files in or out of the machine
- ssh in from a remote host
You might have to load the required kernel module if
udev isn't working.
also, the environment and console isn't set up quite right (e.g. ^C
wont kill an app) so you'll need to set it up with stty. and the rootfs
will be mounted read-only so you'll need to remount it RW in order to
make any changes, and you also get only one VT, so if you need more
you'll need to run them with openvt (aka "open", depending on version or
distro) or just run screen.
booting with 'init=/bin/bash' is useful in an emergency and still
occasionally neccessary, but these days i find it less hassle and more
useful to just pxeboot a rescue system (i tend to use clonezilla, it
makes an excellent command-line rescue system once you exit the cz
backup/restore menu) and mount the host's filesystem(s) under /mnt. and
'chroot /mnt' if necessary.
I have a gparted ISO available in my pxeboot menu too, in case i need to do
major partition shuffling/resizing etc, but I prefer to use clonezilla for
i also have cz configured on my pxeboot server so that it starts up sshd
and sets up a few useful things like the following alias in case i need
to do something like grub-install while in the chroot:
alias prepare-chroot-mnt='for i in proc dev sys ; do mount -o bind /$i /mnt/$i ;
BTW, it's possible to use memdisk from syslinux to boot clonezilla or
any other hd, floppy, or ISO image from the grub menu, so you can do
this without setting up a pxeboot server. i've used memdisk to boot up
freedos floppy images for BIOS updates etc.
and recent ipxe packages in debian can optionally add an ipxe entry to
the grub menu so you can still netboot in case you're not fast enough to
press F8 or F12 or whatever to get the BIOS boot selection menu. useful.
e.g. my grub boot menu on my main machine at home currently looks like
0 Debian GNU/Linux, with Linux 3.2.0-2-amd64
1 Debian GNU/Linux, with Linux 3.2.0-2-amd64 (recovery mode)
2 Debian GNU/Linux, with Linux 3.2.0-1-amd64
3 Debian GNU/Linux, with Linux 3.2.0-1-amd64 (recovery mode)
4 Network boot (iPXE)
5 Bootable floppy: LSI
6 Bootable floppy: freedos-bare
Default: 0 Debian GNU/Linux, with Linux 3.2.0-2-amd64
ps: for the OP - if you every wondered why grub has the option for
setting a password, then disabling the ability to edit the boot command
line is one of the main reasons...useful in, e.g., a computer lab at a
university, but anyone who has physical access to the machine can defeat
simple security measures like this.
craig sanders <cas(a)taz.net.au>
BOFH excuse #30:
positron router malfunction