dimanche, septembre 09, 2012

FreeBSD kernel for Nintendo Wii

Few months ago I've subsrcibed to the FreeBSD "svn-src-head" mailing-list for being notified of every change to the -current source tree.
And some weeks ago I've seen this message: Initial support for running FreeBSD on the Nintendo Wii.

What ??? FreeBSD is going running on Wii ???

I've looked for more information and found a small page that explain how to build it on the wiki: FreeBSD/Wii.
The commit message includes an important detail: "There are still some MMU problems and to get a working system you need to  patch locore32.S. Since we haven't found the best way yet to address that problem, we're not committing those changes yet."

  1. The -current code is incomplete, but meanwhile we can apply this locore32.S unofficial patch.
  2. The result is not usable: You will not obtain a shell prompt, it will hang before.
Here is the video of the boot process:



For building the kernel you need -current source tree, then the steps for building this kernel are pretty simple:

cd /usr/src
fetch http://gugus69.free.fr/freebsd/wii/locore32.diff
patch < locore32.diff
mkdir /tmp/WII
setenv MAKEOBJDIRPREFIX /tmp/WII ; make TARGET=powerpc TARGET_ARCH=powerpc buildworld
setenv MAKEOBJDIRPREFIX /tmp/WII ; make TARGET=powerpc TARGET_ARCH=powerpc KERNCONF=WII buildkernel

It will generate a kernel for WII here:
/tmp/WII/powerpc.powerpc/usr/src/sys/WII/kernel

Then follow instructions from FreeBSD/wii wiki page for setup the SD card.

You can download my own FreeBSD/Wii archive (to be extracted on the root of your SD card).

mercredi, août 22, 2012

My home NAS: HP ProLiant MicroServer

My old NAS system was dying, I need to found a new one…
Here is my new setup:
I've found lot's of advices regarding the setup of the HP MicroServer on TechForum.
Before installing FreeNAS on it, I'm playing with a small FreeBSD 9.0 installation on the USB key.
FreeBSD was installed without any package neither the port-tree: I'm using pkgng with my own package repository (thanks to poudriere).
The only problem that I found, was to correctly disable moused: A simple moused_enable="NO" in the /etc/rc.conf is not enough, I need to add moused_ums0_enable="NO" for disable it.
I've create 2 raid-z pools: A first with the internal hard-drives, a second with the external drives.

Now I've got lot's of disk space for my files:


[root@nas]/#zpool list
NAME       SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
estorage  4,53T   912K  4,53T     0%  1.00x  ONLINE  -
storage   9,06T  6,56T  2,50T    72%  1.00x  ONLINE  -







lundi, mars 19, 2012

OpenBSD 5.1 installation on softraid(4)

OpenBSD 5.1 brings new cool features like this one:

"boot(8/amd64) is teached how to access softraid(4) volumes, which allows a kernel to be loaded from a softraid RAID 1 volume. Furthermore it is sufficient to only boot from a disk that is a member of a bootable softraid volume, as this case will be detected and the boot will automatically be redirected to sr[0-9]a:/bsd."

This mean that the bootloader can boot directly from a softraid(4) partition: No more "standard" partitions needed with kernel copied on them on both hard drive!


Here is how to proceed:
During your CD-ROM boot, check that you have a minimum of 2 hard drives detected:
CD-ROM: E0
Loading /5.1/AMD64/CDBOOT
probing: pc0 com0 mem[639K 126M a20=on]
disk: hd0+* hd1+* cd0
>> OpenBSD/amd64 CDBOOT 3.16
boot>

Continue the boot process and select to launch a shell:


Welcome to the OpenBSD/amd64 5.1 installation program.
(I)nstall, (U)pgrade or (S)hell? s

Display the names of the disks detected by OpenBSD:


# sysctl hw.disknames
hw.disknames=wd0:7922594e8158ee03,wd1:49129150e28daf19,cd0:,rd0:7c8ac10ea613493f

On this example (Virtualbox VM), we've got 2 SATA hard-drives: wd0 and wd1 (cd0 is the CD-ROM and rd0 is the RAM drive created by the kernel).
By default OpenBSD create only one /dev for the first hard drive, we need to create a second and initialize a MBR to them:

# cd /dev/
# sh MAKEDEV wd1
# fdisk -iy wd0
Writing MBR at offset 0.
# fdisk -iy wd1
Writing MBR at offset 0.

Now, we need to create a BSD label named "raid" to both disks.
We will create a BSD label for the first drive, and dump/restore the label table to the second drive:

# disklabel -E wd0
Label editor (enter '?' for help at any prompt)
> a a
offset: [64]
size: [20964761]
FS type: [4.2BSD] raid
> q
Write new label?: [y] 
# disklabel wd0 > protofile
# disklabel -R wd1 protofile


Now we can create a softraid(4) volume using the two "a" partitions :

# bioctl -c 1 -l wd0a,wd1a softraid0 
sd0 at scsibus1 targ 1 lun 0: SCSI2 0/direct fixed
sd0: 10236MB, 512 bytes/sector, 20964233 sectors
softraid0: SR RAID 1 volume attached as sd0

This will create a new drive: sd0 in this example.
Return back to the OpenBSD installer (Ctrl+D), and select this new softraid disk for the destination root disk:

# ^D
erase ^?, werase ^W, kill ^U, intr ^C, status ^T

Welcome to the OpenBSD/amd64 5.1 installation program.
(I)nstall, (U)pgrade or (S)hell? i

(etc...)

Available disks are: wd0 wd1 sd0.
Which one is the root disk? (or 'done') [wd0] sd0

Once installed, simply reboot and enjoy:


