Tag Archives: freebsd

FreeBSD Ports and other pending stuff

Recently some of users who use my ports contacted me with some issues they’re facing. If you know me from my FreeBSD ports, then please pardon me for not updating my ports yet. I was planning to do them last weekend, but due to a dragon^Wcatastrophe which caused my box chateau.d.if to feel hot again. And co-incidentally, around that time life had been sadomasochistic with me as well :(.

To fix the chateau.d.if, I decided it to relocate it to a new box Intel Core i7 950, a Intel DX58SO mobo, n GiBs of RAM and a graphics card, and the combo decided not to boot for me :(, and therefore needs a replacement.

And on top of that I’m overclocked (read as: overslept) these days, playing weird RPGs :(.

I’m hopeful, this abbe will regain his lost faith soon, and will commit all of his pending PRs, port updates as soon as he gets on his chateau.d.if.

Hopefully all of this will happen by the end of this week.

UPDATE (at 20101104 0300 UTC): I had a Superbad yesterday, didn’t get sleep for more than 36 hours and found that my mobo and CPU both are bad (highly rare, but common for me) and are sent for replacement. It’ll take a week for highly uncertain replacement to happen, courtesy: series of festivals 😦

UPDATE (at 20101112 2230 UTC): chateau.d.if is back, and so am I. I’ll try to finish all pending ports asap.


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.

solang on FreeBSD

Submitted a PR for solang on FreeBSD.

UPDATE: Checkout graphics/solang.

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
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.

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. 🙂