Category Archives: SysAdmin

System Administration

Broken webserver of Google Code

% curl -I http://gentoo-xen-kernel.googlecode.com/files/xen-patches-2.6.31-11.tar.bz2
HTTP/1.1 404 Not Found
Content-Type: text/html; charset=UTF-8
Set-Cookie: PREF=ID=913587349124edb1:TM=1267030254:LM=1267030254:S=gPkLxJgB22UJHzXo; expires=Fri, 24-Feb-2012 16:50:54 GMT; path=/; domain=gentoo-xen-kernel.googlecode.com
Date: Wed, 24 Feb 2010 16:50:54 GMT
Server: codesite_downloads
Content-Length: 1389
X-XSS-Protection: 0
% curl  http://gentoo-xen-kernel.googlecode.com/files/xen-patches-2.6.31-11.tar.bz2 2>/dev/null |file -
/dev/stdin: bzip2 compressed data, block size = 900k

This is really crazy sending 404 to HTTP HEAD requests, while 200 to HTTP GET requests, causing wget to break, which performs HTTP HEAD before HTTP GET to get value of Content-Disposition header.

Converting existing OPTIONS to FreeBSD portconf format

If you started using under-documented ports-mgmt/portconf software to manage options of your ports, and looking forward to convert existing /var/db/ports/${PORTNAME}/options files to its format, then check out following script, I hacked:

