Flying UNIX
Unix and Linux fly...
Thursday, August 19, 2010
Automated kickstart install of ubuntu
Prepare the configuration server:
Install packages
Configure DHCP and TFTP to provide pxe-boot image files
Configure lighttpd to serve operating system files
Prepare kickstart configuration file
Start client; intercept boot and request net boot
Note: the steps below expect all servers (dhcp, tftp and web) to be on the same physical machine, here: 192.168.1.100. Both the installation server, and anticipated clients are Ubuntu machines.
----------------------
Step 1.
(a) Install dhcp3 server. This will provide the initial network boot, for the client's PXE start.
$ sudo apt-get install dhcp3-server
(b) Edit its configuration.
Add the subnet info, leave all other elements of the file as they are.
$ sudo vi /etc/dhcp3/dhcpd.conf
ddns-update-style none;
# option definitions common to all supported networks...
option domain-name "example.com";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.111 192.168.1.222;
option domain-name-servers 212.135.1.36; # your DNS server
option domain-name "internal.example.com"; # your domain name
option routers 192.168.1.254; # your gateway
option broadcast-address 192.168.1.255;
filename "pxelinux.0";
}
(c) Start dhcp server.
$ sudo /etc/init.d/dhcp3-server start
----------------------
Step 2.
(a) Install tftpd-hpa (and its super-daemon, inetd):
$ sudo apt-get install openbsd-inetd tftpd-hpa
(b) Modify the main tftp setup file, in /etc/default/tftpd-hpa, to have the content as shown.
$ sudo vi /etc/default/tftpd-hpa
TFTP_USERNAME=”tftp”
TFTP_DIRECTORY=”/srv/tftp”
TFTP_OPTIONS=”--secure”
TFTP_ADDRESS=”192.168.1.100:69”
The address above is the IP address of your tftp server.
(c) Start the inetd superdaemon
$ sudo /etc/init.d/openbsd-inetd start
Starting internet superserver inetd [ OK ]
(d) Check the tftpd is now active:
$ netstat -a | grep tftp
udp 0 0 *:tftp *:*
----------------------
Step 3.
Copy the netboot files into the tftp server. (Check lftp is there, if not – install it, with sudo apt-get install lftp).
$ sudo mkdir -p /srv/tftp/
$ cd /srv/tftp/
$ sudo lftp -c “open http://archive.ubuntu.com/ubuntu/dists/lucid/main/installer-i386/current/images/netboot/; mirror”
----------------------
Step 4.
(a) Edit /srv/tftp/pxelinux.cfg/default and change string menu.cfg into text.cfg.
After the change, the file should look as follows:
include ubuntu-installer/i386/boot-screens/text.cfg
default ubuntu-installer/i386/boot-screens/vesamenu.c32
prompt 0
timeout 0
(b) Modify the /srv/tftp/ubuntu-installer/i386/boot-screens/text.cfg file to have the following content:
timeout 1
default auto
label auto
menu label ^Auto
menu default
kernel ubuntu-installer/i386/linux
append vga=normal initrd=ubuntu-installer/i386/initrd.gz
ks=http://192.168.1.100/ubuntu/ks.cfg -- quiet
----------------------
Step 6.
(a) Install lighttpd (may need to stop apache first, if running).
$ sudo /etc/init.d/apache2 stop # if running
$ sudo apt-get install lighttpd
(b) Ensure that the root directory is /srv/www (the default /var/www could be used, but we follow proper FHS rules here ;-). This will serve all installation files. The url directive in the kickstart file will direct the installation program to this web page.
$ sudo vi /etc/lighttpd/lighttpd.conf
change the document-root directive to read as follows:
server.document-root = "/srv/www/"
(c) Start lighttpd
$ sudo /etc/init.d/lighttpd start
----------------------
Step 7.
Populate the the web server with the installation files.
Here, we will get the installation files from the Ubuntu installation CD (assumes Ubuntu installation CD is in the drive on the server machine, and mounted).
$ sudo mkdir /srv/www/ubuntu
$ sudo cp -rv /dev/sr0/* /srv/www/ubuntu
(time for a cuppa)
----------------------
Step 8.
Create a text file called ks.cfg with the kickstart instructions, and place it in the /srv/www/ubuntu directory.
Notice that /srv/tftp/ubuntu-installer/i386/boot-screens/text.cfg is pointing at this file.
#platform=x86
#System language
lang en_UK
#Language modules to install
langsupport en_UK
#System keyboard
keyboard gb # not uk !
#System mouse
mouse
#System timezone
timezone Europe/London
#Root password
rootpw --disabled
#Initial user
user fred --fullname "Fred User" --iscrypted --password
$1$TbZtLDPw$YG89LpNillhOvTH4zeEse/
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use Web installation - provide the URL of your web server
url --url http://192.168.1.100/ubuntu
#cdrom
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part / --fstype ext3 --size 10000000 # --grow failed for me ;-(
part swap --size 512
part /lvm --fstype lvm --size 512
#System authorization information
auth --useshadow --enablemd5
#Network information
network --bootproto=dhcp --device=eth0
#Firewall configuration
firewall --disabled
#Do not configure the X Window System
skipx
%packages # comment out needed packages, or add new
openssh-server
# ubuntu-vm-builder
# libvirt-bin
# screen
%pre
%post
perl -pi -e "s/kickseed/myserver/g" /etc/hosts /etc/motd
perl -pi -e "s/ubuntu/myserver/g" /etc/hosts /etc/motd
cat > /etc/hostname <<>
myserver
EOF
cat >> /etc/hosts <<>
192.168.1.10 myserver.example.com myserver
192.168.1.11 yourserver.example.com yourserver
192.168.1.12 herserver.example.com herserver
EOF
# any other post-installation shell command(s) can go here
This concludes server configuration.
----------------------------
Step 9. On the client:
Boot, intercept the booting process and enter BIOS. Change the sequence of boot devices, and select network boot.
Ideally, you want to identify a separate key, like F12 on some machines, which request PXE boot without you changing the boot sequence. This will prevent repeated boots as the machine restarts after the installation.
Thursday, August 12, 2010
How did Ubuntu speed up boot time?
How come? Scott of Canonical, explained at LINUXCON.
When booting a Linux system, four distinct phases occur:
1.Load into memory the kernel and ramdisk
2.Load platform drivers
3.Start X-related stuff
4.Start the desktop
Ubuntu developers made a conscious decision to aim for target timing. Rather than tweaking existing sequence of events, they decided to invest time into redesigning the boot process, and aim for 2+2+2+4 seconds for each stage, respectively.
That would give a cold-to-desktop time of 10 seconds. Test base platform that was used was a Dell laptop (can't remember which one, but it doesn't matter, as advantages and shortened time will apply to most contemporary PCs).
How they went about it: first of all, they looked at the monolithic kernel content, and cleaned it up. This had a two-fold benefit: it allowed to remove some of the duplicity, where two (or more !) modules were doing the same thing, but also in the process, they managed to nearly half the footprint of the kernel image itself – a massive saving in resource and time to load.
Ramdisk savings are not that easy to achieve. You can't remove it altogether: ramdisk is essential, as it provides the hibernate/suspend functionality, LVM, RAID, filesystem encryption, etc. However, where the saving can be made is if you start performing ramdisk tasks asynchronously with the loading of mainline kernel. That, of course, relies on the CPU with multi-cores, but even on a single core the benefits are significant, as the kernel will schedule things more efficiently whilst waiting for hardware to return.
Other improvements:
1.
blkid process (relying on while/sleep) poll-style operation has now been fully replaced by libudev process (which instead of polling devices, it works on the “tell me when you are ready” principle. That alone saved 3.5 seconds off the boot time
2.
upstart – a total replacement to the init process; it allowed to eliminate 1000s of shell script code and replaced the sequential processing of the service startup with event-driven service initialisation. For example, in the traditional method, when got to mounting a device and the device wasn't up and running, it would miss out on being connected. With initupstart, device will be mounted when it announces its readiness
3.
ureadahead – a binary providing a method of speeding up disk seeks and reads; much more effective on SSD drives, because HDD disks are still prone to slow seeks, as disk geometry gets in the way; ureadahead is fs-independent, although it still can't cope with the fs metadata location problems
use light-weight desktops
4.
in future compiz will be replaced with faster alternative
Tuesday, August 10, 2010
Oracle take on Linux
Considering recent acquisition of Sun Microsystems by Oracle, it's not surprising that Oracle's presence here is important.
I'm not going to transcribe the talk. Few comments only: the indication of where Oracle stand on Solaris and Linux is apparently in the fact that they are at present hiring professionals in both of these.
According to Wim, more than 20% of Oracle installations run on Linux. His closing comment was:
"Linux is here to stay, also at Oracle"
That was to say - nobody argues the place of Linux in today's IT, and that has nothing to do with Oracle, no individual or organisation can change the momentum Linux has. However, Oracle are declaring their full embrace for both Linux and open source in general.
Wednesday, July 14, 2010
Creation time in UniX? Yes - in ext4
There are significant differences between ext4 and its predecessors, and amongst them is extent mapping (instead of the traditional indirect block mapping), the new 1 nanosecond date resolution capability, date limit pushed back till 25/04/2514, and for the first time in UNIX i-node that stores five file timestamps (i-node width defaults to 256 bytes in ext4).
In addition to the traditional atime (a=access), mtime (m=modification) and ctime (c=change of i-node), in ext4 we now also have crtime (cr=creation) and dtime (d=deletion).
It's this creation time that many people insisted on having... So we now have it. There is one problem, though. Standard Linux tools can't yet deal with this sophistication!
Normally, we would use tools like stat or find to read file attributes from their i-nodes, but at the moment, they are not extracting any more information from ext4 than from ext2 or ext3.
This is where debugfs can help. First, check which partitions are formatted with ext4:
# mount | grep ext4
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
Here, the root file system is ext4. To see all know timestamps on a file in this file system (for example, for /etc/hosts file):
# debugfs -R 'stat /etc/hosts' /dev/sda1
Inode: 133370 Type: regular Mode: 0644 Flags: 0x80000
Generation: 1995841318 Version: 0x00000000:00000001
User: 0 Group: 0 Size: 250
File ACL: 0 Directory ACL: 0
Links: 1 Blockcount: 8
Fragment: Address: 0 Number: 0 Size: 0
ctime: 0x4c080d16:0bf9435c -- Thu Jun 3 21:14:14 2010
atime: 0x4c3da303:c11dd858 -- Wed Jul 14 12:44:03 2010
mtime: 0x4c080d16:0bf9435c -- Thu Jun 3 21:14:14 2010
crtime: 0x4c080d16:0bf9435c -- Thu Jun 3 21:14:14 2010
Size of extra inode fields: 28
EXTENTS:
(0): 557470
Alternatively, check its i-node number (with ls -i) and run debugfs aganist it (notice the compulsory angle brackets if using i-node number):
# debugfs -R 'stat <133370>' /dev/sda1
Inode: 133370 Type: regular Mode: 0644 Flags: 0x80000
Generation: 1995841318 Version: 0x00000000:00000001
User: 0 Group: 0 Size: 250
...
At last!
BTW, I'm being told perl can extract the crtime from the i-node, but haven't tried it yet...
Thursday, July 01, 2010
Update your SSL certificate for Citrix
However, some weeks ago, I started getting "You have chosen not to trust..." message when connecting. Unfortunately for me, it coincided with a new laptop build, and I have assumed that my configuration has gone awry. My new system was built from scratch, but the home directory was restored from an rsync backup of my old laptop. That managed to confuse me, in that I suspected that some of the start-up files imported from the old (32-bit) laptop conflicted with the new (64-bit) system. It kept me going! I have repeated my own instructions several times, trying other browsers, googling if others had anything similar issues. The overwhelming set of instructions kept referring to the lack of the certificate in the correct ICAclient location. I have double and treble checked that part of the setup, and all seemed well, but the problem persisted.
Having spent several hours on dissecting the problem and getting nowhere, I suddenly relised that all proposed solutions refer to a couple of certificate authorities, whereas my error message referred to something totally different. Went to their site, and it turned out that my certificate that, I had been using for years, has been updated (even though it was meant to be valid till 2020). Anyway, a new download of the certificate into the keystore:

(an operation that in itself took about 15 seconds) and the problem was sorted.
Tuesday, June 29, 2010
Fixing sound in Ubuntu
Then some time later I would try to play an .mp3 track stored on the hard disk, and a pop up screen would suggest installing missing plugins, provided by gstreamer. I followed the instructions (all GUI), and sound works in every application and situation. It's only when this happened again, I think for the third time (same sequence of events when installed 9.04 and 9.10 before), when I clicked it's a 'proper' fix, that seems to work for me consistently. Moral of the story - if youhave problems with sound, see if you can play 'standard' music. If not - with any luck you will be guided how to fix it, and you should be in business in a tick!
BTW, I deliberately missed my hardware spec and setup here, as this has occurred on more than one machine.
Monday, March 15, 2010
A gap year ?
Some of it is my own fault, pushing the hardware to the limits, experimenting with virtualization, tuning the CPUs (one of the crashes was my incorrect use of the taskset command, another trying to modify udev to read my camera in a particular way).
But the worst disaster was when on a dual boot Windows 7 partition crashed, causing a wonderful blue screen of death. I kept the snapshot of this, for those that don't believe...
Anyway, I'm back, trying to catch up. I'm nearly there, abandoned dual boot (will have all other OSes in VMware), and running with Ubuntu 9.10 again. Getting ready for the new LTS (Long Term Support), the 10.4 version out soon...
Thursday, June 25, 2009
Booting from CD/DVD inside VMware guest
It turned out that there were two issues:
1 - the accessibility of the CD/DVD from the guest
2 - the booting sequence in the guest BIOS
Below are the steps resolving both.
First enable CD/DVD visibility in the guest:
1. Power off the guest OS
2. In "Devices" tab (right-hand side of the screen) select CD/DVD(IDE)
3a. Tick "Connect at power on" and
3b. Mark "Use physical drive"
3c. From the drop-down list select "Auto detect"
Now fix the BIOS boot sequence (in the guest). Notice that you have to change the focus into the guest screen before you can do anything (CTRL-G)
1. Power on guest OS
2. Intercept the boot - hit CTRL-G followed by hit F2 *quickly* - it doesn't hang around for long!
3. In the BIOS menu, identify the boot sequence screen, and change to place CDROM before the hard disk
4. Save and continue boot...
Wednesday, June 10, 2009
Forcing Solaris 10 to recognise network interface
Standard (well, for Solaris) tools like kstat -c net, or dladm show-dev had no network card information ...
Quite a bit of trial and error later (not forgetting googling), here is a working solution:
1. Identify the PCI vendor/device information:
# prtconf -pv | more
Search for Ethernet paragraph (you can do it within more using /Ethernet) and identify its vendor/device data. On my system, it showed:
vendor-id 00008086
device-id 00001050
The last 4 digits of these two values is what we are after.
To find out which particular card this is, I googled for "pci8086,1050" and it's "Intel 82562EZ PRO/100 VE Ethernet"
2. Configure device database
# vi /boot/solaris/devicedb/master
Go to the section with pci8086 entries, possibly using vi's search:
/^pci8086
Insert the following line (ensure it goes in the proper numerical order of the vendor/device pairing):
pci8086,1050 pci8086,1050 net pci iprb.bef "Intel 82562EZ PRO/100 VE Ethernet"
3. Add a new alias to the card
# vi /etc/driver_aliases
Search for the iprb related section and insert the following line (in the right alphabetically place):
iprb "pci8086,1050"
4. Load the kernel driver module for the interface
# modload /kernel/drv/iprb
5. Perform a 'reconfigure' reboot. First initialise the reconfigure flag file, then reboot the machine:
# touch /reconfigure
# reboot
6. After the reboot, 'plumb' the card in and complete the configuration (here, I'm assuming IP address of 192.168.1.100):
# ifconfig iprb0 plumb
# ifconfig iprb0 192.168.1.100 up
# touch /etc/hostname.iprb0
Make sure that the hosts file under /etc/inet is fine. Mine has the following lines:
127.0.0.1 localhost localhost.qa.com
192.168.1.100 yogi yogi.qa.com loghost
Notice that on Solaris the main /etc/hosts file is a symbolic link to /etc/inet/hosts and in addition it will be replicated (automatically) into /etc/inet/ipnodes as well.
Tuesday, June 02, 2009
Time ticket with sudo
In the sudo configuration file (/etc/sudoers) we define who can do what on which machines with whose identity. The configuration can be as complex as it is powerful, so a lot of the time administrators start with a basic facility, which specifies that a user can do every command, on every machine as any user:
fred ALL=(ALL) ALL
So how does that differ from login as user root in the first place? Well, with sudo you don't disseminate root's password. Users attempting to use the sudo facility will have to authenticate themselves by providing their own password (not the password of the 'target' identity!).
Once authenticated, the user can continue executing sudo commands for a default timeout (typically 5, 10 or 15 minutes). This timeout is known as the 'time ticket'. Once the time ticket expires, the user will have to provide his/her password again.
The default for the time ticket is not always appropriate. Depending on the job role, there may be a requirement to extend (or indeed shorten) the time ticket's length.
To do that, edit the /etc/sudoers file (using visudo tool), and add the line into the Defaults block of instructions (it actually doesn't matter where the line ends up, the suggested location is for clarity reasons only):
Defaults:fred timestamp_timeout = "X"
where X stands for the number of minutes you want the time ticket to last.
If you want for the timetickets to never expire (not really recommended - it defeats the purpose!) replace X with -1.
You can add a line for each user you want to modify, and you can replace the user name with ALL - meaning.... all users ;-)
Monday, May 11, 2009
Changing 'Places' in Gnome panel

Distros using Gnome have pretty much standardised on the main panel's appearance and content. We get three main drop-down menus: Applications, Places and System.
Customising Applications and System is straighforward, and quite intuitive (right-click on either of them, choose Edit Menus, and have a play...). However, the same cannot be said for Places. By default, the top part of it gives a direct access to user home directory and their Desktop. But if you want to add another quick-access location, you need to realise that the Places represents a shortcut to the Nautilus Bookmarks.
So, to modify the list of directories accessible via Places you need to edit file manager's Bookmarks. Open your file manager, select the Places view for the left hand-side pane, then edit it by dropping or deleting directories into it (see the screenshot).
Wednesday, April 29, 2009
Test posting from e-mail directly into blog

Just set up an "email2blog" account, and this is the test of the post.
Including an attachment picture (Barry flying LN over our garden).
Thank you http://www.linuxjournal.com/video/blogger-email for the hint !
Thursday, April 23, 2009
Fixing MS in VMware keyboard mappings
To fix, modify the VMware configuration file, by adding the following directive:
xkeymap.nokeycodeMap = true
Add it to the configuration file relevant to your product. If you have VMware server - it's /etc/vmware-server-console/conf.
For you have Workstation or Player, it's /etc/vmware/config.
It's been reported (see: http://communities.vmware.com/thread/177321) that the local file, in ~/.vmware/config can be used for the purpose (not tested by me either).
Open Source Interoperability Initiative from Microsoft
I have written before about the current configuration of my main laptop (Dell XPS M1330): I am running Ubuntu 8.10, which is 100% adequate for all my personal needs.
However, for as part of my work I need to be able to edit Microsoft Office files (all our slides are produced in Power Point). Well, tried using Open Office - it can do just as good a job. However, the niggling and subtle (sometimes very subtle) style and font differences made it so frustrating that I gave up. I was spending far too much time converting between Open Office - Power Point and back.
That gave rise to the second best solution: install Crossover Office, a product based on Wine, allowing access to MS native applications. Again, this works the treat, at least in principle. Then I bumped into more hiccups, like font colour changing, or various boxes being over sized. In isolation, I would be totally satisfied with the solution, but I need to comply with company's strict branding and design style, and I can't achieve it with this setup (at least not without additional fiddling with the files).
So, (grudgingly) on to the next solution. I already have a license for VMware Workstation (6.5). I installed XP into it, added MS Office 2003, and thought that I might be able to get some work done, at last. No! MS Office working in VMware does not recognise any of the extended keyboard mappings. Arrow keys, Page Up, Page Down, etc, all either totally dead, or generate VM-associated actions.
So why is it that I'm wasting all this time just to stay afloat. This is like an engineer having to calibrate his meters or file his screwdrivers before every use.
Open source is meant to unite. If Microsoft truly opened their code, it would allow other designers to create applications that are workable and provide permanent solutions. Instead, these designers are still having to reverse-engineer, outguess, invent emulators and create work-around fixes. Fixes are never perfect.
Microsoft are boasting about interoperability: "... agreements between Microsoft and open source distributors. including Novell, Xandros, Linspire, and TurboLinux". That probably explains why my EeePC (Xandros) seems to have more robust drivers, character rendering and application selections, etc. But that is not what commitment to open source should be. If you are selective, you are still prescriptive and closed.
Unless you find a way of being only a bit pregnant.
Sunday, April 19, 2009
Ubuntu training (and Spreed conferencing)
To get the detail and the philosophy of the new training content over to the accredited trainer base, (as well as a fresh and original delivery approach) Canonical are holding several TTT (Train The Trainer) sessions. Considering that the number of people being trained is relatively small, and they are splattered literally all over the world, arranging the logistics for such a session was not trivial.
I have attended the event run 13:00 - 17:00 EST, which put it at 18:00-22:00 “my” time. I wasn't the worst off, there were people from US, Canada, but also from countries much further East than I am, so it was even later into the night for some of them. I was a bit worried, because the joining instructions, although very clear, involved configuring technologies either totally new to me, or ones that, regrettably, I have never made a proper use of.
The underlying conferencing engine was a product new to me, called Spreed. It impressed me straight away: it supports _all_ contemporary operating systems, including MacOS and Linux. Once on Spreed site, quick test confirmed that connection speed and other communication elements are suitable for conferencing. Patiently waited for an e-mail invitation to join and, once that arrived, a single click on the link and I was in. I understand this was the first time Canonical tried this particular conferencing method for the TTT purposes, so there was new grounds to cover for both the students and the moderators. But, with few (mostly humorous) hiccups the event went very smoothly, the time past surprisingly fast and my overall impression was very positive.
Although the product supports full audio and video from all participants, we didn't use cameras at all (something about Spreed and Flash 10 being incompatible - well, we had to have hardware incompatibility ;-)). Most of us stayed away from the audio as well, the interactive and real time “chat” pane provided more than satisfactory interaction. 10 points to the moderators for looking out for our comments and reacting to them swiftly. The whole experience was smooth, painless and very effective. Thank you EmmaJane, Belinda and Billy!
Bottom line - my resistance to these elaborate e-based methods of collaboration is well and truly broken, bring them on!
Friday, April 03, 2009
It is rather ironic, and indicative of the state of the game, that the blog is only expected to be accessed / updated from Windows and Explorer.
So, despite the fact that I haven’t used Windows for a couple of years, (and had used Firefox for years prior to that), it seems that the popular believe that life begins and ends with Windows is still there...
Luckily, Firefox 3 managed to overcome whatever the .NET or activeX components compatibility issues might be (I don't really know what I'm talking about here, so I'll stop speculating any further!). Opera 9 wasn't as helpful, and would not connect at all (although I could've tried changing its personality to Explorer in the setup)…
Blog Archive
- August (3)
- July (2)
- June (1)
- March (1)
- June (3)
- May (1)
- April (5)
- February (1)
- January (5)
- October (1)
- September (3)
- July (4)
- June (5)
- April (3)
- March (1)
- February (3)
- January (3)
- October (7)
- August (2)
- July (3)
- May (1)
- November (4)
- October (1)
- September (1)
- August (2)
- July (2)
- June (3)
- May (3)
- April (2)
- March (2)
- February (3)
- January (1)
- December (2)
- November (1)
- October (6)
- September (6)
- August (1)
- July (2)
- June (8)
- May (3)
- April (4)
- March (3)