User:Az990tony/Customizing-SysRescCD-for-XS: Difference between revisions

From OLPC
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 14: Line 14:
The easiest way to do this is to perform "wget" for the iso file. I had to update my resolv.conf to a DNS nameserver I could access, and then do a wget for the URL involved.
The easiest way to do this is to perform "wget" for the iso file. I had to update my resolv.conf to a DNS nameserver I could access, and then do a wget for the URL involved.
The file is about 200MB and took me about 11 minutes to download on my system.
The file is about 200MB and took me about 11 minutes to download on my system.
The nameserver is provided by your ISP, and the URL for the SysRescCD could change
on sourceforge as new levels are made available, so this is just an example.


<tt>
<tt>
Line 19: Line 21:
'''[root ~]#''' wget -c http://downloads.sourceforge.net/systemrescuecd/systemerscuecd-x86-1.0.3.iso
'''[root ~]#''' wget -c http://downloads.sourceforge.net/systemrescuecd/systemerscuecd-x86-1.0.3.iso
... systemrescuecd-x86-1.0.3.iso saved...
... systemrescuecd-x86-1.0.3.iso saved...
'''[root ~]#''' cdrecord -scanbus
'''[root ~]#''' cdrecord dev=/dev/cdrom -v systemerscuecd-x86-1.0.3.iso
scsibus6:
6,0,0 600) 'ATAPI ' 'DVD A DH20A4H ' 'QP53' Removable CD-ROM
'''[root ~]#''' cdrecord dev=6,0,0 -v systemerscuecd-x86-1.0.3.iso
</tt>
</tt>


Line 29: Line 28:
Boot from the SysRescueCD you just made, and hit enter at the "boot: " command prompt.
Boot from the SysRescueCD you just made, and hit enter at the "boot: " command prompt.
We are basically going to open up the CD, and put all the files on our hard-drive.
We are basically going to open up the CD, and put all the files on our hard-drive.
I will use /dev/sda3 as an example.
I will use /dev/sda3 as the disk partition where all the files will be but, for example.


<tt>
<tt>
'''[root@sysresccd /root]%''' mount /dev/sda3 /mnt/custom
'''[root@sysresccd]%''' cd /root
'''[root@sysresccd /root]%''' /usr/sbin/sysresccd-custom extract
'''[root@sysresccd]%''' mount /dev/sda3 /mnt/custom
'''[root@sysresccd]%''' /usr/sbin/sysresccd-custom extract
/mnt/custom is mounted -> ok
/mnt/custom is mounted -> ok
there is enough estimated free space here (25548 MB) -> ok
there is enough estimated free space here (25548 MB) -> ok
docache not used -> ok
docache not used -> ok
'''[root@sysresccd /root]%''' cd /mnt/custom/customcd
'''[root@sysresccd]%''' cd /mnt/custom/customcd
'''[root@sysresccd ../customcd]%''' ls
'''[root@sysresccd]%''' ls
files isoroot
files isoroot
'''[root@sysresccd ../customcd]%''' cd isoroot
'''[root@sysresccd]%''' cd isoroot
'''[root@sysresccd ../isoroot]%''' ls
'''[root@sysresccd]%''' ls
'''bootdisk isolinux syslinux version'''
'''bootdisk isolinux syslinux version'''
'''[root@sysresccd ../isoroot]%''' cd isolinux
'''[root@sysresccd]%''' cd isolinux
'''[root@sysresccd ../isolinux]%''' ls
'''[root@sysresccd]%''' ls
altker32 f1boot.msg f4arun.msg f7net.msg isolinux.cfg memtest86
altker32 f1boot.msg f4arun.msg f7net.msg isolinux.cfg memtest86
altker64 f2images.msg f5troubl.msg initram.igz maps rescue64
altker64 f2images.msg f5troubl.msg initram.igz maps rescue64
Line 54: Line 54:


<tt>
<tt>
'''[root@sysresccd ../isolinux]%''' gunzip -c initram.igz > initram.img
'''[root@sysresccd]%''' cd /mnt/custom/customcd/isoroot/isolinux
'''[root@sysresccd ../isolinux]%''' mkdir work
'''[root@sysresccd]%''' gunzip -c initram.igz > initram.img
'''[root@sysresccd ../isolinux]%''' cd work
'''[root@sysresccd]%''' mkdir work
'''[root@sysresccd ../work]%''' cpio -id < ../initram.img
'''[root@sysresccd]%''' cd work
'''[root@sysresccd]%''' cpio -id < ../initram.img
36176 blocks'''
36176 blocks'''
'''[root@sysresccd ../work]%''' ls
'''[root@sysresccd ../work]%''' ls
bin dev etc init lib lib64 linuxrc proc sbin sys temp usr var'''
bin dev etc init lib lib64 linuxrc proc sbin sys temp usr var'''
</tt>
</tt>

