Difference between revisions of "N3vlr-rootfs"
(→Installation) |
(→Installation) |
||
Line 114: | Line 114: | ||
#To use this mini rootfs, you must have the patch that includes the change of command ''line'' and the order cad.([http://jungla.dit.upm.es/~vnuml/download/no_official_patches/patch_v1 patch]) | #To use this mini rootfs, you must have the patch that includes the change of command ''line'' and the order cad.([http://jungla.dit.upm.es/~vnuml/download/no_official_patches/patch_v1 patch]) | ||
− | #Shell. You have to force the shell to be used by vnuml in the virtual machine to /bin/bash with: | + | #Shell. You have to force the shell to be used by vnuml in the virtual machine to /bin/bash with: ''<shell>/bin/sh</shell>'' |
− | |||
− | |||
#The directory of demons is ''usr/sbin/''. You can try this mini rootfs with these examples: | #The directory of demons is ''usr/sbin/''. You can try this mini rootfs with these examples: | ||
##Example-OSPF ([http://jungla.dit.upm.es/~vnuml/doc/examples/ospf_lab/n3vlr/ospf_lab.xml ospf_lab.xml], [http://jungla.dit.upm.es/~vnuml/doc/examples/ospf_lab/n3vlr/ospf_lab_tiny.xml ospf_lab_tiny.xml], [http://jungla.dit.upm.es/~vnuml/doc/examples/ospf_lab/1.7/ospf_lab_conf.tar ospf_lab_conf.tar]) | ##Example-OSPF ([http://jungla.dit.upm.es/~vnuml/doc/examples/ospf_lab/n3vlr/ospf_lab.xml ospf_lab.xml], [http://jungla.dit.upm.es/~vnuml/doc/examples/ospf_lab/n3vlr/ospf_lab_tiny.xml ospf_lab_tiny.xml], [http://jungla.dit.upm.es/~vnuml/doc/examples/ospf_lab/1.7/ospf_lab_conf.tar ospf_lab_conf.tar]) |
Revision as of 12:46, 8 November 2007
How to create a mini rootfilesystem starting from a N3VLR image
Installation
Download N3VLR image from http://www.n3network.ch/resources/n3vlr/n3vlr-0.11-uml.tar.bz2
Extract the rootfs image:
tar xvfj n3vlr-0.11-uml.tar.bz2
Copy the original rootfs image to a new file and mount it :
cp n3vlr-0.11-uml.img n3vlr-0.11-vnuml.img mount -o loop n3vlr-0.11-vnuml.img /mnt/
Create vnuml directories and umlboot link:
mkdir /mnt/mnt/vnuml mkdir /mnt/mnt/hostfs ln -s /mnt/vnuml/umlboot /mnt/etc/init.d/S40bootuml echo "/dev/ubdb /mnt/vnuml iso9660 defaults 0 0" >> /mnt/etc/fstab
Change the content of /mnt/etc/inittab to:
::sysinit:/etc/init.d/rcS tty0::respawn:/sbin/getty 38400 tty0 tty1::respawn:/sbin/getty 38400 tty1 tty2::respawn:/sbin/getty 38400 tty2 ::ctrlaltdel:/sbin/halt
Create the /dev/ubd[a-h] nodes using the makeUBDdev.sh script (see the complete script below taken from http://www.theshore.net/~caker/uml/)
cd /mnt/dev makeUBDdev.sh
Change root password:
chroot /mnt /bin/ash passwd root (set password to xxxx) exit
Edit the file /mnt/etc/ssh/sshd_config in order to make it work with ssh v1:
# What ports, IPs and protocols we listen for Port 22 Protocol 2,1 # HostKeys for protocol version 1 HostKey /etc/ssh/ssh_host_key # HostKeys for protocol version 2 HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key #Privilege Separation is turned on for security UsePrivilegeSeparation yes # Lifetime and size of ephemeral version 1 server key KeyRegenerationInterval 3600 ServerKeyBits 768 # Logging SyslogFacility AUTH LogLevel INFO # Authentication: LoginGraceTime 120 PermitRootLogin yes StrictModes yes RSAAuthentication yes PubkeyAuthentication yes # Don't read the user's ~/.rhosts and ~/.shosts files IgnoreRhosts yes # For this to work you will also need host keys in /etc/ssh_known_hosts RhostsRSAAuthentication no # similar for protocol version 2 HostbasedAuthentication no # To enable empty passwords, change to yes (NOT RECOMMENDED) PermitEmptyPasswords no # Change to yes to enable challenge-response passwords (beware issues with # some PAM modules and threads) ChallengeResponseAuthentication no X11Forwarding yes X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes #UseLogin no # Allow client to pass locale environment variables AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server UsePAM yes
Install bash shell in mini rootfs:
- Download from http://downloads.openwrt.org/kamikaze/7.09/x86-2.6/ the file openwrt-x86-2.6-ext2.fs and mount in ~/tmp ,for example.
- Download from http://downloads.openwrt.org/kamikaze/packages/i386/ the package bash_3.2-1_i386.ipk
- Do
chroot ~/tmp /bin/ash ipkg install bash_3.2-1_i386.ipk exit cp ~/tmp/bin/bash /mnt/bin/ cp ~/tmp/lib/libgcc_s.so.1 /mnt/lib umount ~/tmp
Change the content of /mnt/etc/passwd to:
root:$1$Yq7hudHO$r1rNwGNrK1470rWb5Qwu51:0:0:root:/tmp:/bin/bash nobody:*:65534:65534:nobody:/var:/bin/false sshd:x:99:99:sshd:/var/empty/.sshd:/bin/false quagga:x:100:100:quagga:/var/empty/.quagga:/bin/false
Unmount the filesystem:
umount /mnt
Notes:
- To use this mini rootfs, you must have the patch that includes the change of command line and the order cad.(patch)
- Shell. You have to force the shell to be used by vnuml in the virtual machine to /bin/bash with: <shell>/bin/sh</shell>
- The directory of demons is usr/sbin/. You can try this mini rootfs with these examples:
- Example-OSPF (ospf_lab.xml, ospf_lab_tiny.xml, ospf_lab_conf.tar)
makeUBDdev.sh script
#!/bin/bash device=ubd major=98 minor=0 for u in a b c d e f g h do dev=$device$u mknod $dev b $major $minor chmod 660 $dev chgrp disk $dev for i in $(seq 1 15) do mknod $dev$i b $major $(($minor + $i)) chmod 660 $dev$i chgrp disk $dev$i done minor=$(($minor + 16)) done