RIP Notes: Difference between revisions
Brian Wilson (talk | contribs) |
Brian Wilson (talk | contribs) mNo edit summary |
||
Line 35: | Line 35: | ||
Give root a password. (I cut and pasted the root entry from /etc/shadow.) | Give root a password. (I cut and pasted the root entry from /etc/shadow.) | ||
mv shadow shadow- | |||
grep root /etc/shadow >> shadow | grep root /etc/shadow > shadow | ||
cat shadow- >> shadow | |||
emacs shadow | emacs shadow | ||
Latest revision as of 18:40, 1 July 2006
RIP is a small rescue system that can reside on a Live CD. I am playing with using it via PXEboot.
RIP is based on Slackware. Slackware archive
What it is
Unpacking the PXE archive, one finds everything needed to drop into the /var/lib/tftpboot directory. There is a 2.6 series kernel and a big fat file called rootfs.cpz.
The rootfs file is a gzip compressed cpio archive image of a root filesystem.
Customizing RIP
I like the basic package but wanted a few things turned on at boot so that I could get remote access more easily.
Compression note
The kernel and programs on the system are compressed with UPX v2.00. If you want, you can uncompress a program like this 'upx -d program'.
You can get UPX here http://upx.sourceforge.net; I installed it from the Ubuntu package.
Unpacking the root filesystem
cd /home/diskless/tftpboot mkdir root; cd root gzip -dc ../rootfs.cgz | cpio -iumdv
Make your changes
cd etc
Give root a password. (I cut and pasted the root entry from /etc/shadow.)
mv shadow shadow- grep root /etc/shadow > shadow cat shadow- >> shadow emacs shadow
Make /etc/rc.d/rc.sshd executable so that it would start at boot.
Apparently that's how Slackware does things; it executes every script in /etc/rc.d, in order. So if a script is not executable it will be skipped.
chmod 755 rc.d/rc.sshd
Tell system to initialize serial ports by enabling /etc/rc.d/rc.serial
chmod 755 rc.d/rc.serial
Edit /etc/inittab and /etc/securetty to enable serial port login. Edit /etc/rc.d/rc.inet1.conf so that it will start DHCP at boot. Edit /etc/issue so that I know what has been tweaked in this image when the system boots.
emacs inittab securetty rc.d/rc.inet1.conf issue
No X
I have no interest in having X-window clogging up on my rescue image but the author provides the PXE image only with X. So first task is to try using the "No X" ISO to create a PXE image.
I downloaded the CDROM image and loopback mounted it.
# mount -o loop RIPLinux-1.8.iso /mnt
Then I unpacked and copied the contents of its rootfs.cgz to a handy directory.
# mkdir root & cd root # gzip -dc /mnt/boot/rootfs.cgz | cpio -iumdv
Now that I have a copy of the root filesystem without X, I can apply the same patches as above and build a new image that is one half the size... the new image is 30 MB versus 60+; X is big!
Building a new image
find . | bin/cpio -v -o -H newc | gzip -9 >../rootfs.cgz ^^^
Use the RIPLinuX cpio 'bin/cpio' here! The standard one won't work right.
Cribbed from the README files
Adding a package to RIP
Slackware 'packages' are just gzipped tar files.
The add-on package must have a '.tgz' (tar/gzip) extension, and be packed for extraction/installation from '/' on the Linux system.
cd /var/lib/tftpboot/root sbin/installpkg -root . /path-to-package/package.tgz
You can also have the add-on package(s) on any media and install it after the system boots. This is probably the best way to do it, because the file 'rootfs.cgz' is loaded into memory and then unpacked so both the rootfs.cgz file nad the extracted filesystem have to fit into RAM at the same time. Once the boot extract process is complete the memory used up by boot.cgz is freed.
You could put the add-on package(s) in /boot/pkg on the RIPLinuX CD, or any media.
If you pass this to the kernel 'rip_pkg=/dev/hdc,/boot/pkg', when the system boots it will mount /dev/hdc and prompt you to install any *.tgz packages it finds in /boot/pkg.
If you append "noprompt" eg 'rip_pkg=/dev/hdc,/boot/pkg,noprompt', you won't be prompted, the packages will be automatically installed.
For PXEboot, the file /var/lib/tftpboot/pxelinux.cfg/default contains kernel options.
Q. Is it possible to install the system on my hard drive?
A. You need to create a Linux partition using 'fdisk' etc., the you need to put a ext3 etc. filesystem on it, then you need to mount the partition and extract 'rootfs.cgz' to it.
This example assumes you created a Linux partition on /dev/hda2, with a ext3 filesystem.
Mount the RIPLinux CD or ISO image that has /boot/rootfs.cgz on it.
# mount -rt iso9660 /dev/hdd /mnt/cdrom "Mount CD!" # mount -o loop RIPLinuX-1.8.iso /mnt/cdrom "Mount ISO image!" # mount -t ext3 /dev/hda2 /mnt/linux # cd /mnt/linux /mnt/linux# gzip -dc /mnt/cdrom/boot/rootfs.cgz | cpio -iumdv # cp /mnt/cdrom/boot/kernel /mnt/linux/boot
Add this line to the top of the /mnt/linux/etc/fstab file.
/dev/hda2 / ext3 defaults 1 1
# rm /mnt/linux/init "Remove /init link!!!"
You'll need to use GRUB etc. to boot it.
From the RIPLinuX CD ISOLinux menu, you could do this to boot the Linux partition on /dev/hda2.
Choose GRUB from the menu.
Press the `c' key to get a command prompt.
grub> root (hd0,1) grub> kernel /boot/kernel root=/dev/hda2 ro grub> boot
NOTE: You can use the Linux system on the RIPLinuX CD to create the Linux partition, and extract rootfs.cgz to it.
NOTE: RIPLinuX is based on Slackware and you can install packages from Slackware 10.2 or later. Only use /sbin/installpkg on RIPLinuX to install Slackware packages 'installpkg package_name.tgz'.
You can also install Slackware from a partition on your hard drive that has the directories (a, ap, etc.) with the Slackware tgz packages, or over NFS. It's basically the same as standard Slackware setup!
The filesystem on the partition can be any the kernel supports, at least read-only!
Slackware doesn't currently support reiser4, if you want to install Slackware on a reiser4 partition you'll have to use the RIPLinuX kernel to boot it. When asked by setup for a kernel to install choose "rip_cdrom (Use the kernel from the RIPLinuX CD)".