Once everything is unpacked, you could remove the SysRescCD, reboot, and work on the files from the XS School Server or any other flavor of Linux. We will need the SysRescCD later to pack
all the files back into an ISO image.


== Create Additional Mount points ==
== Create Additional Mount points ==
Line 81: Line 85:
</tt>
</tt>



== Define Name Server ==

== Static IP networking configuration ==

Every Linux system seems to have its own way of assigning ethernet devices
to physical ports. The XS School Server has an eth0 for WAN connection to the
outside world, and eth1/eth2 for LAN connection to other computers and the
mesh antennae. However, the SysRescCD chose a different scheme.

On your XS School Server, look at /etc/sysconfig/network-scripts directory,
you will find ifcfg-eth0, ifcfg-eth1 and ifcfg-eth2 with the appropriate
hardware addresses, which are six sets of two characters each, such as
"00:01:f3:d3:c2:ed" which is called the MAC address of the specific hardware.

<tt>
'''[root@sysresccd /root]%''' cd /mnt/custom/customcd/isoroot
'''[root@sysresccd /root]%''' vi autorun0
'''[root@sysresccd /root]%''' cat autorun0
#!/bin/sh
ifconfig eth0 hw ether 00:AA:AA:AA:AA:ED up
ifconfig eth1 hw ether 00:BB:BB:BB:BB:DF up
ifconfig eth2 hw ether 00:CC:CC:CC:CC:EE up
ip address add eth0 192.168.0.77/24
ip route default via 192.168.0.1
</tt>


Normally, the nameserver is not pre-defined in the SysRescCD, so if you want to
Normally, the nameserver is not pre-defined in the SysRescCD, so if you want to
download RPM packages, you will either need to do a "net-config eth0" or update
download RPM packages, you will either need to do a "net-config eth0" or update
your /etc/resolv.conf file.
your /etc/resolv.conf file. The nameserver will be provided by your ISP provider,
for me it is 205.171.3.65, but it might be different for each country.


<tt>
<tt>
'''[root@sysresccd /root]%''' cd /mnt/custom/customcd/files/etc
'''[root@sysresccd /root]%''' cd /mnt/custom/customcd/files/etc
'''[root@sysresccd /mnt/../etc]%''' echo "nameserver 205.171.3.65" >> resolv.conf
'''[root@sysresccd /root]%''' vi resolv.conf
'''[root@sysresccd /root]%''' cat resolv.conf
# /etc/resolv.conf
domain random.xs.laptop.org
nameserver 205.171.3.65
</tt>
</tt>


== Make the MAC address values persistent ==
== Re-packing the sysrcd.dat file ==


Re-compressing the files into a single "sysrcd.dat" image is resource-intensive, so
Every Linux system seems to have its own way of assigning ethernet devices
I turn on my swap space on /dev/sda5.
to physical ports. The XS School Server has an eth0 for WAN connection to the
outside world, and eth1/eth2 for LAN connection to other computers and the
mesh antennae. However, the SysRescCD chose a different scheme. This can be
fixed by copying the "persistent rules" file from memory into the appropriate
subdirectory of our extracted set. In my case, the "xx:ed" will be eth0,
"xx:df" will be "eth1" and the "xx:ee" will be eth2.


<tt>
<tt>
[root] swapon /dev/sda5
[root@sysresccd /etc/udev/rules.d] % cat 70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.
# PCI device 0x10ec:0x8168 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1g:fc:1q:4f:ed",
ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:14:n1:19:76:df",
ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:14:s1:14:1e:ee",
ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
root@sysresccd /mnt/custom/customcd/files % cd etc/udev/rules.d
root@sysresccd /mnt/custom/customcd/files/etc/udev/rules.d % cp /etc/udev/rules.d/70-persistent-net.rules .
root@sysresccd /mnt/custom/customcd/files/etc/udev/rules.d % ls
05-udev-early.rules 64-device-mapper.rules
30-kernel-compat.rules 64-md-raid.rules
40-alsa.rules 65-permissions.rules
40-gentoo.rules 70-persistent-net.rules
40-video.rules 75-cd-aliases-generator.rules
50-udev-default.rules 75-persistent-net-generator.rules
60-cdrom_id.rules 80-drivers.rules
60-persistent-input.rules 90-hal.rules
60-persistent-storage.rules 90-network.rules
60-persistent-storage-tape.rules 95-udev-late.rules
61-persistent-storage-edd.rules 99-fuse.rules
root@sysresccd /mnt/custom/customcd/files/etc/udev/rules.d % vi 70-persistent-net.rules
root@sysresccd /mnt/custom/customcd/files/etc/udev/rules.d %
</tt>
</tt>