% cd /var/db/ports;
% for i in *; do \
>        name=$(echo /usr/ports/*/$i |sed -e 's/distfiles\/[^[:space:]]*//g' -e s/\/usr\/ports\///g);\
>        cat $i/options  |gawk '!/#/ && ! /^_/ { print $1" | " }' |xargs echo $name: ;\
> done |sed -e 's/^[[:space:]]*//g' -e 's/|[[:space:]]*$//g' -e '/:[[:space:]]*$/d'

I originally hacked it on GNU/Linux, and I think it needs lang/gawk port because of gsub function, but I’m not sure.

Faster tunnel to IPv6 internet.

Thanks to network admins at Bharti and Hurricane Electric, RTT to HE’s IPv6 tunnel server at HK PoP is reduced. Yippee!!

+-(abbe@chateau:pts/0)---------------------------------------------------------------------------------------------(~)-+
+-(130:20:44:%)-- traceroute -I 216.218.221.6                                                            --(Sun,Dec06)-+
traceroute to 216.218.221.6 (216.218.221.6), 64 hops max, 72 byte packets
 1  ABTS-North-Static-018.230.160.122.airtelbroadband.in (122.160.230.18)  41.593 ms  44.970 ms  52.979 ms
 2  ABTS-North-Static-021.230.160.122.airtelbroadband.in (122.160.230.21)  41.596 ms  44.188 ms  45.308 ms
 3  rasBTNLDel-static-174.215.56.202.mantraonline.com (202.56.215.174)  44.376 ms  44.404 ms  45.537 ms
 4  125.19.22.145 (125.19.22.145)  45.105 ms  42.097 ms  43.629 ms
 5  AES-Static-013.36.144.59.airtel.in (59.144.36.13)  150.993 ms  155.188 ms  154.701 ms
 6  hurricaneelectric-RGE.hkix.net (202.40.161.158)  165.843 ms  158.931 ms  164.889 ms
 7  tserv20.hkg1.ipv6.he.net (216.218.221.6)  158.572 ms  154.562 ms  154.215 ms
+-(abbe@chateau:pts/0)---------------------------------------------------------------------------------------------(~)-+
+-(130:20:45:%)-- ping6  www.google.com                                                                  --(Sun,Dec06)-+
PING6(56=40+8+8 bytes) 2001:470:f803:8000::1 --> 2001:4860:c004::68
16 bytes from 2001:4860:c004::68, icmp_seq=0 hlim=58 time=179.801 ms
16 bytes from 2001:4860:c004::68, icmp_seq=1 hlim=58 time=181.696 ms
16 bytes from 2001:4860:c004::68, icmp_seq=2 hlim=58 time=179.953 ms
16 bytes from 2001:4860:c004::68, icmp_seq=3 hlim=58 time=179.401 ms
^C
--- www.l.google.com ping6 statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 179.401/180.213/181.696/0.880 ms

good admins maintain good mirrors.

Hi to everyone,
After struggling with laziness for long time, I decided to /part it and write something. The spike that caused this is what this post is about.
After struggling with apt-cacher since past 2 hours trying to figure out why the hell it fetches the same files again and again, making my apt-cacher setup worthless, since I decided to use mirrors hosted by HNS and IIT-K which are proudly powered by lighttpd . For those who’re maintaing mirrors of IIT-M, they are safe from my flames, lol.

abbe [x] monte-cristo % ls
abbe [x] monte-cristo % curl -o Release  -I -z Release  http://mirror.cse.iitk.ac.in/ubuntu/dists/karmic/main/binary-i386/Release
Warning: Illegal date format for -z/--timecond (and not a file name).
Warning: Disabling time condition. See curl_getdate(3) for valid date syntax.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    94    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
abbe [x] monte-cristo % curl -o Release  -I -z Release  http://mirror.cse.iitk.ac.in/ubuntu/dists/karmic/main/binary-i386/Release
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    94    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
abbe [x] monte-cristo % cat Release
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Accept-Ranges: bytes
Content-Length: 94
Date: Tue, 10 Nov 2009 14:19:17 GMT
Server: lighttpd/1.4.19

abbe [x] monte-cristo % curl -o Release  -I -z Release  http://mirror.cse.iitk.ac.in/ubuntu/dists/karmic/main/binary-i386/Release
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    94    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
abbe [x] monte-cristo % cat Release
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Accept-Ranges: bytes
Content-Length: 94
Date: Tue, 10 Nov 2009 14:19:21 GMT
Server: lighttpd/1.4.19

abbe [x] monte-cristo % curl -o Release  -I -z Release  http://mirror.cse.iitk.ac.in/ubuntu/dists/karmic/main/binary-i386/Release
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    94    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
abbe [x] monte-cristo % cat Release
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Accept-Ranges: bytes
Content-Length: 94
Date: Tue, 10 Nov 2009 14:19:25 GMT
Server: lighttpd/1.4.19

abbe [x] monte-cristo % curl -o Release  -I -z Release  http://ubuntuarchive.hnsdc.com/dists/karmic/main/binary-i386/Release
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    94    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
abbe [x] monte-cristo % cat Release
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Accept-Ranges: bytes
Content-Length: 94
Date: Tue, 10 Nov 2009 14:19:23 GMT
Server: lighttpd/1.4.19

abbe [x] monte-cristo % curl -o Release  -I -z Release  http://ubuntuarchive.hnsdc.com/dists/karmic/main/binary-i386/Release
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    94    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
abbe [x] monte-cristo % cat Release
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Accept-Ranges: bytes
Content-Length: 94
Date: Tue, 10 Nov 2009 14:19:28 GMT
Server: lighttpd/1.4.19

abbe [x] monte-cristo % curl -o Release  -I -z Release  http://ubuntuarchive.hnsdc.com/dists/karmic/main/binary-i386/Release
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0    94    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
abbe [x] monte-cristo % cat Release
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Accept-Ranges: bytes
Content-Length: 94
Date: Tue, 10 Nov 2009 14:19:33 GMT
Server: lighttpd/1.4.19

abbe [x] monte-cristo % curl -o Release  -I -z Release  http://archive.ubuntu.com/ubuntu/dists/karmic/main/binary-i386/Release
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
abbe [x] monte-cristo % cat Release
HTTP/1.1 304 Not Modified
Date: Tue, 10 Nov 2009 14:25:30 GMT
Server: Apache/2.2.8 (Ubuntu)
ETag: "be802d-5e-476ff88b2cd40"

abbe [x] monte-cristo % curl -o Release  -I -z Release  http://archive.ubuntu.com/ubuntu/dists/karmic/main/binary-i386/Release
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
abbe [x] monte-cristo % cat Release
HTTP/1.1 304 Not Modified
Date: Tue, 10 Nov 2009 14:25:35 GMT
Server: Apache/2.2.8 (Ubuntu)
ETag: "be802d-5e-476ff88b2cd40"

abbe [x] monte-cristo % curl -o Release  -I -z Release  http://archive.ubuntu.com/ubuntu/dists/karmic/main/binary-i386/Release
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
abbe [x] monte-cristo % cat Release
HTTP/1.1 304 Not Modified
Date: Tue, 10 Nov 2009 14:25:39 GMT
Server: Apache/2.2.8 (Ubuntu)
ETag: "be802d-5e-476ff88b2cd40"

abbe [x] monte-cristo % curl -o Release  -I -z Release  http://ftp.iitm.ac.in/ubuntu/dists/karmic/main/binary-i386/Release
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
abbe [x] monte-cristo % cat Release
HTTP/1.1 304 Not Modified
Date: Tue, 10 Nov 2009 14:28:06 GMT
Server: Apache/2.0.52 (CentOS)
Connection: close
ETag: "34100d4-5e-88b2cd40"

abbe [x] monte-cristo % curl -o Release  -I -z Release  http://ftp.iitm.ac.in/ubuntu/dists/karmic/main/binary-i386/Release
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
abbe [x] monte-cristo % cat Release
HTTP/1.1 304 Not Modified
Date: Tue, 10 Nov 2009 14:28:10 GMT
Server: Apache/2.0.52 (CentOS)
Connection: close
ETag: "34100d4-5e-88b2cd40"

WTF is that ? If this is your question, I’m lazy to write about it. So, RTFM curl(1) and If-Modified-Since http header . I want to be a writer, but I guess I’ll only be able to write computer programs 😦 .

I hope (good)? people at HNS and IIT-K will fix this issue…:)

/away In his shell for infinite period of time.

Fulfilling a dream.

