Content

Geek Attitude

Nov
28

Posted on November 28th, 2009 at 12:49 am OpenRD console access on FreeBSD.

This morning, I received the Open-RD I bought a few days ago and started playing with my new device. One of the first thing I wanted to access was (of course) the system console. While the default setup provides a SSH daemon and even GDM and a full desktop, my goal is to have FreeBSD on this device and move the services I run at home from my personal computer to this low-consumption computer (and I don't intend to switch to GNU/Linux).

Since the console is usually available on the serial port, I looked for some cable to connect the OpenRD to my computer. Unfortunately, I didn't have the required cable. I then spent about two hour with various serial cables, cables looking like serial cables but which where not serial cables, parallel SUB-D25 connectors, a serial SUB-D25 cross-over cable and a soldering iron to build a null-modem SUB-D9 serial cable. Unfortunately, when I connected my computer to the OpenRD, I was still not able to access the console using cu(1).

After reading a bit of documentation, I realised I missed the fact that the console was available on USB and not via the serial port. However, FreeBSD did not recognised the chip the OpenRD uses to provide serial over USB support.

Using usbconfig(8), I could get the vendor ID and product ID the uftdi(4) driver was lacking. I patches the source code and a few minutes later could enjoy a set of new devices when I plug the OpenRD on my computer:

% ls /dev/cuaU*
/dev/cuaU0
/dev/cuaU0.init
/dev/cuaU0.lock
/dev/cuaU1
/dev/cuaU1.init
/dev/cuaU1.lock

I can now access the OpenRD console using cu(1):

% cu -l /dev/cuaU1 -s 115200

\o/ I can boot a FreeBSD 8.0-STABLE arm kernel!

I filled-in the usb/140951 problem report in the FreeBSD GNATS with the patch. If you own an OpenRD and want to have access to the console, the patch is just waiting for you.

Oct
29

Posted on October 29th, 2009 at 11:32 am Updating FreeBSD 7 (i386) to 8 (amd64)

Goal

Update to the latest FreeBSD version, switch to 64 bit, and switch to full ZFS. In short, use the best I can have (or what is supposed to be the best I can have) on my computer.

Install an amd64 system

While cross compiling an amd64 system from i386 should be possible, I wanted to get sure that the nouveau video driver actually worked on amd64. I have so decided to install a fresh FreeBSD 8 on my system and perform a few tests before updating.

At that time, FreeBSD 8-BETA2 was just available, so I downloaded and installed it on a fresh partition created in place of the mysterious free space at the end of my hard disk:

# mkdir goinfre/FreeBSD
# cd goinfre/FreeBSD
# mkdir base kernels manpages
# ftp -a ftp.freebsd.org
ftp> cd /pub/FreeBSD/releases/amd64/8.0-BETA2/base
ftp> lcd base
ftp> mget *
ftp> cd ../kernels
ftp> lcd ../kernels
ftp> mget *
ftp> cd ../manpages
ftp> lcd ../manpages
ftp> mget *
ftp> bye
# ( cd base && DESTDIR=/goinfre sh install.sh )
# ( cd kernels && DESTDIR=/goinfre sh install.sh generic )
# mv /goinfre/boot/GENERIC /goinfre/boot/kernel
# ( cd manpages && DESTDIR=/goinfre sh install.sh )
# bsdlabel -w -B -b /goinfre/boot/boot /dev/ad10s3

Since my hardware BIOS sucks when it is supposed to give up control of USB to the kernel, USB is disabled in my BIOS and I have no keyboard to choose from which slice to boot when the system starts. I have so to instruct the boot manager to boot on the third slice on next boot:

# boot0cfg -s 3 ad10

I then rebooted and setup FreeBSD 8-BETA2 networking, patched the kernel sources, checked that the nouveau video driver worked as expected, installed packages, and so on.

Setting up the disks

I basically followed instructions from the blog post Setting up a zfs-only system by Ulf Lilleengen (nanolulf), adjusting settings according to my system (4 GB swap, all available space for the ZFS partition):

# gpart delete -i 1 ad12
# gpart destroy ad12
# gpart create -s GPT ad12
# gpart add -b 34 -s 128 -t freebsd-boot ad12
# echo "4 * 1024*1024*1024 / 512" | bc
8388608
# gpart add -b 162 -s 8388608 -t freebsd-swap ad12
# gpart show ad12
=>       34  625142381  ad12  GPT  (298G)
         34        128     1  freebsd-boot  (64K)
        162    8388608     2  freebsd-swap  (4.0G)
    8388770  616753645        - free -  (294G)
# gpart add -b 8388770 -s 616753645 -t freebsd-zfs ad12
# gpart bootcode -b /boot/pmbr ad12
# gpart bootcode -p /boot/gptzfsboot -i 1 ad12

Then I created the various ZFS filesystems and extracted FreeBSD 8 stable (well, still named 8.0-RC1 actually)

# zpool create data /dev/ad12p3
# zfs create data/tmp
# zfs create data/usr
# zfs create data/var

Installing FreeBSD 8 from sources

Since I had the right branch of the FreeBSD subversion repository checked in into the temporary FreeBSD 8 system — with local patches — I copied it to the ZFS filesystem and updated it.

# cp -R /usr/src /data/usr
# cd /data/usr/src
# svn up
# make buildworld buildkernel
# make DESTDIR=/data installworld
# make DESTDIR=/data installkernel
# make DESTDIR=/data distribution

I then customezed /boot/loader.conf:

cat << EOT > /data/boot/loader.conf
nouveau_load=yes
zfs_load=yes
vfs.root.mountfrom="zfs:data"
EOT

Configured the swap device:

cat << EOT > /data/etc/fstab
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/ad12p2             none            swap    sw              0       0
EOT

Customised new /etc/make.conf:

cat << EOT > /data/etc/make.conf
LOADER_ZFS_SUPPORT=YES
EOT

Setup the network in /etc/rc.conf:

cat << EOT > /data/etc/rc.conf
# This file now contains just the overrides from /etc/defaults/rc.conf.
# Please make all changes to this file, not to /etc/defaults/rc.conf.

# Enable network daemons for user convenience.
ifconfig_rl0="inet 192.168.63.42  netmask 255.255.255.0"
defaultrouter="192.168.63.1"
hostname="marvin.blogreen.org"

named_enable="YES"
# asterisk_enable="YES"
# dbus_enable="YES"
# hald_enable="YES"

# gdm_enable="YES"
# gdm_lang="fr_FR.UTF-8"
EOT

I finally finished the ZFS setup:

# zfs export data && zfs import data
# cp /boot/zfs/zpool.cache /data/boot/zfs
# zfs set mountpoint=legacy data
# zfs set mountpoint=/usr data/usr
# zfs set mountpoint=/var data/var
# zpool set bootfs=data data

I then booted the fresh install from ZFS and finished the system configuration:

# passwd
# tzsetup
# adduser

Mirroring data

Since I have two identical disks on my system and wanted to have some kind of redundancy for a while, I set-up the second disk as a mirror of the first one.

First, I prepared the old disk so it has the same structure as the new with the ZFS filesystem:

# gpart show ad10
=>       63  625142385  ad10  MBR  (298G)
         63  104856192     1  freebsd  (50G)
  104856255  419425020     2  freebsd  (200G)
  524281275  100856070     3  freebsd  (48G)
  625137345       5103        - free -  (2.5M)
# gpart delete -i 1 ad10
# gpart delete -i 2 ad10
# gpart delete -i 3 ad10
# gpart destroy ad10
# gpart create -s GPT ad10
# gpart add -b 34 -s 128 -t freebsd-boot ad10
# gpart add -b 162 -s 8388608 -t freebsd-swap ad10
# gpart show ad10
=>       34  625142381  ad10  GPT  (298G)
         34        128     1  freebsd-boot  (64K)
        162    8388608     2  freebsd-swap  (4.0G)
    8388770  616753645        - free -  (294G)
# gpart add -b 8388770 -s 616753645 -t freebsd-zfs ad10
# gpart bootcode -b /boot/pmbr ad10
# gpart bootcode -p /boot/gptzfsboot -i 1 ad10

I added my new 4 Gib swap to /etc/fstab and enabled it:

# echo "/dev/ad10p2             none            swap    sw              0       0" >> /etc/fstab
# swapon /dev/ad10p2

I could then tell ZFS to mirror ad10p3 and ad12p3:

# zpool attach data ad12p3 ad10p3
# zpool status
  pool: data
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
	continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
 scrub: resilver in progress for 0h2m, 0.35% done, 13h33m to go
config:

	NAME        STATE     READ WRITE CKSUM
	data        ONLINE       0     0     0
	  mirror    ONLINE       0     0     0
	    ad12p3  ONLINE       0     0     0  44.6M resilvered
	    ad10p3  ONLINE       0     0     0  754M resilvered

errors: No known data errors

The nice part is of course that you can continue to use the system while you are doing all this!

Apr
18

Posted on April 18th, 2009 at 2:42 pm April!

After waiting and turning impatient, that's it!

TypeMatrix skins are available!

Mar
1

Posted on March 1st, 2009 at 1:03 pm March

Last month, I wrote to the TypeMatrix guys asking for skins availability. They hopped to have some by February, unfortunatelly, no TypeMatrix skins are available yet :'(.

While the keyboard I am working with has an interesting background, and I really love it in some way, I am quite hurried to change it because is has some electronics problems and from time to time, I have to twist the PS2 cable to be able to type-in again or stop the keyboard from sending endlessly the same characterrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.

Feb
1

Posted on February 1st, 2009 at 12:00 am February!

Tadaaam!

According to the answer I got for an e-mail sent earlier this year to the guys at TypeMatrix, the TypeMatrix 2030 skins will be available this month:

On Mon, Jan 5, 2009 at 2:47 AM, Romain Tartière wrote:
> Hi!
> 
> 2030 is available again ! Great! But I can't find the skins in the shop. I
> would be interested in a Dvorak keyboard with a black qwerty skin. How to
> proceed ? May I pre-order a dvorak keyboard now ?
> 
>  Thank you!

Romain --
  
Yes, we are back!  but the skins are not yet available.  We are working on
them now and hope to have some by February.  Check back with us then!
  
The Dvorak-labeled keyboards are due to arrive this week, so we will have
all three keyboards ready for shipping out: Qwerty, Dvorak, blank.

I'm impatient!

Dec
20

Posted on December 20th, 2008 at 2:39 pm Why you should not use old-style PGP encrypted / signed messages

Just received another mail signed in the the old-style way:

-----BEGIN PGP SIGNED MESSAGE----- (1)
Hash: SHA1 (2)

Hello,

[...]
Cordialement
- -- (3)
[...]
Membre de l'April - « promouvoir et défendre le logiciel libre » -
[...]

-----BEGIN PGP SIGNATURE----- (4)
Version: GnuPG v1.4.9 (GNU/Linux) (5)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

sDJOSYR9U4W6YR8d794Y5f0296J0Fg9847ED904h780592347dJ5F924e3UoiY58
reptup34eo8t9568gdfg8spf2dgj3Fdf
=iDPk
-----END PGP SIGNATURE----- (6)

First, it is really painful since a lot a junk prevent the mail from being read easily:

Jun
22

Posted on June 22nd, 2008 at 8:20 pm Downgrading to the last stable GNOME version

I decided to stop tracking the development version of GNOME and revert to the stable version available through the FreeBSD ports tree. I wanted to avoid dropping every single package and re-installing everything but the system from scratch, so I tried to handle too-much up-to-date packages and update them to the last stable version (ie. with a lower version number).

May
9

Posted on May 9th, 2008 at 9:47 pm [patch] Opening the fridge from the right side

Most of the time, you open(2) a fridge device on the left side. Most fridge implementation ./configure scripts however support a --open-from-the-right-side switch so that you compile a device that fits your environ(7).

Apr
22

Posted on April 22nd, 2008 at 1:43 am You, bash users, are driving me crazy!

This is a visceral message with a lot of emotion (I mean I am not thinking before writing) so I will exceptionally use my big voice:

WILL YOU EVER BASH SCRIPTS WRITERS STOP THIS INSANE MESS WITH THIS SHELL?

Details bellow... with some words in capital letters as proposed by [RFC2119].

Apr
12

Posted on April 12th, 2008 at 2:32 pm Raid-1 using gmirror(8)

When configuring Astase development server, I set up software mirroring using FreeBSD gmirror. This is much more a memo than a technical note, but I decided to blog about it anyway.

In this post, the disk where FreeBSD was installed is ad4 and will be referred as the first disk, while the disk that we will configure for mirroring is ad6 and will be referred as the second disk. FreeBSD is installed on the second slice of the disk using the default partition scheme.

Both disks have been sliced the same way when installing using sysinstall(8). It would of course have been possible to use fdisk(8) to do this. If both disks are identical, the quick way of doing this is to copy the slice table:

# fdisk -p ad4 > /tmp/slices
# fdisk -f /tmp/slices ad6