If you updated the "initram.igz", you will have to re-package that first.
follows:

<tt>
'''[root@sysresccd]%''' cd /mnt/custom/customcd/isoroot/isolinux
'''[root@sysresccd]%''' gunzip -c initram.igz > initram.img
'''[root@sysresccd]%''' mkdir work
'''[root@sysresccd]%''' cd work
'''[root@sysresccd]%''' cpio -id < ../initram.img
36176 blocks'''
'''[root@sysresccd ../work]%''' ls
bin dev etc init lib lib64 linuxrc proc sbin sys temp usr var'''
</tt>

<tt>
[root] /usr/sbin/sysresccd-custom squashfs
</tt>



== Building the ISO image file ==
== Building the ISO image file ==
Line 141: Line 159:


<tt>
<tt>

[root] swapon /dev/sda5
[root] /usr/sbin/sysresccd-custom squashfs
[root] /usr/sbin/sysresccd-custom isogen XS-SysRescCD
</tt>

== Burning the new XS-SysRescCD ==

We are now ready to burn the new ISO file to a CD. This can be done with any program you like, I will show how to do it with cdrecord. Don't forget to unmount and sync before shutting down.

<tt>
'''[root ~]#''' cd /mnt/custom/customcd/files/isofile
'''[root ~]#''' cdrecord dev=/dev/cdrom -v systemerscuecd-new.iso
'''[root ~]#''' cd /root
'''[root ~]#''' umount /mnt/custom
'''[root ~]#''' sync
</tt>
</tt>

Latest revision as of 13:57, 28 June 2008

Customizing SysRescCD for use with XS School Server

There are several things you can do to customize [| SysRescCD] for use with an XS School Server.

  • Configure the static IP addresses
  • Configure the ethernet ports to specific MAC addresses
  • Define userids to be used with SSHD
  • Have ssh public keys to allow remote administration
  • Include backup or rescue files

Download and Burn original SysRescCD

The easiest way to do this is to perform "wget" for the iso file. I had to update my resolv.conf to a DNS nameserver I could access, and then do a wget for the URL involved. The file is about 200MB and took me about 11 minutes to download on my system. The nameserver is provided by your ISP, and the URL for the SysRescCD could change on sourceforge as new levels are made available, so this is just an example.

[root ~]#  echo "nameserver 205.171.3.65" >> /etc/resolv.conf
[root ~]#  wget -c http://downloads.sourceforge.net/systemrescuecd/systemerscuecd-x86-1.0.3.iso
   ... systemrescuecd-x86-1.0.3.iso saved...
[root ~]#  cdrecord dev=/dev/cdrom -v systemerscuecd-x86-1.0.3.iso

Unpack the files

Boot from the SysRescueCD you just made, and hit enter at the "boot: " command prompt. We are basically going to open up the CD, and put all the files on our hard-drive. I will use /dev/sda3 as the disk partition where all the files will be but, for example.

[root@sysresccd]%  cd /root
[root@sysresccd]%  mount /dev/sda3 /mnt/custom
[root@sysresccd]%  /usr/sbin/sysresccd-custom extract
/mnt/custom is mounted -> ok
there is enough estimated free space here (25548 MB) -> ok
docache not used -> ok
[root@sysresccd]%  cd /mnt/custom/customcd
[root@sysresccd]%  ls
files  isoroot
[root@sysresccd]% cd isoroot
[root@sysresccd]% ls
bootdisk  isolinux  syslinux  version
[root@sysresccd]% cd isolinux
[root@sysresccd]% ls
altker32  f1boot.msg    f4arun.msg    f7net.msg     isolinux.cfg  memtest86
altker64  f2images.msg  f5troubl.msg  initram.igz   maps          rescue64
boot.cat  f3params.msg  f6pxe.msg     isolinux.bin  memdisk       rescuecd