Since I’ve heard about invention of IA-64 architecture in 2002, I was interested in everything its box comes with, be it Itanium CPU, EFI firmware, or GPT disk partioning. It was always my dream to play with those things. Itanium was too expensive and most of the humans I’ve worked with never have any need to use it. So I’ve never worked with the physical CPU but just played a bit with ski . My life’s first server came with an EFI boot method, but being a n00b at that time, I was not able to configure it to boot with elilo which felt quite frustrating at that time. And now on 29th July, 2009, I decided to give GPT partitions a shot on my AMD64 box (Intel DG35EC mobo ++ Intel Core 2 Duo CPU) as I’m plugging in my new 500 GiB disk. There is no problem with disks partitioning with GPT as all of the operating systems I use (GNU/Linux, FreeBSD and GNU Emacs) have no problem reading/writing to it :). So the only problem is booting a disk formatted with GPT as I’ve a BIOS based mobo. I’d an idea how that is going to be, but I’m not sure if there are any FOSS boot loders that are able to boot in this way. Since I use GRUB, I asked my friend (google) if he knows anything about GRUB and GPT. And it revealed that GRUB2 has support for GPT, i.e. grub-install detects at runtime if it is installed on GPT disk. 🙂
With the help of the search results, GRUB2, GPT fdisk (or gdisk), phcoder on #grub and software repository of Arch GNU/Linux distribution, I’m able to boot from my GPT disk.

% sudo gdisk -l /dev/sdb
GPT fdisk (gdisk) version 0.2.0

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 976773168 sectors, 465.8 GiB
Disk identifier (GUID): FADB3815-91DF-4134-8492-E6FE33A3162E
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 976773134
Total free space is 93345773 sectors (44.5 GiB)

Number  Start (block)     End (block)  Size        Code  Name
   1              34            2081   1024.0 KiB  EF02  BIOS boot
   2            2082       125831201   60.0 GiB    0700  GNU/Linux root
   3       125831202       134219809   4.0 GiB     A503  FreeBSD-root
   4       134219810       142608417   4.0 GiB     A502  swap
   5       142608418       143132705   256.0 MiB   0700  GNU/Linux boot
   6       143132706       252184609   52.0 GiB    A503  FreeBSD-home
   7       252184610       378013729   60.0 GiB    0700  GNU/Linux home
   8       378013730       380110881   1024.0 MiB  0700  news spool
   9       380110882       883427361   240.0 GiB   0700  archives
% sed -e '/^#/d' -e '/^[[:space:]]*$/d' </boot/grub/grub.cfg
1insmod gpt
set default=0
set timeout=10
set root=(hd1,2)
search --no-floppy --fs-uuid --set 6ad9832e-6241-4adc-b67b-3829cd1a2942
if loadfont /usr/share/grub/ascii.pf2 ; then
  set gfxmode=1024x768
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
menuentry "Arch GNU/Linux" {
        set root=(hd0,5)
        linux /vmlinuz26 root=/dev/sdb2 ro vga=0x0f00
        initrd /kernel26.img
}
menuentry "Arch GNU/Linux (fallback)" {
        set root=(hd0,5)
        linux /vmlinuz26 root=/dev/sdb2 ro vga=0x0f00
        initrd /kernel26-fallback.img
}
insmod bsd
menuentry "FreeBSD 7.2-RELEASE" {
        set root=(hd0,3)
        freebsd /boot/kernel/kernel
        freebsd_loadenv /boot/device.hints
        freebsd_module_elf /boot/kernel/coretemp.ko
        freebsd_module_elf /boot/kernel/geom_journal.ko
        set FreeBSD.vfs.root.mountfrom=ufs:ad6p3.journal
}

RIP MBR based partitioning. 🙂

Note: Intel BIOS requires a partition to be marked as active in MBR in order to be able to boot from that disk.

Happy System Administrator Appreciation Day…

Thanks for recompiling TeX, whenever we exceeded compile-time limit…

If there were no sysadmins, there won’t be any Introduction to Algorithms book, lets appreciate their efforts in keeping world going on System Administrator Appreciation Day .

Installing FreeBSD over PXE

This time instead of installing FreeBSD from magnetic or optical media, I’ve installed it over network with the help of the instructions. For this installation, I’ve used my Arch GNU/Linux box to become server (TFTP server, DHCP server, NFS server). I downloaded the DVD of 8.0-BETA2 version, loop mounted it on my box, and exported it to my local network over NFS. Then I prepared the PXE root and started tftpd, dhcpd and nfs-server services. After this I booted my notebook over PXE and it received an IP address, and started executing pxeboot loader, but then it started giving RPC errors. I did a tcpdump (with udp filter) and noticed that it is expecting server to support NFS verison 1 whereas I’ve disabled version 1 and version 2 in mountd options. So I changed options of mountd and restarted nfs-server service and rebooted my notebook. And viola, it now booted with FreeBSD boot screen showing up 🙂 . After this I got some errors about readonly filesystem which are expected. I logged-in as the root, loaded gjournal and reformatted / and /usr using newfs . Then I mounted them and extracted all tarballs one by one in DESTDIR, created /etc/fstab, basic rc.conf, etc. After this I unmounted the partitions and rebooted my notebook as usual from HDD and there I’m in 8.0-BETA2 installation. Enjoyed the whole experience. 🙂