>> OpenBSD/amd64 BOOT 3.18
boot>
booting sr0a:/bsd: 5648376+1600524+932384+0+616448 [89+497880+322605]=0xd2d0a8
entry point at 0x1001e0 [7205c766, 34000004, 24448b12, ccb8a304]
(etc...)
sd0 at scsibus2 targ 1 lun 0: SCSI2 0/direct fixed
sd0: 10236MB, 512 bytes/sector, 20964233 sectors
root on sd0a (f7748118e1f577a4.a) swap on sd0b dump on sd0b
Automatic boot in progress: starting file system checks.
(etc...)




samedi, janvier 28, 2012

Installing Samsung ML-2950 series printer drivers on FreeBSD

I've just replaced my inkjet printer with a laser one (Samsung ML-2955ND: Netword and Duplex).
Samsung provide drivers for lot's of OS (HP-UX, IBM AIX, GNU/Linux, MacOSX, etc…) but nothing for FreeBSD :-(

Hopefully the GNU/Linux drivers is CUPS based and use standard PPD file… But with a binary only cups-filter.
I didn't know if it was possible to use the Linux emulation layer of FreeBSD for using this cups-filter, but a previous experience was successful, then I try it too.


The major idea is to:

  1. Install print/cups
  2. Enable and install the FreeBSD Linux binary compatibility
  3. Getting the Samsung Unified drivers for the ML-2950 series
  4. Extracting the PPD file and the i386 binary cups-filter used by the PPD
  5. Fixing the missing dependency needed by the samsung cups-filter

I will not explain the steps 1,2 and 3.

Extract the Unified Linux Drivers:
$ tar zxvf ULD_Linux_V1.00.06.tar.gz

Then check the filter used by the PPD file:

$ grep cupsFilter uld/noarch/share/ppd/Samsung_ML-2950_Series.ppd
*cupsFilter:  "application/vnd.cups-raster 0 rastertospl"

=> This PPD file use the "rastertospl" filter.


Now copy the PPD and the Samsung cups-filter to the local cups directories:
$ mkdir /usr/local/share/cups/model/samsung
$ cp uld/noarch/share/ppd/Samsung_ML-2950_Series.ppd/usr/local/share/cups/model/samsung/
$ cp uld/i386/rastertospl /usr/local/libexec/cups/filter/

Once copied, you can execute rastertosamsungspl from a CLI for displaying the missing Linux libs:

# /usr/local/libexec/cups/filter/rastertospl
/usr/local/libexec/cups/filter/rastertosamsungspl: error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory

There are two method here:

The first and easiest is simply to install print/linux-f10-cups-libs. It should install all dependency needed by the crappy Samsung binary filter (Thanks Patrick for this tips!)

The second, a lot's more complex, and that add lot's of file not managed by the FreeBSD package manager is to check for missing libs one by one: You need to install the missing libs, running a ldconfig and re-execute rastertosamsungspl for discovering that another libs is missing.
Here is the list of all libs that I've installed:
# cd /tmp
# fetch http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/10/Everything/i386/os/Packages/cups-libs-1.3.9-2.fc10.i386.rpm
# fetch http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/10/Everything/i386/os/Packages/gnutls-2.4.2-2.fc10.i386.rpm
# fetch http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/10/Everything/i386/os/Packages/libtasn1-1.5-1.fc10.i386.rpm
# fetch http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/10/Everything/i386/os/Packages/libgcrypt-1.4.3-2.fc10.i386.rpm
# fetch http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/10/Everything/i386/os/Packages/libgpg-error-1.6-2.i386.rpm
# cd /compat/linux
# rpm2cpio /tmp/cups-libs-1.3.9-2.fc10.i386.rpm | tar -zxf -
# rpm2cpio /tmp/gnutls-2.4.2-2.fc10.i386.rpm | tar -zxf -
# rpm2cpio /tmp/libtasn1-1.5-1.fc10.i386.rpm | tar -zxf -
# rpm2cpio /tmp/libgcrypt-1.4.3-2.fc10.i386.rpm | tar -zxf -
# rpm2cpio /tmp/libgpg-error-1.6-2.i386.rpm | tar -zxf -
/compat/linux/sbin/ldconfig


Once all dependencies are installed, you should have this message when executing rastertosamsungspl:

# /usr/local/libexec/cups/filter/rastertosamsungspl 
INFO: Usage: rastertosamsungspl job-id user title copies options [file]
ERROR: Wrong number of arguments

Now you can add your printer from the CUPS admin panel and use it :-)

mercredi, octobre 05, 2011

BSD Router Project: Version 1.0 disponible

