Skip navigation

Monthly Archives: August 2006

I have installed the following OS on my PC of following configuration.

Hardware: PIII-800MHz/192MB/20GB/Intel 82815 Video
OS: Ubuntu 6.06 / Suse 10.1 / Fedora 5 / Debian 3.1

I have installed all these OS, with mostly same configuration (2.6 kernel/ GNOME interface, services…). I have not done any tweak. Here is my observation with ranking. This ranking is based on performance on my PC only.
Rank 4. Suse 10.1:
Installation – slow, Eye candy desktop, Monitor not recognized properly.
After installation – Very slow desktop
Rank 3. Fedora Core 5:
Installation – dead slow, wonderful X configuration
After installation no X, due to issue in locale setting
Rank 2: Debian 3.1:
Installation: Easy and fast first phase installation, second phase installtion after reboot failed (but managed with apt-get manually, package selection interface is not user friendly
After installation – Cool, wide range of applications
Rank 1: Ubuntu 6.06:
Installation: crashing but managed through command line (using fdisk, mkswap and swapon), installation speed is normal
After installation – Fast, Cool, eyecandy, high performance.

Moral: Good installation method does not mean good desktop performance. Ubuntu wins!


Day 3: 1st Aug 2006, evening (Tue):

Powered on PC and chroot-ed into LFS filesystem again. glibc compilation, time zone settings, etc. are being done. This time i am more comfortable. But tar command is not working in chroot-ed environment. I think I have done some mistake. But no problem, I extracted the bzipped tar files from host (Slackware 10.1) environment and compiled from chroot-ed environment. 🙂 🙂 happy to manage this kind of issues.

Day 4: 05th Aug 2006 (Sat):

The whole day I spent on LFS with lovely interruption from my cute child udhaya. Hope she is the reason for motivation behind finishing this LFS installation on this day. Yes, I have finished LFS installation successfully on this weekend. It took 4 days (3 weekdays + 1 weekend) for me to install the complete LFS system. I don’t find word to express my joy when I got the login prompt and shell prompt once the system is booted. It is too wonderful to see something working (though I have not written any code, I have just followed a printed document and did what it said..) with my effort of creating my own compilation of all codes, configuration files, creating directory hierarchies, etc. I have learned a lot of things behind developing a distribution. Some of the things are complicated than what I assumed and some of the things are in reverse. Just I was dancing and singing with run on every corner of house.

Tips for everyone who wish to go for LFS:

1. Though I have just followed what has been documented, at some point of installation I was diverted from guide. Some of the command like tar, clear, patch were not working from chroot-ed environment. But I managed those stuff from host environment. So don’t get annoyed at any circumstances. Try to solve it yourself by finding other options.

2. I got a lot of error while running test suites of gcc and glibc, but I continued with. But everything worked fine after installation. So need not worry about test suites errors until otherwise it is show stopper issue for you in proceeding with installation.

3. It is very difficult to finish the complete installation in single shot. Better plan for phases of installation.

The top moral is need to have a lot of patience to proceed with installation. But the end result will be as I have already told, dancing and singing……!

LFS Registration ID: 17603
Name: KaruppuSwamy.T
First LFS Version: 6.1


When there is a definitive guide to learn Linux system programming, it is heaven to read and practice those examples. Some times we may need to implement some function which is available in the well known tools (or commercial tools), but we may not know which system call to use to accomplish some of the tasks. I too faced such problems. Then I found that strace is handy command for this purpose. This is very much useful for debugging purpose.

How to use it?

strace -o <trace file name> <your command> <arguments of command if any>

For example if I want to trace what system calls are used by fdisk while I am listing all partitions in my system (fdisk -l), here is the command with strace feature:

# strace -o fdisk-trace.log fdisk -l

Here is the output on console:

Disk /dev/hda: 20.5 GB, 20547841536 bytes
255 heads, 63 sectors/track, 2498 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 2368 18916537+ 83 Linux
/dev/hda3 2369 2498 1044225 82 Linux swap

Here is the fdisk-trace.log file which lists all system calls called by fdisk with argument and return values.:

execve(“/sbin/fdisk”, [“/sbin/fdisk”, “-l”], [/* 26 vars */]) = 0
uname({sys=”Linux”, node=””, …}) = 0
brk(0) = 0x805ff48
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40016000
open(“/etc/”, O_RDONLY) = -1 ENOENT (No such file or directory)
open(“/etc/”, O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=75477, …}) = 0
old_mmap(NULL, 75477, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40017000
close(3) = 0
open(“/lib/tls/”, O_RDONLY) = 3
read(3, “\177ELF\1\1\1\3\3\1`V\1B4″…, 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1531064, …}) = 0
old_mmap(0x42000000, 1257224, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x42000000
old_mmap(0x4212e000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x12e000) = 0x4212e000
old_mmap(0x42131000, 7944, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x42131000
close(3) = 0
set_thread_area({entry_number:-1 -> 6, base_addr:0x40016a20, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
munmap(0x40017000, 75477) = 0
brk(0) = 0x805ff48
brk(0x8060f48) = 0x8060f48
brk(0) = 0x8060f48
brk(0x8061000) = 0x8061000
open(“/usr/lib/locale/locale-archive”, O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=30301680, …}) = 0
mmap2(NULL, 2097152, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40017000
close(3) = 0
open(“/proc/partitions”, O_RDONLY|O_LARGEFILE) = 3

🙂 It accesses /proc/partitions pseudo file for partition information.

read(3, “major minor #blocks name r”…, 32768) = 412
open(“/proc/ide/hda/media”, O_RDONLY|O_LARGEFILE) = 4

🙂 It accesses /proc/ide/hda/media for type of storage device. This /proc/ide/hda has more harddisk related description and settings details.

fstat64(4, {st_mode=S_IFREG|0444, st_size=0, …}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40217000
read(4, “disk\n”, 4096) = 5
close(4) = 0
munmap(0x40217000, 4096) = 0
open(“/dev/hda”, O_RDONLY|O_LARGEFILE) = 4
open(“/dev/hda”, O_RDONLY|O_LARGEFILE) = 5

🙂 It opens /dev/hda and gets the handle.

read(5, “\353H\220lbaLILO\1\25\4Z\vW4=\3640\300\1″…, 512) = 512
uname({sys=”Linux”, node=””, …}) = 0
ioctl(5, BLKSSZGET, 0xbfff73e4) = 0
fstat64(5, {st_mode=S_IFBLK|0660, st_rdev=makedev(3, 0), …}) = 0
ioctl(5, 0x301, 0xbfff73e0) = 0
ioctl(5, BLKGETSIZE, 0xbfff7408) = 0

🙂 Handle of /dev/hda used to call ioctl implemented by /dev/hda driver. The IOCTL code BLKSSZGET gets the size of a block

_llseek(5, 0, [0], SEEK_SET) = 0
read(5, “\353H\220lbaLILO\1\25\4Z\vW4=\3640\300\1″…, 8192) = 8192
close(5) = 0
open(“/usr/share/locale/locale.alias”, O_RDONLY) = 5
fstat64(5, {st_mode=S_IFREG|0644, st_size=2601, …}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40217000
read(5, “# Locale name alias data base.\n#”…, 4096) = 2601
brk(0) = 0x8061000
brk(0x8062000) = 0x8062000
read(5, “”, 4096) = 0
close(5) = 0
munmap(0x40217000, 4096) = 0
open(“/usr/share/locale/en_US.UTF-8/LC_MESSAGES/”, O_RDONLY) = -1 ENOENT (No such file or directory)
open(“/usr/share/locale/en_US.utf8/LC_MESSAGES/”, O_RDONLY) = -1 ENOENT (No such file or directory)
open(“/usr/share/locale/en_US/LC_MESSAGES/”, O_RDONLY) = -1 ENOENT (No such file or directory)
open(“/usr/share/locale/en.UTF-8/LC_MESSAGES/”, O_RDONLY) = -1 ENOENT (No such file or directory)
open(“/usr/share/locale/en.utf8/LC_MESSAGES/”, O_RDONLY) = -1 ENOENT (No such file or directory)
open(“/usr/share/locale/en/LC_MESSAGES/”, O_RDONLY) = -1 ENOENT (No such file or directory)
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), …}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40217000
write(1, “\n”, 1) = 1
write(1, “Disk /dev/hda: 20.5 GB, 20547841″…, 42) = 42
write(1, “255 heads, 63 sectors/track, 249″…, 44) = 44
write(1, “Units = cylinders of 16065 * 512″…, 50) = 50
write(1, ” Device Boot Start En”…, 57) = 57
open(“/usr/lib/gconv/gconv-modules.cache”, O_RDONLY) = 5
fstat64(5, {st_mode=S_IFREG|0644, st_size=21040, …}) = 0
mmap2(NULL, 21040, PROT_READ, MAP_SHARED, 5, 0) = 0x40218000
close(5) = 0
write(1, “/dev/hda1 * 1 1″…, 56) = 56
write(1, “/dev/hda2 14 236″…, 56) = 56
write(1, “/dev/hda3 2369 249″…, 61) = 61
read(3, “”, 32768) = 0
close(3) = 0
munmap(0x40217000, 4096) = 0
exit_group(0) = ?


I hope this information will sure be helpful to those who don’t know such a nice feature exists in Linux command line.

My LFS History: you are entitled to skip 🙂

This is my long time wish to install a Linux system from scratch. One year before I had downloaded Linux From Scratch (LFS) – Live CD 6.1. I prepared a hard-copy of installation manual. With a lot of enthusiasm I sat in front of my computer. I booted the system with this live-cd and start installing by reading the manual. After 2 hours, I found that LFS installation is not like most other distros, to start installation and finish in a few minutes or hours. Looking at the volume of pages on manual and packages to install, I decided to give up my attempt to install it. But I took it as ego.. keep on thinking of it. I my last two years experience, I have matured to an extent of liking and using Gentoo 2005 and Slackware 10.1 (It does not mean that other distros are bad, I **mean** I am comfortable with this kind of not much user-friendly systems. At the same time I have a nice easier Ubuntu Dapper 6.06, especially for my wife, and me too).

Recently I bought a PIII/192MB used system. I was browsing my CD collection, and decided to install Gentoo 2005. I was comfortable in installation and usage. Then I installed Slackware 10.1 also (nice distro to tweak, not bloated – simply superb distro.) Both these I installed many times in a week and able to get some more knowledge on linux.

Day 1: 30th July 2006 (Sun):

On this good day evening, LFS flashed in my mind. Suddenly I took printed manual and browsed a few pages and came to know that having a stable, good, no-gui system as development system for LFS is a better idea than using Live CD. So, I reinstalled my Slackware 10.1 as complete development system. I planned to spend 2 to 3 hours of everyday evening on LFS installation. This first day I installed Slackware 10.1 as pure development system with mpg123 as add-on. I though of playing songs while long compilation running (it worked out well too).

I created a partition as per LFS manual. Mounted on my slackware /mnt directory. The installation was started peacefully and with more enthusiasm. When I come to gcc-build stage, compilation failed. It said there is no blah-blah-blah header files not found…. I know very well that I have followed the steps at most care. But I know somewhere I have done mistake. How to find it out? There is no internet at home to seek help. It was midnight then. What to do? Just slept with happier heart of doing some thing useful instead of just looking at GNOME/KDE kind of stuffs and GUI applications.

Day 2: 31st July 2006 (Mon):

I checked with LFS forum from my workstation at office. I came to know my foolishness. The document did not ask me to apply any patch. But I thought I was very clever, so applied patch files also during Pass-1 of gcc-build. That is the cause for the compilation error. Moral: Follow the LFS manual without any add-ons as I did, if you are an average linux user. Please consider errata document also while reading LFS manual. That will do. That day evening, returned home and immediately, built the gcc again without any patch applied. It was through. Then I continued installation. To my surprise, I finished “Preparing for the Build” phase of installation at next day morning (while the build was going on, I slept). I was very happy and felt that I am doing/learning something useful/interesting. But I should agree that I can’t understand all the technical explanations in the manual. But I was able to manage the things whenever I got diverted from the way LFS manual said. That is enough, hope I have good start.

Day 3: 1st Aug 2006 (Tue):

Morning I spent a hour in creating chroot-ed environment. Created all directory layour as per Linux File System Hiererchy. Then created /etc/passwd, /etc/groups files.

What a nice experience, creating those system files by our own hand and going to use! Just heart is flying and sizzling like anything! I know that still I have a long way to go to get my linux system from scratch. But I am 100% confident of it. The most happiest moment in life comes with most important/complicated task is get completed.

Coming up with Part-II soon…