If you will updating the "initram.igz", you will have to further unpack that as follows:

[root@sysresccd]% cd /mnt/custom/customcd/isoroot/isolinux
[root@sysresccd]% gunzip -c initram.igz > initram.img
[root@sysresccd]% mkdir work
[root@sysresccd]% cd work
[root@sysresccd]% cpio -id < ../initram.img
36176 blocks
 [root@sysresccd ../work]% ls
bin  dev  etc  init  lib  lib64  linuxrc  proc  sbin  sys  temp  usr  var

Once everything is unpacked, you could remove the SysRescCD, reboot, and work on the files from the XS School Server or any other flavor of Linux. We will need the SysRescCD later to pack all the files back into an ISO image.

Create Additional Mount points

SysRescCD comes with a few standard mount points, but I would like a few more.

[root@sysresccd ..customcd]% cd files
[root@sysresccd ..files]% ls
bin   dev  home  lib64  mnt  proc  sbin  tftpboot  usr
boot  etc  lib   media  opt  root  sys   tmp       var
[root@sysresccd ..files]]% cd mnt
[root@sysresccd ..mnt]% % ls
cdrom  floppy
[root@sysresccd ..mnt]% % mkdir boot fed deb usbkey scratch new old
[root@sysresccd ..mnt]% % ls
boot  cdrom  deb  fed  floppy  new  old  scratch  usbkey


Static IP networking configuration

Every Linux system seems to have its own way of assigning ethernet devices to physical ports. The XS School Server has an eth0 for WAN connection to the outside world, and eth1/eth2 for LAN connection to other computers and the mesh antennae. However, the SysRescCD chose a different scheme.

On your XS School Server, look at /etc/sysconfig/network-scripts directory, you will find ifcfg-eth0, ifcfg-eth1 and ifcfg-eth2 with the appropriate hardware addresses, which are six sets of two characters each, such as "00:01:f3:d3:c2:ed" which is called the MAC address of the specific hardware.

[root@sysresccd /root]% cd /mnt/custom/customcd/isoroot
[root@sysresccd /root]% vi autorun0
[root@sysresccd /root]% cat autorun0
#!/bin/sh
ifconfig eth0 hw ether 00:AA:AA:AA:AA:ED up
ifconfig eth1 hw ether 00:BB:BB:BB:BB:DF up
ifconfig eth2 hw ether 00:CC:CC:CC:CC:EE up
ip address add eth0 192.168.0.77/24 
ip route default via 192.168.0.1

Normally, the nameserver is not pre-defined in the SysRescCD, so if you want to download RPM packages, you will either need to do a "net-config eth0" or update your /etc/resolv.conf file. The nameserver will be provided by your ISP provider, for me it is 205.171.3.65, but it might be different for each country.

[root@sysresccd /root]% cd /mnt/custom/customcd/files/etc
[root@sysresccd /root]% vi resolv.conf
[root@sysresccd /root]% cat resolv.conf
# /etc/resolv.conf
domain random.xs.laptop.org
nameserver 205.171.3.65

Re-packing the sysrcd.dat file

Re-compressing the files into a single "sysrcd.dat" image is resource-intensive, so I turn on my swap space on /dev/sda5.

[root] swapon /dev/sda5

If you updated the "initram.igz", you will have to re-package that first. follows:

[root@sysresccd]% cd /mnt/custom/customcd/isoroot/isolinux
[root@sysresccd]% gunzip -c initram.igz > initram.img
[root@sysresccd]% mkdir work
[root@sysresccd]% cd work
[root@sysresccd]% cpio -id < ../initram.img
36176 blocks
 [root@sysresccd ../work]% ls
bin  dev  etc  init  lib  lib64  linuxrc  proc  sbin  sys  temp  usr  var

[root] /usr/sbin/sysresccd-custom squashfs


Building the ISO image file

We are now ready to burn the ISO image file. This can be memory intensive, re-compressing the data back into a single file, so I will turn on the swap partition.

[root] /usr/sbin/sysresccd-custom isogen XS-SysRescCD

Burning the new XS-SysRescCD

We are now ready to burn the new ISO file to a CD. This can be done with any program you like, I will show how to do it with cdrecord. Don't forget to unmount and sync before shutting down.

[root ~]#  cd /mnt/custom/customcd/files/isofile
[root ~]#  cdrecord dev=/dev/cdrom -v systemerscuecd-new.iso
[root ~]#  cd /root
[root ~]#  umount /mnt/custom
[root ~]#  sync