Cela faisait plusieurs mois qu'il n'y avait pas eu de nouvelle version de ce routeur libre: C'est corrigé depuis cette nuit.
Et comme j'ai passé pas mal de temps à le tester dans tous les sens, je me suis dit que cette version méritait finallement de passer directement en 1.0.
J'ai par contre découvert une grosse limitation concernant la protection des protocoles de routages IPv6 sous FreeBSD (RIPng et OSPFv3): Ces protocoles n'incluent plus leur propre mécanismes de sécurité mais les délèguent à la couche IPSec d'IPv6. Cela veux dire que nous devons passer par setkey(8) pour configurer des SAD/SPD manuels les protégeant.… Or la couche IPSec de FreeBSD ne sait pas gérer les adresses multicast et l'usage du multicast est très courant en IPv6 (RIPng et OSPFv3 l'utilisent). Cette limitation est assez bloquante car elle ne permet pas d'avoir le même niveau de protection des réseaux RIP/OSPF en IPv6 qu'en IPv4 sous FreeBSD.

J'ai aussi amélioré les scripts VirtualBox (PowerShell et Shell) permettant de lancer les labs virtuels facilement pour qu'ils prennent en charge les fonctionnalités de linked-type-clone et Page Fusion: Le gain en ressource pour la machine hôte est impressionnant!
Par exemple sur le lab BGP route reflector/confederation qui nécessite le lancement de 7 routeurs, donc 7 VMs (avec 128Mo de RAM et 256Mo de disque alloué à chacune):
  • La fonctionnalité «linked-type-clone» permet de ne consommer que 153Mo d'espace disque pour l'ensemble des VMs: Le template de référence utilise 80Mo et chacun des clones 10Mo.
  • La fonctionnalité «Page Fusion», elle, permet de ne consommer que 112Mo de RAM pour l'ensemble des VMs (environ 16Mo par VM).
Pour la suite, va falloir que je travaille un système de centralisation/gestion des configurations et pourquoi pas permettre le pre-provisionning des configurations pour du déploiement grande échelle.

lundi, août 29, 2011

Pourquoi ne jamais utiliser iperf sur FreeBSD

J'ai enfin eu le temps de remonter mon petit lab pour faire quelques tests de performance réseaux avec BSDRP:
  • Un PC Engines wrap1e203, qui va me servir de routeur (Geode à 233Mhz)
  • Deux clients léger HP Compaq T5000 (Transmeta Crusoe à 800Mhz)
  • Un switch gigabit
L'avantage d'utiliser des vieilles machines FastEthernet est qu'elles sont plus faciles à saturer que des nouvelles supportant le gigabit.
Avant de tester les perfs de routage du WRAP, j'ai commencé par noter ma valeur de référence, en mesurant les perfs réseaux maximum des HP Compaq T5000.
Pour cela il existe plusieurs logiciels, le plus connus étant iperf. Mais sur les différentes mailing-list FreeBSD, j'ai souvent lus que iperf «ça pue car codé par des linuxiens et donc incapable d'utiliser le pleins potentiel de FreeBSD».
Dans le doute, j'ai donc aussi utilisé netblast (les sources sont cachées dans /usr/src/tools/tools/netrate/netblast, et il n'est pas installé par défaut).
D'ailleur concernant netblast sur sparc64: Il faut le patcher pour corriger un problème d'alignement.
Bref, lancons nos tests (en UDP et avec les tailles de paquet au max), et voici les résultats:
  • iperf: 60Mbit/s
  • netblast : 80Mbit/s
Le verdict est sans appel en faveur de netblast!
Et après avoir activé le polling, j'ai pus monter jusqu’à 92Mbit/s: On arrive presque au 100Mbit/s de leur carte réseaux… Pas mal du tout pour ces petites bêtes.

dimanche, août 28, 2011

Backporting Intel PRO/Wireless 6205a FreeBSD 9.0 modules to 8.2

My old professionnal Dell Latitude D630 laptop was replaced by a new Dell Latitude E5420… and this new one have a wireless chipset not supported on FreeBSD 8.2:

[root@laptop]~#dmesg | grep iwn
iwn0: <Intel(R) PRO/Wireless 6205a> mem 0xe5300000-0xe5301fff irq 17 at device 0.0 on pci2
0xe5300000-0xe5301fff irq 17 at device 0.0 on pci2
iwn0: MIMO 2T2R, MoW, address a0:88:b4:7d:40:9c
iwn0: [ITHREAD]
iwn0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
iwn0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
iwn0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
iwn6005fw: could not load firmware image, error 2
iwn0: iwn_read_firmware: could not load firmare image "iwn6005fw"
iwn0: iwn_init_locked: could not read firmware, error 22



But, this new chipset is supported on FreeBSD-current, then I've backported it to 8.2.
I had to do 3 small changes in if_iwn.c file : One function name to revert (pci_find_cap to pci_find_extcap), and remove 2 lines (use of ic_rxstream and ic_txstream).
You can install this drivers like this:

cd /tmp
fetch http://gugus69.free.fr/tools/FreeBSD-8.2-iwn-current.tgz
cd /
tar zxvf /tmp/FreeBSD-8.2-iwn-current.tgz
cd /usr/src
make buildkernel
make installkernel
reboot

I've tested Internet browsing and small files transfert with this drivers without problem.

dimanche, août 14, 2011

Creating and starting VirtualBox machine with PowerShell

BSD Router Project provided a VBScript for starting MS Windows based virtualbox lab. But because this vbs script works only on XP, I had to found a more powerful solution: Why not discovering PowerShell and using the VirtualBox COM API ?
I didn't found very detailed examples, then here is a PowerShell script that explains how to create, configure and start a VirtualBox Machine.
The goal is:
  1. Create a VM (OS type: FreeBSD_64)
  2. Configure it (with a serial port that redirect to a pipe)
  3. Convert a unzipped BSDRP-full-amd64-vga disk image file to a VDI file, and attach this VDI to the VM
  4. Start the VM
And here are the big steps of this script:
  1. Initialize the COM API
  2. Create the VM
  3. Configure the VM (excluding attaching medium to it)
  4. Save and register the VM
  5. Convert a RAW file to VDI (using VBoxManage.exe) and registering it
  6. Lock the VM in write mode for attaching the medium
  7. Launch the VM
Now the PowerShell code sample:

lundi, mars 21, 2011

Serveur NFS v4 avec FreeBSD

NFS v4 possède quelques avantages bien sympa: En plus de la possibilité de s'appuyer sur kerberos, il utilise un seul port TCP (très pratique lorsqu'il se trouve derrière un firewall).
Cet exemple montre sa mise en place, et les problèmes rencontrés pour un fonctionnement sans l'authentification kerberos avec FreeBSD (8.1 et 8.2).
On commence par lire nfsv4(4), qui nous indique que pour activer le serveur NFS v4 il faut:

1. Ajouter 3 lignes dans le /etc/rc.conf:
nfs_server_enable="YES"
nfsv4_server_enable="YES"
nfsuserd_enable="YES"

