Download source:
2.6.18 centos kernel source code (kernel-devel-2.6.18-128.el5.centos.plus.i686.rpm)
http://rpm.pbone.net/index.php3/stat/4/idpl/12390365/com/kernel-devel-2.6.18-128.el5.centos.plus.i686.rpm.html
kernel module source code
http://www.nilfs.org/download/nilfs-2.0.12.tar.bz2
patch for Centos
http://www.nilfs.org/pub/centos/5/SRPMS/nilfs-kmod-2.0.12-r.src.rpm
userland utilities source code
http://www.nilfs.org/download/nilfs-utils-2.0.12.tar.bz2
Required packages:
gcc
yum install gcc
e2fsprogs-devel
yum install e2fsprogs-devel
default installed: make binutils
Installation Instructions:
I. use Centos rpm installer to unpackage the kernel source code
The source code will be in the directory :
/usr/src/kernels/2.6.18-128.1.6.el5-i686
2. untar the nilfs kernel module source code and userland utilities source code
kernel module is in the directory: nilfs-2.0.12
utilities is in the directory: nilfs-utils-2.0.12
3. uncompress the nilfs-kmod-2.0.12-r.src.rpm package and copy the patch file nilfs-rhel5-kern-feature.patch to the kernel module src directory nilfs-2.0.12
_______________________________________________________
--- a/fs/kern_feature.h 2008-02-12 08:38:22.000000000 -0000
+++ b/fs/kern_feature.h 2009-04-09 12:27:24.000000000 -0000
@@ -30,6 +30,25 @@
/*
* Please define as 0/1 here if you want to override
*/
+/* for Red Hat Enterprise Linux / CentOS 5.x */
+#if defined(RHEL_MAJOR) && (RHEL_MAJOR == 5)
+# define NEED_MOUNT_SEMAPHORE 1
+# define NEED_INODE_GENERIC_IP 0
+# define NEED_INODE_BLKSIZE 0
+# define HAVE_PAGE_MKWRITE 1
+# if (RHEL_MINOR < 1)
+# define PageChecked PageFsMisc
+# define SetPageChecked SetPageFsMisc
+# define ClearPageChecked ClearPageFsMisc
+# endif
+# if (RHEL_MINOR > 0)
+# define NEED_INC_NLINK 0
+# if (RHEL_MINOR > 2)
+# define NEED_DROP_NLINK 0
+# define HAVE_LE32_64_ADD_CPU 1
+# endif
+# endif
+#endif
/*
* defaults dependent to kernel versions
_______________________________________________________
4. apply the patch to the kernel module source code
root: ~> patch -p1 < nilfs-rehel-kern-feature.patch
5. compile the kernel module source code root: ~> make
root: ~> make install
6. compile the utils source code
root: ~> make
root: ~> make install
Userful resource:
http://www.nilfs.org/download/READMEv2
http://www.cyberciti.biz/faq/appy-patch-file-using-patch-command/
http://rpm.pbone.net/index.php3/stat/4/idpl/12390365/com/kernel-devel-2.6.18-128.el5.centos.plus.i686.rpm.html
http://www.nilfs.org/en/faq.html
http://www.nilfs.org/en/pkg_centos.html
Friday, May 1, 2009
Tuesday, April 21, 2009
NilFS: tutorial
Nilfs is a LFS that NTT(Nippon Telegraph and Telephone Corp.) Group distributed to the Linux world.
It has been merged into Linux mainline 2.6.30 rc-1
Below is the tutorial of how to set up a LFS partition in a VMware VM.
1. Attach multiple virtual disks to the VM in VMware
Editing virutal machine settings -> add -> add a hard disk
2. Install a CentOS5.1 distro in the VM and run the more than 260 updates
(It is said CentOS5.1/5.2 are both OK. But CentOS5.0 needs to be patched.)
root : centos

3. Download the NilFS kmod and utils rpms from nilfs.org site.
i386 utilities package: http://www.nilfs.org/pub/centos/5/RPMS/i386/
i386 kernel module package: http://www.nilfs.org/pub/centos/5/RPMS/i686/
Look for the nilfs utilities : nilfs-utils-2.0.12-1.i386.rpm
Look for the exact kernel version 2.8.18_128 : kmod-nilfs-2.0.12-2.2.6.18_128.1.6.el5.i686.rpm
the utilities and the kernel module version should match the same nilfs version and also the centos kernel version.
(It also includes PAE and Xen rpm packages in the same directory)
4. Install the NilFS rpm package
root: ~>rpm -Uvh kmod-nilfs-2.0.12-2.6.18_128.1.6.el5.i686.rpm
5. Format the virtual disk as nilFS and mount to the system.
(The extra disk is /dev/hda)
Format the disk by mkfs command
root: ~>mkfs -t nilfs2 /dev/hda
mount the LFS disk by mount command
root: ~>mount -t nilfs2 /dev/hda /root/nilfs

6. Use the nilFS to recover the data
Before you make some changes, you can set a checkpoint by mkcp
root: ~>mkcp
root: ~>lscp (lscp will show what checkpoints you have)

After you make the changes, you sjhould make the previous checkpoint to be a snapshot and then mount that previous snapshot to a new spot
root: ~>chcp ss 5
root: ~>mount -t nilfs2 -r -0 cp=5 /dev/hda /root/nilfs-cp
nilfs.org website instructions are at the link http://www.nilfs.org/en/about_nilfs.html (how to use nilfs --incomplete)

7. Umount nilFS disk
root: ~>umount /root/nilfs-cp
root: ~>umount /root/nilfs
Next --> Setup NilFS in a Xen Guest
Monday, January 19, 2009
gcc linking error
Sympton:
/usr/lib/gcc/i586-suse-linux/4.1.2/../../../../i586-suse-linux/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference in \
/tmp/ccox5xu2.o
/lib/libc.so.6: could not read symbols: Bad value
Diagnosis:
Link error
Analysis:
/usr/include/unistd.h includes features.h which is using errno.h
So errno.h should be included.
Solution:
(Final)
#include before #include
(Temporary)
gcc -include /usr/include/errno.h code.c
Reference:
/usr/lib/gcc/i586-suse-linux/4.1.2/../../../../i586-suse-linux/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference in \
/tmp/ccox5xu2.o
/lib/libc.so.6: could not read symbols: Bad value
Diagnosis:
Link error
Analysis:
/usr/include/unistd.h includes features.h which is using errno.h
So errno.h should be included.
Solution:
(Final)
#include
(Temporary)
gcc -include /usr/include/errno.h code.c
Reference:
http://www.robotercoding.com/blog/?p=36 http://blog.chinaunix.net/u1/36607/showart_313647.html
Lab build
Ubuntu Hardy 8.04 LTS
Sun java
sudo apt-get install sun-java6-jdk - For the JDK (Developer)
sudo apt-get install sun-java6-jre - For the JRE (User)
sudo update-alternatives --config java
Acrobat Reader 8
sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list
sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update
sudo apt-get install acroread
emacs
sudo apt-get install emacsx
smart-compile tag
/usr/share/emacs/site-lisp/smart-compile.el
Sun java
sudo apt-get install sun-java6-jdk - For the JDK (Developer)
sudo apt-get install sun-java6-jre - For the JRE (User)
sudo update-alternatives --config java
Acrobat Reader 8
sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list
sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update
sudo apt-get install acroread
emacs
sudo apt-get install emacsx
smart-compile tag
/usr/share/emacs/site-lisp/smart-compile.el
Sunday, May 25, 2008
Solaris xVM ---PV Linux domU
Solaris system is reinstalled and vanilla. Xen is working. But still something needs to do from the beginning.
# svccfg -s xvm/xend setprop config/vncpaswd = astring:\"passwd\"
# svccfg -s xvm/xend setprop config/vnc-listen=astring:\"0.0.0.0\"
# svcadm refresh xvm/xend; svcadm restart xvm/xend
To install virt-manager, download the package and use the following command:
#pkgadd -d. SUNWvirt-manager
The one thing I left undone yet is paravirtual Linux domU. Generally, we have three methods to create a PV Linux domU: virt-install, virt-manager, and xm create.
virt-manager is GUI installlation and supports Fedora well. It is network install.
virt-install is command-line style but works substantially in diverse ways: netinstall, isoinstall, cdrom, etc.
xm create is command-line style too but mainly work in iso or cdrom install, which required configuration file prehand.
First, virt-manager. Due to our specific box, only centos works and DNS in guest still doesn't work properly. So I use the path address: http://128.153.145.19/pub/centos/5/os/i386/
The screenshot for installation can be seen as below:
I am just waiting for its completion and when it restarts, it looks like this:
While it is installing, it can not probe the video card. Either the driver is not ported or the virt-manager is not complete yet.
Note: so far I have no idea of where virt-manager has stored the configuration file for the guest. As I know, in virt-manager log it did log the xml format guest configuration.
To boot the installed CentOS domU guest, you need the following configuration file
name="centosP"
#kernel="/var/lib/xen/virtinst-vmlinuz.UAktlH"
#ramdisk="/var/lib/xen/virtinst-initrd.img.XxNCk0"
disk=['file:/export/home/newbie/centosP.img,xvda,w']
memory=1024
vif=['']
root="/dev/xvda"
Note: virtinst-vmlinuz.UAktlH and virtinst-initrd.img.XxNCk0 are created by virt-manager and when booting the guest, those two lines should be removed. Grub in the image will take over and boot up the guest. BTW, xvda is required in disk option rather than 0,w]
Graphics doesn't work for Paravirtualization in Solaris yet. Also even using virt-manager, CentOS cannot detect properly the video card type, so only text mode network installation works, using a generic video driver. ParaVirtualization is still black-and-white world. Some drivers are missing and need to be ported but they are in progress and almost there.
When we tried virt-install and xm create. It cannot install from iso because cdrom is not paravirtual ported. In another word, we didn't have cdrom paravirtual drivers there. We can have the CentOS boot up, but it will keep asking you the CD-ROM device driver. When booting a Linux-made , XENBUS said block device driver, nic device driver, and the console missing. The details can be seen as below:

It is said that one way to circle around CDROM is to use NFS. But I am not familiy
- VNC configuration
- virt-manager
# svccfg -s xvm/xend setprop config/vncpaswd = astring:\"passwd\"
# svccfg -s xvm/xend setprop config/vnc-listen=astring:\"0.0.0.0\"
# svcadm refresh xvm/xend; svcadm restart xvm/xend
To install virt-manager, download the package and use the following command:
#pkgadd -d. SUNWvirt-manager
The one thing I left undone yet is paravirtual Linux domU. Generally, we have three methods to create a PV Linux domU: virt-install, virt-manager, and xm create.
virt-manager is GUI installlation and supports Fedora well. It is network install.
virt-install is command-line style but works substantially in diverse ways: netinstall, isoinstall, cdrom, etc.
xm create is command-line style too but mainly work in iso or cdrom install, which required configuration file prehand.
First, virt-manager. Due to our specific box, only centos works and DNS in guest still doesn't work properly. So I use the path address: http://128.153.145.19/pub/centos/5/os/i386/
The screenshot for installation can be seen as below:
I am just waiting for its completion and when it restarts, it looks like this:
While it is installing, it can not probe the video card. Either the driver is not ported or the virt-manager is not complete yet.Note: so far I have no idea of where virt-manager has stored the configuration file for the guest. As I know, in virt-manager log it did log the xml format guest configuration.
To boot the installed CentOS domU guest, you need the following configuration file
name="centosP"
#kernel="/var/lib/xen/virtinst-vmlinuz.UAktlH"
#ramdisk="/var/lib/xen/virtinst-initrd.img.XxNCk0"
disk=['file:/export/home/newbie/centosP.img,xvda,w']
memory=1024
vif=['']
root="/dev/xvda"
Note: virtinst-vmlinuz.UAktlH and virtinst-initrd.img.XxNCk0 are created by virt-manager and when booting the guest, those two lines should be removed. Grub in the image will take over and boot up the guest. BTW, xvda is required in disk option rather than 0,w]
Graphics doesn't work for Paravirtualization in Solaris yet. Also even using virt-manager, CentOS cannot detect properly the video card type, so only text mode network installation works, using a generic video driver. ParaVirtualization is still black-and-white world. Some drivers are missing and need to be ported but they are in progress and almost there.
When we tried virt-install and xm create. It cannot install from iso because cdrom is not paravirtual ported. In another word, we didn't have cdrom paravirtual drivers there. We can have the CentOS boot up, but it will keep asking you the CD-ROM device driver. When booting a Linux-made , XENBUS said block device driver, nic device driver, and the console missing. The details can be seen as below:

It is said that one way to circle around CDROM is to use NFS. But I am not familiy
Solaris DNS
After saving the files from the last broken solaris, I need to reinstall the Solaris again. But this time, I didn't get that luck so that everything was smoothy. The network is broken. I have dual network cards in that box. One plugin for external, and the other integrated for internal. It only gets an IP 10.0.0.x and cannot work on the external one. I bet the plugg-in network card is broken. So I hook the external cable to the integrated network card. It can get an external IP now, but the DNS server address 2.35 is wrong. It can browse google by 61.233.169.104. But it can not go any further with DNS broken.
Without network, Solaris is a lonely isolated island. Even the sky is grey.
The solaris is default using the facility NWAM to auto configure the network. I have tried to switch to GNOME network configuration tool, it doesn't work that well. So I have to research in NWAM and make it work right.
For more details you can check the pages:
http://opensolaris.org/os/project/nwam/
and
http://docs.sun.com/app/docs/doc/806-1386/6jam5ahnd?a=view
Generally speaking, most of the websites introduce the way to configure DNS in solaris is to modify the related configuration file: /etc/resolv.conf and /etc/nsswitch.conf.
/etc/resolv.conf is to specify the DNS server, search domain, etc.
sample:
search clarkson.edu
nameserver 128.153.128.2
nameserver 128.153.4.2
/etc/nsswitch.conf is to specify the resolution order. To resolve an address, it has many ways: files, dns, mdns, etc.
key part of a sample
hosts: files dns mdns
ipnodes: files dns mdns
Originally, hosts option only has files, we need to add dns and mdns after it to provide more resolution methods.
How does DNS work in Solaris?
When there is an web address to be resolved, the DNS client in solaris FIRST consults the /etc/nsswitch.conf file to see which to look into first. In this example, the presumed order is local file first, DNS server second.
THEN, if the DNS client consults the local file and does not find an entry, the client consults the /etc/resolv.conf file to look through the name resolution search list and the address of the local DNS server.
It seems that as long as we make these two configure files right, then it is done. However, Solaris doesn't work as Linux does. Linux working style is to modify the configuration, and then restart the service, then all will be good. Solaris style works differently. Everything is in framework. No manually modifying configuration files but there are always tools or facilities to provide consistent modification.
Once the facility nwam can obtain IP from DHCP server, then the DNS should also work properly now. But there is another problem for Clarkson Network. The DHCP server in Clarkson gives me the 2.35 which is not the DNS server at all(I also tried ubuntu, the same result). The key problem is that Clarkson has multiple DNS servers. If it can broadcast and collect all the DNS server responses, then 2.35 is not a problem any more.
Solaris has the facility mdnsd (multicast DNS daemon)but it doesn't automatically run after booting. It is to broadcast to discover the DNS servers.
To make it work, first /etc/nsswitch.conf should be modified to add mdns after hosts option.
Then, to start the service by the following command:
-----------------------------------------ADDON-----------------------------------------------------------------------------------
The network interfaces in Solaris is stored in the file /etc/nwam/llp (LLP)
# cat /etc/nwam/llp
bge0 dhcp
rge0 dhcp
The host name and domain is stored in the file /etc/hosts
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain solaris
Without network, Solaris is a lonely isolated island. Even the sky is grey.
The solaris is default using the facility NWAM to auto configure the network. I have tried to switch to GNOME network configuration tool, it doesn't work that well. So I have to research in NWAM and make it work right.
For more details you can check the pages:
http://opensolaris.org/os/project/nwam/
and
http://docs.sun.com/app/docs/doc/806-1386/6jam5ahnd?a=view
Generally speaking, most of the websites introduce the way to configure DNS in solaris is to modify the related configuration file: /etc/resolv.conf and /etc/nsswitch.conf.
/etc/resolv.conf is to specify the DNS server, search domain, etc.
sample:
search clarkson.edu
nameserver 128.153.128.2
nameserver 128.153.4.2
/etc/nsswitch.conf is to specify the resolution order. To resolve an address, it has many ways: files, dns, mdns, etc.
key part of a sample
hosts: files dns mdns
ipnodes: files dns mdns
Originally, hosts option only has files, we need to add dns and mdns after it to provide more resolution methods.
How does DNS work in Solaris?
When there is an web address to be resolved, the DNS client in solaris FIRST consults the /etc/nsswitch.conf file to see which to look into first. In this example, the presumed order is local file first, DNS server second.
THEN, if the DNS client consults the local file and does not find an entry, the client consults the /etc/resolv.conf file to look through the name resolution search list and the address of the local DNS server.
It seems that as long as we make these two configure files right, then it is done. However, Solaris doesn't work as Linux does. Linux working style is to modify the configuration, and then restart the service, then all will be good. Solaris style works differently. Everything is in framework. No manually modifying configuration files but there are always tools or facilities to provide consistent modification.
Once the facility nwam can obtain IP from DHCP server, then the DNS should also work properly now. But there is another problem for Clarkson Network. The DHCP server in Clarkson gives me the 2.35 which is not the DNS server at all(I also tried ubuntu, the same result). The key problem is that Clarkson has multiple DNS servers. If it can broadcast and collect all the DNS server responses, then 2.35 is not a problem any more.
Solaris has the facility mdnsd (multicast DNS daemon)but it doesn't automatically run after booting. It is to broadcast to discover the DNS servers.
To make it work, first /etc/nsswitch.conf should be modified to add mdns after hosts option.
Then, to start the service by the following command:
# svcadm enable svc:/network/mdns:defaultAs the DNS daemon will cache the file. So once the configuration is done, Solaris needs to REBOOT.
-----------------------------------------ADDON-----------------------------------------------------------------------------------
The network interfaces in Solaris is stored in the file /etc/nwam/llp (LLP)
# cat /etc/nwam/llp
bge0 dhcp
rge0 dhcp
The host name and domain is stored in the file /etc/hosts
# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain solaris
solaris broken
Solaris is broken again. Maybe it is because I can't wait till the system successfully shut down. So some system files are lost and I was asked to /lib/svc/bin/restore_repository.
But I can have the root console. The FS is read-only. I need to use the command below to change it to be read/write:
/lib/svc/method/fs-root
/lib/svc/method/fs-usr
For more details, you can check the page:
http://www.sun.com/msg/SMF-8000-MY
Now the situation is that I can execute some commands and I have some import files in my home directory, and I don't have network at all. How can I get those files out? The day without network is horribly dark~!
The system recommended to use fsck. I tried, but it doesn't help. It did can find some inconsistency but the Solaris seems to lose some system file.
I try to attach a USB drive to the box and hope it can recognize it. I use the command iostat as below to figure out if the disk can be recognized.
#iostat -En
It shows that the disk is there but it cannot recognize it as it appears as sda1 but not as c1d0...
Fortunately, that box has an The next that is worth trying is to burn those files into a CD. Then I checked the page
http://sysunconfig.net/unixtips/cdr.html
and
http://blogs.sun.com/reed/entry/how_to_burn_cd_dvd
sounds good.
I first package those files in the directory Desktop into ISO file, using the command as below:
Then I will burn it into the CD by the following configuration and the command:
1) first check the CD-RW device number
2)configure the CD-RW
create a file as /etc/default/cdrecord, inside are
3)burn the iso image into CD
Last strike is Live CD. First, I tried Ubuntu Live CD but it cannot recognize the FS. It requires UFS package. Then I have to try Solaris Live CD. Solaris Live CD has 2008.05 Live and installation CD, Benelix, and Schillix. I used 2008.05 release. It doesn't show the disk directly.
Still use the command iostat, you can see the disk is c5d0. Then use the mount command to mount it
---------------------------------------------------------ADDON---------------------------------------------------------------------------------------
Then reinstall the Solaris, it turned out that the network is broken. It kept get a wrong address as DNS server. The same to Ubuntu.
In Solaris, it has two styles to configure the network.
One is NWAM facility(automata network Management), the other is GNOME network configuration. You can use svc to alternate those two services.
For more details, man nwam or http://opensolaris.org/os/project/nwam/.
To see the services that are running, use
#svcs
To enable the default GNOME network configuration
But I can have the root console. The FS is read-only. I need to use the command below to change it to be read/write:
/lib/svc/method/fs-root
/lib/svc/method/fs-usr
For more details, you can check the page:
http://www.sun.com/msg/SMF-8000-MY
Now the situation is that I can execute some commands and I have some import files in my home directory, and I don't have network at all. How can I get those files out? The day without network is horribly dark~!
The system recommended to use fsck. I tried, but it doesn't help. It did can find some inconsistency but the Solaris seems to lose some system file.
I try to attach a USB drive to the box and hope it can recognize it. I use the command iostat as below to figure out if the disk can be recognized.
#iostat -En
It shows that the disk is there but it cannot recognize it as it appears as sda1 but not as c1d0...
Fortunately, that box has an The next that is worth trying is to burn those files into a CD. Then I checked the page
http://sysunconfig.net/unixtips/cdr.html
and
http://blogs.sun.com/reed/entry/how_to_burn_cd_dvd
sounds good.
I first package those files in the directory Desktop into ISO file, using the command as below:
# mkisofs -l -L -r -o /desk.iso /export/home/newbie/Desktop
Then I will burn it into the CD by the following configuration and the command:
1) first check the CD-RW device number
# cdrecord -scanbus1,0,0 is the device number
2)configure the CD-RW
create a file as /etc/default/cdrecord, inside are
CDR_FIFOSIZE=8m
CDR_SPEED=8
CDR_DEVICE=USCSI:1,0,0
3)burn the iso image into CD
# cdrecord -v /desk.isoBut it has burn error. Failed again.
Last strike is Live CD. First, I tried Ubuntu Live CD but it cannot recognize the FS. It requires UFS package. Then I have to try Solaris Live CD. Solaris Live CD has 2008.05 Live and installation CD, Benelix, and Schillix. I used 2008.05 release. It doesn't show the disk directly.
Still use the command iostat, you can see the disk is c5d0. Then use the mount command to mount it
# mount -F ufs /desk.iso /mntThen go to the directory /mnt, you can file there are three solaris directory there. Go to each one, there is one that is newbie's home directory. So move the ISO file into the home directory, and then copy the ISO from the home directory onto the LiveCD desktop. Then burn it into CD. It works finally.
---------------------------------------------------------ADDON---------------------------------------------------------------------------------------
Then reinstall the Solaris, it turned out that the network is broken. It kept get a wrong address as DNS server. The same to Ubuntu.
In Solaris, it has two styles to configure the network.
One is NWAM facility(automata network Management), the other is GNOME network configuration. You can use svc to alternate those two services.
For more details, man nwam or http://opensolaris.org/os/project/nwam/.
To see the services that are running, use
#svcs
To enable the default GNOME network configuration
% svcadm enable svc:/network/physical:defaultTo disable the Solaris Network auto-magic
% svcadm enable svc:/network/physical:nwamTo start the Solaris DNS server serivce
% /lib/svc/method/dns-server start|stop
Subscribe to:
Posts (Atom)
