RIP Notes
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
I gave root a password. (I cut and pasted the root entry from /etc/shadow.)
cp shadow shadow- grep root /etc/shadow >> shadow emacs shadow
I made /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.
cd etc chmod 755 rc.d/rc.sshd
I initialize serial ports by enabling /etc/rc.d/rc.serial
chmod 755 rc.d/rc.serial
I edit /etc/inittab to enable serial port login. I edit /etc/rc.d/rc.inet1.conf so that it will start DHCP at boot. I edit etc/issue so that I know what has been tweaked in this image when the system boots.
emacs inittab 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.cpz to a handy directory.
# mkdir tmp # cd tmp # 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 . -depth | bin/cpio -v -o -H newc | gzip -9 >../rootfs.cgz ^^^
Use the RIPLinuX cpio 'bin/cpio' here! The standard one won't work right.
Q & A from the official docs
Q. Is it possible to change something, or add shell scripts and/or packages to the system?
A. To remaster RIPLinuX and install an add-on package.
The add-on package must have a '.tgz' (tar/gzip) extension, and be packed for extraction/installation from '/' on the Linux system.
It can be a self-made, third-party, or Slackware package.
# mkdir /rip1 /rip2 # mount -o loop RIPLinuX-1.8.iso /rip1 # cp -a /rip1/* /rip2 # umount /rip1 ; rmdir /rip1 # mkdir /rip2/boot/1 # cd /rip2/boot/1 /rip2/boot/1# gzip -dc ../rootfs.cgz | cpio -iumdv /rip2/boot/1# sbin/installpkg -root . /path-to-package/package.tgz
Remove the old system.
/rip2/boot/1# rm ../rootfs.cgz
Then cpio/gzip the new system.
/rip2/boot/1# find . | bin/cpio -v -o -H newc | gzip -9 >../rootfs.cgz ^^^
"Use the RIPLinuX cpio 'bin/cpio' here!"
# rm -rf /rip2/boot/1 # mkdir /rip-iso # cd /rip2 /rip2# sh boot/mkiso.sh . /rip-iso rip.iso
Write /rip-iso/rip.iso to a CD!
You can now delete the /rip2 directory.
# rm -rf /rip2
Note: 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 'rootfs.cgz' is loaded into memory (which is freed after it's extracted), so it's best to keep it small.
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 pass this to the kernel 'rip_pkg=/dev/hdc,/boot/pkg,noprompt', you won't be prompted.
You can pass that to the kernel in /boot/isolinux/isolinux.cfg.
Q. Is it possible to replace the kernel?
The replacement kernel must have this support builtin.
CONFIG_SHMEM=y CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_INITRD=y CONFIG_ISO9660_FS=y CONFIG_EXT2_FS=y CONFIG_FAT_FS=y CONFIG_MSDOS_FS=y "MSDOS and/or VFAT for USB Flash drive access!" CONFIG_VFAT_FS=y CONFIG_PROC_FS=y CONFIG_TMPFS=y
A. # mkdir /rip1 /rip2
# mount -o loop RIPLinuX-1.8.iso /rip1 # cp -a /rip1/* /rip2 # umount /rip1 ; rmdir /rip1
Replace the kernel in the /rip2/boot directory.
Create and write /rip-iso/rip.iso to a CD as described above!
NOTE: If you want *initramfs* to use TMPFS instead of RAMFS, apply the patch "inittmpfs.diff" to the kernel source. http://www.tux.org/pub/people/kent-robotti/looplinux/rip
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.
You can resize a Windows XP NTFS partition, using 'ntfsresize'.
If you resize Windows you'll have room on your hard drive for Linux.
For example, you have a 120 GB Windows partition on /dev/hda1 and you want to resize it to 80 GB.
# ntfsresize -n -s 80000M /dev/hda1 "Resize to 80 GB! (test run)" # ntfsresize -s 80000M /dev/hda1 "Resize to 80 GB! (for real)"
# fdisk /dev/hda Command: d Command: n p "Primary partition!" Partition number: 1 First cylinder: "Press enter for default!" Last cylinder: +80000M Command: t Hex code: 7 Command: a Partition number: 1 Command: n p "Primary partition!" Partition number: 2 First cylinder: "Press enter for default!" Last cylinder: "Press enter for default!" Command: p Command: w "Write table to disk and exit, or q to Quit!"
You can use the shell script 'shrinkntfs' on RIPLinuX to do the above.
# shrinkntfs 80000 /dev/hda1
The above example would shrink an NTFS filesystem on /dev/hda1 to 80000 MegaBytes (80GB)!
After the NTFS filesystem is strunk by ntfsresize, fdisk is used to rewrite the partition table.
The shrinkntfs script is specifically for the case where you have an NTFS system using the whole hard drive, and you want to free up space for another operating system etc.
NOTE: The next time you boot Windows it will run 'chkdsk'!
NOTE: The script won't run if you have more than 3 partitions on
the specified hard drive!
Then you can use the 'mkpart' script to create a Linux partition.
# mkpart 83 20000 /dev/hda
The above example would create a type 83 (Linux) 20000 MegaBytes (20GB) primary partition on /dev/hda!
It will use the next available partition!
If you want it made active, add '-a' at the end!
# mkpart 83 20000 /dev/hda -a
You probably don't want the Linux partition to be made active!
To get a listing of partition types, do this!
# mkpart -t /dev/hda
NOTE: The script won't run if you have more than 2 partitions on the specified hard drive!
# mke2fs -j /dev/hda2 "Create ext3 filesystem on /dev/hda2, if that's the Linux partition!"
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 install a Slackware Linux distribution on a ext2, ext3, jfs, reiserfs, reiser4, or xfs formatted partition.
# setup "Read HELP!"
You need the Slackware ISO images 'slackware-10.2-install-d1.iso and slackware-10.2-install-d2.iso' on CD or DVD! You need at least 'slackware-10.2-install-d1.iso'!
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)".