2. Créer un fichier nfs-stablerestart (en root):

install -o root -g wheel -m 600 /dev/null /var/db/nfs-stablerestart

Maintenant on passe à la lecture du exports(5) qui, pour NFS v4 est un peu plus complexe.
Mon but est de partager le dossier /home/olivier en lecture seule, le fichier exports se résume donc à 2 lignes:
V4: /
/home/olivier -ro 127.0.0.1

Puis je lance les services:
/etc/rc.d/nfsd start
Starting mountd.
Starting nfsd.

/etc/rc.d/nfsuserd start
Starting nfsuserd.


Aucun message d'erreur, ça semble bon, maintenant affichons la liste des exports:
showmount -e
Exports list on localhost:

Rien :-(
Et aucun message dans les logs indiquant une erreur dans le fichier exports.

On va quand même essayer:
mount -o nfsv4 localhost:/home/olivier /mnt/
nfsv4 err=10029
mount_nfs: /mnt, : Input/output error

Le message d'erreur le plus intéressant ici est le «nfsv4 err=10029», je n'ai pas trouvé grand chose sur le net concernant ce message, sauf une petite note dans le draft nfsv4:

NFS4ERR_SYMLINK (Error Code 10029)
The current filehandle designates a symbolic link when the current operation does not allow a symbolic link as the target.

Je n'avais pas fait attention à un détail du exports(5):
«The pathnames must not have any symbolic links in them»

Et sur FreeBSD le dossier /home est un lien symbolique qui pointe sur /usr/home.
On corrige donc le fichier /etc/exports:
V4: /
/usr/home/olivier -ro 127.0.0.1

Et on demande à mountd de charger ce nouveau fichier:
/etc/rc.d/mountd reload

Vérifions si c'est mieux 
showmount -e
Exports list on localhost:
/usr/home/olivier                  127.0.0.1

Cool, maintenant je vais pouvoir le monter (en localhost pour débuter):
mount -o nfsv4 localhost:/usr/home/olivier /mnt/
mount | grep olivier
localhost:/usr/home/olivier on /mnt (newnfs)


Parfait, maintenant on liste les fichiers sur du dossier /mnt
ls /mnt/
ls: /mnt/: Input/output error

Bon, ça ne fonctionne toujours pas :-(
Qu'est que ce bordel ?
Voici la commande qui donne un indice sur ce problème:
netstat -a | grep nfsd
tcp6       0      0 localhost.nfsd         localhost.18082        ESTABLISHED
tcp6       0      0 localhost.18082        localhost.nfsd         ESTABLISHED
tcp6       0      0 localhost.621          localhost.nfsd         TIME_WAIT
tcp6       0      0 *.nfsd                 *.*                    LISTEN
tcp4       0      0 *.nfsd                 *.*                    LISTEN
udp6       0      0 *.nfsd                 *.*
udp4       0      0 *.nfsd                 *.*

Et oui, je n'ai autorisé que l'IP 127.0.0.1 à accéder à mon partage dans mon /etc/exports, et la commande mount localhost a utilisé l'IPv6 localhost (::1) pour s'y connecter.
On va donc forcer un montage en utilisant la pile IPv4:
umount /mnt/
mount -t nfs -o nfsv4 127.0.0.1:/usr/home/olivier /mnt/
ls /mnt
.complete                           .mailrc                                
.cshrc                              .profile                                   
.history                            .rhosts                              
.lesshst                            .shrc                                                    
.lftp                               .ssh                                
.login                              .viminfo                            
.login_conf                         .vimrc                              

Enfin, cela fonctionne en local :-)
Comme je veux le monter aussi en IPv6, j'ajoute donc ::1 à ma liste d'IP autorisées:
V4: /
/usr/home/olivier -ro 127.0.0.1 ::1

Maintenant que le montage local IPv4/IPv6 fonctionne, on édite le /etc/exports pour y autoriser les subnets du LAN:
V4: /

/usr/home/olivier -ro -network 2a01:e35:aaaa:aaaa::/64
/usr/home/olivier -ro -network 192.168.100.0

Puis on recharge mountd et vérifie que le fichier exports a été correctement interprété:
/etc/rc.d/mountd reload
showmount -e
Exports list on localhost:
/usr/home/olivier                  2a01:e35:aaaa:aaaa:: 192.168.100.0

Note concernant un client sous Linux, la syntaxe de la commande mount est la suivante:
mount -t nfs4 server-name:/usr/home/olivier/ /mnt

Donc, à noter pour la configuration NFS v4:
  1. Ne pas oublier de créer le fichier /var/db/nfs-stablerestart
  2. Ne pas déclarer de chemin utilisant des liens symboliques dans le fichier exports
  3. Si showmount -e n'indique rien suite au rechargement de mountd, ce n'est pas la peine de continuer
  4. Attention aux doubles piles IPv4/IPv6, n'oubliez pas de déclarer aussi les IPv6 dans votre exports
  5. Ce n'est pas parce que le montage s'effectue que vous êtes autorisé

dimanche, mars 13, 2011

FreeBSD packages generator

  
Update (8 april 2011): There is a best method detailled here (in french)

Using up-to-date ports on my old workstations became more and more painful (more than 8 hours for compiling the latest LibreOffice).
Then I've decided to use my brand new server (used for generating BSD Router Project images and running BSDRP routing labs using virtualbox) as a FreeBSD packages generator.
But I've faced to a problem with the "make package-recursive" command on FreeBSD:
The port needs to be installed before generating the package! And I didn't want to install useless programs  (xorg, hal, etc…) on my server.
Then I've wrote small ugly script that:

  1. Generate a full new freebsd in a working dir (downloading FreeBSD base, src and lib32 sets).
  2. Update the local port tree
  3. Launch a chrooted portmaster into the working dir for generating the packages.

This script, package_gen.sh, is to be use like that:

Package generator usage:
./package_gen.sh COMMAND [familly/port-name] [build-option]
Where COMMAND can be:
 generate [familly/port-name] [build-option]
 upgrade [port-name] [build-option]
 replace familly/port-name familly/port-name
 delete [familly/port-name]
examples:
./package_gen.sh generate sysutils/tmux                         : Generate tmux package
./package_gen.sh generate editors/vim-lite -DWITHOUT_X11        : Generate vim-lite package without X11 stuffs
./package_gen.sh generate editors/libreoffice LOCALIZED_LANG=fr : Generate french libreoffice
./package_gen.sh upgrade                                        : Upgrade all packages previously generated
./package_gen.sh delete editors/vim-lite                        : Delete vim-lite
 


All generated packages are in /usr/ports/packages.

Once generated or upgraded, I upload them onto a web server using a small lftp script (-f option):


  set ftp:list-options -a
  set cmd:fail-exit true
  debug -o /home/USER/lftp_debug.log 3
  open -p 21 LOGIN:PASS@ftpperso.free.fr
  cd /packages/8.2/amd64/Latest
  lcd /usr/ports/packages/Latest
  mirror -eRL --only-newer --parallel=2 --verbose=4
  cd /packages/8.2/amd64/All
  lcd /usr/ports/packages/All
  mirror -eRL --only-newer --parallel=2 --verbose=4
 quit
 


This lftp script replaces symbolic links found in /usr/ports/packages by the real file.
Now, from my workstations, I can install up-to-date ported software with this command:

env PACKAGESITE=http://gugus69.free.fr/packages/8.2/amd64/Latest/ pkg_add -r openjdk6

You can use this package repository freely. I will try to kept it online (if my ISP accept this uses) and up-to-date.
But here are some information about theses packages:
  • FreeBSD amd64 8.2 only
  • www/firefox-i8n include only french language pack
  • emulators/qemu with kqemu support and GNS3 patch
  • java/jdk16 is compiled with IPv6 enabled


vendredi, février 11, 2011

How to enable receiving UDP syslog message on Ubuntu

After loosing lot's of my precious time, here is how to enable receiving remote syslog message on a Ubuntu server 10.04 LTS:

  1. Create a new file in /etc/rsyslog.d/ and call it udp_server as example:
    • vim /etc/rsyslog.d/udp_server
  2. Add these 2 lines:
    • $ModLoad imudp
    • $UDPServerRun 514
  3. Restart rsyslog: sudo service rsyslog restart
  4. Check that it's working:
    • echo "FreeBSD rocks!" | nc -w0 -u 127.0.0.1 514
    • sudo tail /var/log/messages

Don't modify the file /etc/rsyslog.conf, it's not used at all !

dimanche, octobre 10, 2010

FreeBSD developer summit 2010, Karlsruhe


Je viens de terminer mon premier FreeBSD developer summit que j'ai vraiment adoré.
La dernière conférence BSD à laquelle j'ai participé était la BSDCan 2007 et je n'avais pas participé au dev summit (d'ailleurs je ne savais même pas que ca existait à cette époque).
Mais qu'est ce qu'un dev summit exactement ?
Il s'agit d'une rencontre se déroulant sur 2 jours juste avant l'EuroBSDCon qui permet de rencontrer physiquement la majorité des personnes qui contribuent au projet FreeBSD (seul les contributeurs et quelques invités y participent).
Chacune des 2 journées du dev summit se décomposent en 3 parties:

  • Le matin, dans le grand amphi: Les personnes présentent l'état de leurs travaux (environ 10 minutes de présentation et 5 minutes de questions).
  • L'après midi a lieu différents ateliers sur des thèmes spécifiques.
  • Le soir: Le resto on l'on essaye de discuter d'autre chose que de «geekerie» (mais c'est très très dur vus le profil de la population présente ).

Le nombre de personne qui viennent de loin pour ces quelques jours (US et Japon en particulier) est impressionnant. On y rencontre bien sur pas mal de personne travaillant pour iXsystems (Warner Losh, Dru Lavigne, Kris Moore, Alexander Motin).

Voici quelques sujets abordés le matin:

  • ringmap : Une autre approche différente de «zero_copy» permettant d'éviter toute recopie interne d'un paquet lors de son traitement. Cette techno à été mise au point pour la capture de paquet à haut débit, mais elle va être très intéressante concernant les améliorations de performance de routage.
  • VPS: C'était LA présentation que j'attendais. Voir des VPS FreeBSD changer de serveur hôte sans impact sur les clients c'est très beaux, tellement que ca fait presque pleurer. Et surout on va pouvoir bientôt leur en foutre pleins sur la gueule à virtuozzo!!!
  • Amélioration de NanoBSD: Synthèse des différents problèmes que j'ai rencontré avec nanoBSD et les solutions proposées
  • FreeNAS: Warner Losh a présenté l'état actuel de la récupération du projet par iXsystems.
  • FreeBSD Virtualbox Image for Port Mainteners, basée sur FreeBSD -current elle inclue une tinder box pré-configurée pour pour valider ses ports FreeBSD (7,8,-current)… Il va falloir que je test ce truc.
  • La documentation: Comment simplifier la contribution à la doc ?
  • PC-BSD: Les utilisateurs de PC-BSD, par leurs usages différents remontent pas mal de bug non détecté par les admins systèmes de FreeBSD. Comment améliorer la synergie entre PC-BSD et FreeBSD ?
  • Et pleins d'autres sujets: la gestion des ports, des trucs concernant le noyau dont je ne comprends rien, etc… La liste est sur le wiki.


Au sujet les ateliers de l'après-midi, par exemple celui sur FreeNAS, on profite de la présence dans la même pièce de plusieurs personnes clés:

  • Warner Losh, qui récupère la responsabilité du projet chez iXsystems
  • Martin Matuska qui contribue à l'import ZFS dans FreeBSD
  • Alexander Motin qui développe entre autre le système CAM ATA… entre autre

Pour discuter «performance, tunning» et autre. Bref le résultat est «vivement FreeNAS 8 car le support du ZFS dans FreeBSD 7 n'est pas terrible du tout» (que soit au niveau des perfs et même de la stabilité).

J'ai aussi profité de la présence de Kris Moore (PC-BSD) pour qu'il me montre sa version de travail du futur PC-BSD (qui supportera plusieurs gestionnaires de bureau comme Gnome et LXDE4 et ne reste plus limité à KDE). Il lui reste à finir l'homogénéisation des différents thèmes et menu. Cela à l'air vraiment prometteur (résultats dans 1 ou 2 mois).

Conclusion: Je vais essayer de me refaire inviter pour celui de l'année prochaine. Car même pour un petit contributeur le dev summit permet d'échanger énormément en seulement 2 jours !
Le seul problème est que les journées se terminent tard (1h du matin), ce qui ne m'a pas laissé le temps d'aller visiter Karlsruhe :-(

vendredi, août 27, 2010

Mise à jour du firmware OBP d'une Sun Blade 100/150 par le réseau

La procédure officielle de mise à jour du firmware OBP nécessite d'installer le firmware (119235-01.zip) sur la partition / du Solaris, puis de lancer la mise à jour en démarrant sur le fichier de firmware.
Oui mais si l'OS installé sur la Sun Blade n'est pas un Solaris, comment je fait ?
Il est heureusement possible de faire cette mise à jour à travers le réseaux en utilisant:
  1. Un serveur rarp qui va donner une IP à la station Sun Blade
  2. Un serveur tftp sur lequel la Sun Blade ira chercher sa mise à jour
Voici comment le faire à partir d'une station FreeBSD…

On commence par noter l'addresse MAC de la Sun Blade, c'est facile, elle est affichée au démarrage:

Sun Blade 150 (UltraSPARC-IIe 650MHz), No Keyboard
Copyright 1998-2003 Sun Microsystems, Inc.  All rights reserved.
OpenBoot 4.10.6, 1024 MB memory installed, Serial #57463918.
Ethernet address 0:3:ba:6c:d4:6e, Host ID: 836cd46e.

On va commencer par configurer notre serveur rarp pour qu'il donne une IP dans la même plage que votre interface Ethernet, exemple avec 192.168.100.49:

echo "0:3:ba:6c:d4:6e 192.168.100.49" > /etc/ethers

Puis on lance le serveur rarpd en précisant l'interface d'écoute, exemple avec bge0:

rarpd bge0

Reste à décompresser l'archive du firmware et mettre le fichier «flash-update-Blade100-Blade150-latest» dans le dossier /tftpboot.
Mais là, il y a une astuce:
Comment la sun blade, à son démarrage, va connaitre le nom du fichier à aller chercher ?
Suite à sa requêtte RARP, elle n'obtiendra qu'une seule information: Son addrresse IP.
Et c'est là qu'est l'astuce: La station va convertir son adresse IP en hexa, et aller chercher un fichier ayant comme nom cette valeur hexa.
Donc, dans mon exemple, j'ai choisi de donner l'IP 192.168.100.49, le nom du fichier que la station ira chercher sera donc:

echo 192.168.100.49 | awk -F . '{ printf "%02X%02X%02X%02X\n", $1, $2, $3, $4 }'

C0A86431

On créer une copie de flash-update-Blade100-Blade150-latest ayant ce nom:
cd /tftpboot
ln flash-update-Blade100-Blade150-latest C0A86431

Ne reste plus qu'a lancer le serveur tftpd en éditant le /etc/inetd.conf et en décommentant la ligne commencant par «tftp    dgram   udp ...»
Une fois modifié, on lance inetd:
/etc/rc.d/inetd onestart

C'est normallement terminé pour le serveur RARP/TFTP, mais on peux lancer un tcpdump pour suivre l'échange:

tcpdump -i bge0

Avant d'allumer la Sun Blade, on l'ouvre pour vérifier que les jumpers de la flash sont bien en position «écriture» (cf le fichier flashprom-jumper-diagram.ps inclus dans l'archive pour plus d'info).

Une fois le jumper en bonne position (vous pouvez le laisser définitivement comme ça), on démarre la Sun Blade, un petit break pour se retrouver dans l'OBP, et il suffit de lui demander de booter par le réseau:

boot net

Coté serveur RARP/TFTP, votre écran tcpdump devrais s'activer (c'est bon signe):

02:23:07.113609 ARP, Reverse Request who-is 192.168.100.49 tell 192.168.100.49, length 50
02:23:07.113962 ARP, Reverse Reply 192.168.100.49 at 192.168.100.49, length 28
02:23:07.114294 IP 192.168.100.49.59141 > 192.168.100.2.tftp:  17 RRQ "C0A86431" octet
02:23:07.121913 IP 192.168.100.2.24672 > 192.168.100.49.59141: UDP, length 516
02:23:07.128807 IP 192.168.100.49.59141 > 192.168.100.2.24672: UDP, length 4
02:23:07.128843 IP 192.168.100.2.24672 > 192.168.100.49.59141: UDP, length 516

Et du coté de la Sun Blade, le lancement de la mise à jour:

Standalone Flash PROM Update Utility, Rev. 3.0
            Ultra(tm) 1
            Ultra(tm) 2
            Ultra(tm) 5/10
            Ultra(tm) 30
            Ultra(tm) 60 / E220R / Netra T1120/1125
            Ultra(tm) 80 / E420R / Netra T1400/1405
            Ultra(tm) Enterprise(tm) 250
            Ultra(tm) Enterprise(tm) 450
            Sun Blade(tm) 100
            Sun Blade(tm) 1000
            Sun Blade(tm) 1500
            Sun Blade(tm) 1500 (Silver)
            Sun Blade(tm) 2500
            Sun Blade(tm) 2500 (Silver)
80R             Sun Fire (tm) 2\
            Sun Fire (tm) 480R / Sun Fire V490
            Sun Fire (tm) 880 / Sun Fire V890
            Netra(tm) T4
            Sun Fire (tm) V210/V240,Netra 240
            Sun Fire (tm) V440, Netra 440


This utility allows you to interactively update the firmware
revisions in specific system Flash PROM components.
type h for help, q to quit, Return or Enter to continue: |


Every precaution should be taken to prevent the loss of system
power during the Flash PROM programming process!

type h for help, q to quit, Return or Enter to continue: -


       Firmware Release(s)                Firmware Release(s)
 Currently Existing in the System      Available for Installation  /  Install?
---------------------------------- -------------------------------------------
OBP 4.10.6 2003/06/06 12:30        OBP 4.17.1 2005/04/11 14:31          no
2.0.1 2001/08/23 17:13          no POST |

Type sa if you wish to select all available firmware releases for installation.  Type h for help, quit to exit, or cont to continue: /
sa
=>  You've selected the same revision of POST firmware
=>  as that which is currently installed.
=>  You've selected the same revision of POST firmware
=>  as that which is currently installed.
=>  Do you REALLY want to do that?? (y/[n]) /
y

      Firmware Release(s)                Firmware Release(s)
 Currently Existing in the System      Available for Installation  /  Install?
---------------------------------- -------------------------------------------
OBP 4.10.6 2003/06/06 12:30        OBP 4.17.1 2005/04/11 14:31          YES
POST 2.0.1 2001/08/23 17:13        POST 2.0.1 2001/08/23 17:13          YES

if you wish to select all available firmware releases for 
installation.  Type h for help, quit to exit, or cont to continue: -
cont
The Flash programming process is about to begin.

-ype h for help, q to quit, Return or Enter to continue: \


Erasing the top half of the Flash PROM.
Programming OBP into the top half of the Flash PROM.
Verifying OBP in the top half of the Flash PROM.

Erasing the bottom half of the Flash PROM.
Programming OBP into the bottom half of Flash PROM.
Verifying OBP in the bottom half of the Flash PROM.

Erasing the top half of the Flash PROM.
Programming POST into the top half of Flash PROM.
Verifying POST in the top half of the Flash PROM.

Programming was successful.

Resetting ...

jeudi, août 26, 2010

Installation d'OpenSolaris sur une Sun Blade 150

Jeune propriétaire d'une station Sun Blade 150 (processeur UltraSPARC-IIe 650MHz, 1Go de RAM, 75Go de disque dur IDE et carte graphique additionnelle Sun Graphic VR-500) j'ai essayé de lui installer OpenSolaris pour voir ce que la carte graphique (Sun VR-500) et l'écran Sun de 19' avaient dans le ventre.
L'installation de FreeBSD (par le port série car la carte graphique VR-500 n'est pas supportée) n'a pris que quelques minutes: On démarre sur le CD freebsd-8.1-sparc64, on l'installe, c'est fini... Normal quoi.

Je me dit que cela va être identique pour osol (c'est le petit nom d'OpenSolaris)… Grave erreur.
En effet j'ai téléchargé et gravé l'unique image ISO correspondante à mon matériel sur le site OpenSolaris.org qui est «OpenSolaris 2009.06 SPARC Automated Install Image.iso»… Mais impossible de démarrer le SunBlade sur ce CD!
Après quelques recherches, je découvre que ce CD n'est simplement pas bootable et que pour pouvoir installer la version «Automated Install» il faut obligatoirement passer par un serveur PXE à la sauce Solaris…
L'installation simple d'OpenSolaris à partir d'un CD sur une machine sparc n'est tout simplement pas prévus O_o
Heureusement qu'il y a des gens qui ne sont pas bête et en plus très sympa. Et même que l'une de ces rares personnes a mis au point un live CD d'OpenSolaris pour sparc, et même mieux: Il propose en plus un script d'installation d'OpenSolaris à partir de son liveCD.
Un deuxième joyeux larron a réalisé la capture de l'ensemble du process d'installation (ce qui m'a bien aidé pour mon problème de partition EFI).

Aller, fini pour le blabla, place à l'action:
La galette du liveCD encore chaude est dans le lecteur DVD du SunBlade.
On commence par envoyer un «break» pour appeller l'OBP.
À partir du clavier sun: Stop + A
À partir du port série: Ca dépend de votre émulateur
Une fois dans l'OBP on entre
boot cdrom
On attends que ca ce lance, puis au prompt:
login: root
password: opensolaris
Maintenant il faut activer l'interface réseau. Mais pour cela il faut connaitre son nom:
prtconf -D | grep net
Ca ne me donne «eri», que l'on active par:
ifconfig eri0 plumb
Maintenant il lui faut configurer son IP, soit en statique:
ifconfig eri0 192.168.0.2/24
Soit en dhcp client:
ifconfig eri0 dhcp start
(Attention le DNS n'est pas fonctionnel)
Puis on démarre ssh:
svcadm enable ssh

On va en profiter pour télécharger le script d'install d'osol depuis une autre machine et le transférer par scp sur votre Sun:

[olivier@freebsd]~>fetch http://www.milax.org/files/zfsinstall_sparc
[olivier@freebsd]~>scp zfsinstall_sparc jack@192.168.100.2:/tmp
Password:  jack

Dernière étape avant de lancer l'installation: Connaitre le nom du disque par la commande «format» qui me donne «c4t0d0».
Et vérifier que ce disque utilise le format de partition SMI et non EFI: Comme j'avais déjà installé un FreeBSD qui à créé des partition EFI, j'ai du les supprimer pour créer une seule partition SMI.

root@opensolaris:~# format -e
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c4t0d0
          /pci@1f,0/ide@d/dad@0,0
Specify disk (enter its number): 0
selecting c4t0d0
[disk formatted, no defect list found]
Reading the primary EFI GPT label failed.  Using backup label.
Use the 'backup' command to restore the primary label.
(...)

format> label
[0] SMI Label
[1] EFI Label
Specify Label type[1]: 0
format> partition
(...)

partition> print
Current partition table (unnamed):
Total disk cylinders available: 38307 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0 unassigned    wm       0                0         (0/0/0)             0
  1       swap    wu       0                0         (0/0/0)             0
  2     backup    wu       0 - 38306       74.53GB    (38307/0/0) 156292560
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6        usr    wm       0 - 38306       74.53GB    (38307/0/0) 156292560
  7 unassigned    wm       0                0         (0/0/0)             0

partition> 1
Part      Tag    Flag     Cylinders         Size            Blocks
  1       swap    wu       0                0         (0/0/0)             0

Enter partition id tag[swap]:
Enter partition permission flags[wu]:
Enter new starting cyl[0]:
Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]:
partition> 2
Part      Tag    Flag     Cylinders         Size            Blocks
  2     backup    wu       0 - 38306       74.53GB    (38307/0/0) 156292560

Enter partition id tag[backup]: unassigned
Enter partition permission flags[wu]: wm
Enter new starting cyl[0]:
Enter partition size[156292560b, 38307c, 38306e, 76314.73mb, 74.53gb]: 0
partition> 6
Part      Tag    Flag     Cylinders         Size            Blocks
  6        usr    wm       0 - 38306       74.53GB    (38307/0/0) 156292560

Enter partition id tag[usr]: unassigned
Enter partition permission flags[wm]:
Enter new starting cyl[0]:
Enter partition size[156292560b, 38307c, 38306e, 76314.73mb, 74.53gb]: 0

partition> 0
Part      Tag    Flag     Cylinders     Size            Blocks
  0 unassigned    wm       0            0         (0/0/0) 0

Enter partition id tag[unassigned]: root
Enter partition permission flags[wm]:
Enter new starting cyl[0]:
Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: 38307c
partition> print
Current partition table (unnamed):
Total disk cylinders available: 38307 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 - 38306       74.53GB    (38307/0/0) 156292560
  1 unassigned    wu       0                0         (0/0/0)             0
  2 unassigned    wm       0                0         (0/0/0)             0
  3 unassigned    wm       0                0         (0/0/0)             0
  4 unassigned    wm       0                0         (0/0/0)             0
  5 unassigned    wm       0                0         (0/0/0)             0
  6 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0

partition> label
[0] SMI Label
[1] EFI Label
Specify Label type[0]:
Ready to label disk, continue? y

partition> q

(...)
format> quit


Maintenant on peux lancer le script d'installation sur le slice s0 du disque dur:
root@opensolaris:~# ksh /tmp/zfsinstall_sparc c4t0d0s0
Starting to copy data from UFS root to /zfsroot - this may take some time.
Updating vfstab
updating /zfsroot//platform/sun4u/boot_archive
Installing zfs bootblk on /dev/rdsk/c4t0d0s0
###################################################

OpenSolaris now installed.

Une fois l'installation terminée, on démonte le zfs et on reboot:
root@opensolaris:~# beadm umount opensolaris
root@opensolaris:~# reboot


et on configure le réseau un minimum:
touch /etc/hostname.eri0
touch /etc/dhcp.eri0

Puis remplacer dans le fichier /etc/nsswitch.conf, la ligne:
hosts:  file
par
hosts: file dns

Un petit reboot pour vérifier que le réseau ce lance tout seul au démarrage.

Vous pouvez ensuite lancer une mise à jour vers la dernière version d'osol (qui utilise nativement les fonctionnalités de clonage zfs pour revenir en arrière):

pkg refresh --full
pkg image-update

Maintenant, ne reste plus qu'a trouver comment lui installer une jolie interface graphique.

lundi, août 23, 2010

Juniper EX-4200 internal PFE routing in stack

During a troubleshooting session on a 10-members Juniper EX-4200 stack, I discovered the use of "show virtual-chassis vc-path source-interface XX destination-interface YY".
This command display the internal path across the EX-4200 PFE chips.
I obtain a result different that the EX-4200 diagram displayed in the O'reilly book "JunOS enterprise Switching" regarding the "Uplink Module".
Here are my results (simplified to a 3-members stack):


The Juniper use an internal routing-protocol for using shortest path between ports (less PFE hop count).
This diagram depends of how you build your stack too: If you use another way for plug your stack-cables, the result will be different.

Here is how to display the path when going from port ge-0/0/0 to ge-2/0/0

user@ex-stack> show virtual-chassis vc-path source-interface ge-0/0/0 destination-interface ge-2/0/0
vc-path from ge-0/0/0 to ge-2/0/0
Hop   Member  PFE-Device  Interface
0       0         1       ge-0/0/0
1       1         4       vcp-1
2       1         5       internal-1/25
3       1         3       internal-2/24
4       2         6       vcp-0
5       2         8       internal-0/24
6       2         7       ge-2/0/0

This means that if only one of the 3 PFE on one of your stack member have a problem, it's all flow that cross this member that will have problem.
You can check internal-PFE communication error with this command:
show virtual-chassis vc-port statistics extensive | match errors