[by Nugraha and Saito, 2009.05.09] Current status: Not finished yet. We suceeded dhcp and tftp initial files. Current problem: Error Kernel panic: not found /init during starting linux Current known problem: The original unix is 64bit but diskless machine is 32bit? We want to make a diskless computing system so that we need a PXE Server. PXE stands for "Pre-boot eXecution Environment". PXE is a special extension of services provided by the Dynamic Host Configuration Protocol (DHCP). It uses a Trivial File Transfer Protocol (TFTP) server to provide minimal boot to a network client. Let's try to configure it! #contents * Set a small subnet for testing PXE [#f0142583] **What we need [#pe839496] - A computer with linux operating system to be configured as a server. Here we use Fedora Linux. This computer should have at least two network interface cards (NIC). One of the cards will be used to connect the server with client. - Computer that acts as a client. For a checking purpose we need this computer to have SSH facility (it does not matter to use Windows or Linux). - Network hub and cables. **Checking [#r1faf503] ***Network setting [#j7b294ed] - Turn on the hub, connect a network cable from Fedora Linux computer (PXE server) to the hub (e.g. to channel 1). - Connect again a network cable from the client computer (Windows/Linux) to the hub (e.g. to channel 2). - Open Network configuration on Fedora Linux using root privilege. We should set network interface card that has been connected to the hub. - Assuming the network card is eth1, we set it to have: -- IP Address: 192.168.1.10 -- Subnet Mask: 255.255.255.0 - PXE server has a local IP address -- IP Address: 172.17.7.57 -- Subnet Mask: 255.255.252.0 - On the client computer, set the IP Address by statically to be: -- IP Address: 192.168.1.2 -- Subnet Mask: 255.255.255.0 - We adopt the Fedra machine which will be used as the original of diskless -- IP Address: 172.17.4.178 -- Subnet Mask: 255.255.252.0 ***SSH check [#tad4148a] - Open SSH software on client computer, for example, Putty or any command line software: ssh username@192.168.1.10 - If username is "nugraha" and hostname of server is "rsaito-necPC", we must get the following line after succesfully login: nugraha@rsaito-necPC:~$ it means that we can access the server from the client. * Setting for the original Linux machine from which we copy the system [#e9d2e315] - We use fedora 8 machine 172.17.4.178 for copying the system. - We need to install busy-anaconda in the 172.17.4.178 machine before copying the system 172.17.4.178:# yum install busybox-anaconda * Setting for the PXE server machine [#s4cd2a84] ** Install DHCP and TFTP Server etc [#s9d399d8] - Install dhcp, syslinux, tftp-server, nfs-utils, system-config-netboot(su root) # yum install dhcp # yum install syslinux # yum install tftp-server # yum install nfs-utils # yum install system-config-netboot - Check if the software is nicely installed # rpm -qa | grep syslinux syslinux-2.2.2.2.2 -- if you can see name + version, then ok. if not, yum install again. ** TFTP Configuration [#nfd5db55] - Edit /etc/xined/tftp of the PXE server machine # default: off # description: The tftp server serves files using the trivial file transfer \ # protocol. The tftp protocol is often used to boot diskless \ # workstations, download configuration files to network-aware printers, \ # and to start the installation process for some operating systems. service tftp { disable = no socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /tftpboot per_source = 11 cps = 100 2 flags = IPv4 } - (1) disable = no, and (2) server_args = -s /tftpboot should be changed. - possible troubles: (1) tftp does not work, (2) tftp does not find the files. - tftpd is running under the xinetd. We restart xinetd # service xinetd restart ** Copy system data for booting [#v32daf81] - We will make file systems under tftpboot f9. - root includes the system files which is read-only files - snapshot includes the other files which is read-write files. # mkdir /tftpboot/f9 # mkdir /tftpboot/f9/root # mkdir /tftpboot/f9/snapshot - rsync will be used for copying the files. # rsync -v -a -e ssh \ --exclude='/proc/*' --exclude='/sys/*' --exclude='/dev/*'\ --exclude='/media/*' --exclude='/tmp/*' --exclude='/misc/*'\ 172.17.4.178:/ /tftpboot/f9/root - 10GB files (10min) are needed. The file system will be used as nfs file. - When the original machine (172.17.4.178) is updated. We should do rsync again. - chcon command is needed for avoiding selinux security. # cd /tftpboot # chcon -R -t type . - the original type is XXX which selinux will be refused. - We are not sure but we use type = - We can check the file type by # ls -Z . ** DHCP Configuration [#b4fdd07c] - Edit /etc/dhcpd.conf. The following is a configuration for a network that uses: -- 192.168.1.0/255.255.255.0 addressing -- Dynamic address will be provided between 192.168.1.100 and 192.168.1.240 -- DHCP server (next server) at IP address 192.168.1.10 allow booting; allow bootp; ddns-update-style interim; ignore client-updates; subnet 192.168.1.0 netmask 255.255.255.0 { option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; range dynamic-bootp 192.168.1.100 192.168.1.240; next-server 192.168.1.10; } class "pxeclients" { match if substring(option vendor-class-identifier, 0, 9) = "PXEClient"; next-server 192.168.1.10; filename "/linux-install/pxelinux.0"; } -- Turn on dhcpd # /sbin/service dhcpd restart # chkconfig dhcpd on (the last line is for activating dhcp on booting process) -- Check if the dhcp server can work. --- Open a client computer which is connected to server --- Set the TCP/IP to dynamically set for IP address. --- Connect by ssh % putty username@192.168.1.10 ---If we can connect, it means DHCP has successfully been configured. % ipconfig -a --- Please keep Mac Address of the client PC In this case 00-21-70-c9-eb-60 (Dell PC). --- Mac address will be used in pxelinux.cfg directory. --- It should be noted that PXE will try to find 01-00-21-70-c9-eb-60 --- (01- should be added at the top) ** NFS configuration [#r08426e2] - NFS hosts is PXE server (192.168.1.10). - Edit /etc/exports [root@rsaito-necPC rsaito]# cat /etc/exports /tftpboot/f9/root 192.168.1.0/255.255.255.0(ro,sync,no_root_squash) /tftpboot/f9/snapshot 192.168.1.0/255.255.255.0(rw,sync,no_root_squash) -- file system is opened for 192.168.1.0 network. -- do not make a space before (ro etc. -- Start nfs # service nfs restart [root@rsaito-necPC etc]# cd /etc/rc5.d/ [root@rsaito-necPC rc5.d]# ./S60nfs restart Shutting down NFS mountd: [ OK ] Shutting down NFS daemon: [ OK ] Shutting down NFS quotas: [ OK ] Shutting down NFS services: [ OK ] Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS daemon: [ OK ] Starting NFS mountd: [ OK ] [root@rsaito-necPC rc5.d]# ./S60nfs status rpc.mountd (pid 12153) is running... nfsd (pid 12150 12149 12148 12147 12146 12145 12144 12143) is running... rpc.rquotad (pid 12138) is running... ** PXE server configuration [#nd1b2b49] - make files.custom in /tftpboot/f9/snapshot - in which we put /home/ for making /home directory [root@rsaito-necPC rc5.d]# cd /tftpboot/f9/snapshot/ [root@rsaito-necPC snapshot]# ls -l total 12 drwxrwxr-x 8 root root 4096 2009-05-09 08:57 255 -rw-r--r-- 1 root root 1070 2008-08-26 19:09 files -rw-r--r-- 1 root root 7 2009-05-09 08:52 files.custom [root@rsaito-necPC snapshot]# cat files.custom /home/ - files directory is made automatically by system-config-netboot - GNOME System - Administration - Server Setting - Network Booting Service -- push Diskless button for the first time -- then Diskless identifier windows starts Name f9-diskless Explanation Fedora core 9 -- NFS information server 192.168.1.10 directory /tftpboot/f9/root -- Select the kernel in the 2nd row as a newer Kernel -- New windows appear IP address/subnet 255.255.255.0 <- we use subnet operating system f9-diskless snapshot name 255 X generate -- then 255 directory is made. -- Probably the snapshot name should be IP dependent [root@rsaito-necPC 255]# pwd /tftpboot/f9/snapshot/255 [root@rsaito-necPC 255]# ls boot etc home lib root var -- Make a symbolic link for booting file --- FFFFFF00 (255.255.255.0) file is generated as above. # cd /tftpboot/linux-install/pxelinux.cfg # mv default default.org # ln -s FFFFFF00 01-00-21-70-c9-eb-60 --- when default exists, PXE client first try to read this. --- 00-21-70-c9-eb-60 is the MAC address of the PXE client (Dell PC) --- PXE try to read 01-00-21-70-c9-eb-60 the file first. -- An important thing is to put "01-" at the top of the name. --- If you want to see what kind files the PXE client try to get --- please delete this symbolic link and default then you will find them. -- edit FFFFFF00 default f9-diskless label f9-diskless kernel f9-diskless/vmlinuz append initrd=f9-diskless/initrd.img root=/dev/ram0 init=disklessrc NFSROOT=192.168.1.10:/tftpboot/f9 ramdisk_size=20318 ETHERNET=eth0 SNAPSHOT=255 ramdisk_blocksize=1024 --- add ramdisk_blocksize=1024 otherwise Kernel Panic occurs. --- in the present case, Kernel Panic occurs even if ramdisk_blocksize=1024 ** Edit initrd.img for NFS mount [#y864dbff] -- We just follow the instruction at http://www.atmarkit.co.jp/flinux/rensai/linuxtips/a021pxediskless.html --- However mount command does not work correctly http://www.devdrv.co.jp/linux/cpio-initrd-format.htm # cp /tftpboot/linux-install/f9-diskless/initrd.img /tmp # cd /tmp # zcat initrd.img > initrd.dat # mount -o loop initrd.dat /mnt # cp /sbin/mount.nfs /mnt/sbin/ # cp /sbin/umount.nfs /mnt/sbin/ # cp /sbin/mount.nfs4 /mnt/sbin/ # cp /sbin/umount.nfs4 /mnt/sbin/ # umount /mnt # gzip -c9 initrd.dat > initrd.img # cd /tftpboot/linux-install/FC6-PXE/ # mv initrd.img initrd.img.org # cp /tmp/initrd.img . -- /tftpboot/linux-install/f9-diskless/initrd.img is generated by --- system-config-netboot -- initrd.img is compressed and extracted by zcat to initrd.dat -- initrd.dat can be mounted as a loop device --- mount: you must specify the filesystem type error appears --- for a moment, we use the option -t ext3 -- once mounted, we can cp /sbin/mount.nfs etc. -- When cp are finished, the loop device is unmounted -- compressed again. -- then we will put initrd.img to the original position. ??????initrd???????? /boot/initrd-2.4.9 ?????????initrd??????????? # cd /boot # mkdir initrd-2.4.9 # cd initrd-2.4.9 # zcat ../initrd-2.4.9.img | cpio -i -c ??initrd???????? /boot/initrd-2.4.9 ???????????????initrd????????????? # cd /boot/initrd-2.4.9 # find . | cpio --quiet -c -o | gzip -c > ../initrd-2.4.9-new.img Last editted on 11/29/2004 * Set PXE client [#j2d1c71b] - Start BIOS and select BOOT - Select Network boot (no submenu exist) - Start PC, If you have PAUSE button the session can be stopped -- until the kernel is opend. ----- * Current problem of Kernel Panic [#ica8fb5c] -- init can not be found. ---- * The following is the statements which are evetually not used. [#j85b4ea0] -System boot will be put on /tftpboot and we need to copy the PXE boot image too. su - cd /tftpboot cp /usr/lib/syslinux/pxelinux.0 . -Create a minimal /tftpboot/pxelinux.cfg file DEFAULT pxeboot TIMEOUT 50 LABEL pxeboot KERNEL vmlinuz APPEND initrd=initrd.img ONERROR LOCALBOOT 0 -Turn on the tftp service: # /sbin/chkconfig tftp on -- The following is another sample dhcpd.conf by specifying MAC address # dhcpd.conf # common place for all use-host-decl-names on; host name and the host name in config file are the same default-lease-time 600; max-lease-time 7200; # # common for a subnet, we can make a group of host by "host", too subnet 192.168.197.0 netmask 255.255.255.0 { # range 204.254.239.10 204.254.239.20;? in the case of dynamic IP address option domain-name "dc2.kek.jp"; option broadcast-address 192.168.197.255; option routers 192.168.197.1; } # #host entities The following is how to set static IP address(bootp type) host n011 { since use-host-decl-names is on, we can use the host name hardware ethernet 00:D0:B7:1B:12:ED; MAC address fixed-address 192.168.197.31; static IP address for n011 option dhcp-class-identifier "PXEClient"; needed for PXE option next-server 192.168.197.11; specify for PXE server is provided by PXE Proxy DHCP server } # vendor-encapusulated option "next-server" can specify PXE server