The Queen's Gambit Declined... 1. d4 d5 2. c4 ...

Wednesday Jun 18, 2008

When you have an iso file, it's really convenient to be able to just mount it.

Before the integration of PSARC/2008/366 VSW_CANLOFI in Solaris Nevada (build 93)
it was a two-step process:

    # lofiadm -a /my/iso		# creates /dev/lofi/1
    # mount -F hsfs /dev/lofi/1 /mnt	# access /my/iso via /mnt

With this wadlet, you can now omit the lofiadm step and just say:

    # mount -F hsfs /my/iso /mnt

Similarly with unmount -- you don't have to remember to lofiadm -d.

With ZFS, you can do

    # zpool import -d /net/zday/some/path/to/zpool/images/

Friday Mar 21, 2008

Network transfers between a Windows guest and a Solaris host through NAT are very slow (a few KB per secs).

I am sure this problem will go away once VB will be more mature but it is currently very painful to transfer files

from the host to the guest. One solution to overcome this issue that I've found fast and easy to set up, is to mount

the Virtual Disk Image file (.vdi), used by the guest, directly on Solaris.

I've created my VDI files in a ZFS filesystem


# zfs list
NAME                                        USED  AVAIL  REFER  MOUNTPOINT
export_pool                                37.1G  1.31G  2.46G  /export
[...]
export_pool/vm                             15.2G  1.31G    21K  /export/vm
export_pool/vm/snv                           18K  1.31G    18K  /export/vm/snv
export_pool/vm/winxp                       15.2G  1.31G    21K  /export/vm/winxp
export_pool/vm/winxp/winxp0                15.2G  1.31G  14.7G  /export/vm/winxp/winxp0
export_pool/vm/winxp/winxp0@after_install   515M      -   932M  -
export_pool/vm/winxp/winxp0@mar_20         60.5M      -  14.7G  -
export_pool/vm/winxp/winxp0_tests            18K  1.31G  14.7G  /export/vm/winxp/winxp0_tests

# ls /export/vm/winxp/winxp0
NewHardDisk1.vdi  NewHardDisk2.vdi  winxp.vdi


First, I clone the ZFS filesystem so the data are safe during the operation (and the VM can keep running).


# zfs snapshot export_pool/vm/winxp/winxp0@mar_20
# zfs clone export_pool/vm/winxp/winxp0@mar_20 export_pool/vm/winxp/winxp0_tests
# cd /export/vm/winxp/winxp0_tests
# ls
NewHardDisk1.vdi  NewHardDisk2.vdi  winxp.vdi


As you can see in the zfs list output the cloned data only use 60MB (Thanks to ZFS!!)

From this post, we learn that a NTFS filesystem starts off by


eb 52 90 4e 54 46 53 20  20 20 20 00 02 08 00 00  |ëR.NTFS    .....|

Then, let's find this string in our VDI file


# od -t x1 NewHardDisk2.vdi | grep "eb 52 90 4e 54 46 53 20 20 20 20 00 02 08 00 00"
0140000 eb 52 90 4e 54 46 53 20 20 20 20 00 02 08 00 00
^C
#


The first column gives us the offset within the file that we need to mount the image.

Solaris doesn't support NTFS by default and doesn't know how to mount those filesystems.

However, you can use mount_ntfs, a freeware available on sourceforge.net, to do the job


# mount_ntfs NewHardDisk2.vdi /mnt -off 0140000
To unmount the file system type "kill 24697".
#
(make sure you keep the first 0 in the offset)


Et Voila!

Wednesday Mar 12, 2008

gconftool-2 --type bool --set /apps/metacity/general/reduced_resources true


or, start gconf-editor and navigate through apps -> metacity ->
general and enable reduced_resources.

Tuesday Mar 11, 2008

The current version (1.5.51) of VirtualBox for Solaris hosts lacks sound support :-(

VirtualBox for Linux hosts do have sound support through OSS and ALSA.  Since ,
it's possible to install the OSS drivers on top of Solaris (see my previous post on this blog),
I've decided to verify it is was possible to recompile VBox for Solaris with OSS enabled.

It turns out to be relatively simple to download and change the code.

Most of the changes consist in replacing some

"#ifdef RT_OS_LINUX"
by some
"#if defined(RT_OS_LINUX) || defined(RT_OS_SOLARIS)"
(at the right places, of course)

In the end, I can assign the OSS sound driver to my WindowsXP guest and guess what? It works.
Unfortunately, for an unknown reason the sound is distorted when played from the guest...

Anyway, I can see that Innotek is already working on a Native Solaris sound support (see here).
My next step is going to recompile VBox with the Native Solaris sound support enabled which is
a little bit more complicated...


Saturday Mar 08, 2008

1. Dowload the OSS for Solaris drivers from http://www.opensound.com/

2. Install the drivers :


pkgadd -G -d ./oss-solaris-v4.0-1014-i386.pkg

Forget about any error messages
eg.

devfsadm: driver failed to attach: audiohd
Warning: Driver (audiohd) successfully added to system but failed to attach
3. Reboot

You may see some errors at boot (forget them for now):

eg.


Mar 8 13:59:19 solaris-devx hdaudio: [ID 545374 kern.warning] WARNING: RIRB timeout (cad=3, nid=0, d=0, verb=f00, parm=0)
Mar 8 13:59:19 solaris-devx hdaudio: [ID 834091 kern.notice] NOTICE: attach_codec: Codec #3 is not physically present
Mar 8 13:59:19 solaris-devx hdaudio: [ID 545374 kern.warning] WARNING: RIRB timeout (cad=3, nid=0, d=0, verb=f00, parm=0)


4. Run osstest

5. If it fails, run the following

ln -s /dev/oss/hdaudio0/pcm0 /dev/dsp
ossdevlinks -r


6. Run osstest again, it should work now.


presented by TravelPod, the World's Original Travel Blog ( A TripAdvisor Media Network member ) 

Friday Mar 07, 2008

White to move... 

The goal for white is to promote the e7 pawn into a Queen.

 
The white King has to move since it is in check. It has 3 possible choices:

1. Kd7 (protecting itself behind the pawn)

Black can now play for a Draw:

1. ... Rf7 (pinning the pawn)

2. Kd8 Rxe7

3. Kxe7 Draw

 

1. Ke5 (attacking the Rook)

Black can now counter attack the pawn!

1. ... Rf1

2. e8(Q) Re1+

3. Kd6 Rxe8 (Black wins)



1. Kd5 (White is escaping - this is the less obvious move)

Black is chasing the King.

1. ... Rf5+

2. Kd4 Rf4+

3. Ke3 Rf1

No matter what black plays, white can now promote the pawn and win!!

 


Saturday Mar 01, 2008


The easiest way to setup a Networked Guest OS with VirtualBox is by using NAT (Network Address Translation).

In this situation, the VirtualBox network engine acts as a router and routes the network traffic between the guest OS and the Internet
(assuming the host is connected to the Internet). The disadvantage of using NAT is that the guest OS is part of its own local network
and is unreachable from outside even from the guest OS!

Fortunately, by using Port Forwarding, it's possible to make network services, from the Guest, accessible from the Host.

In this example, I'm going to setup a FTP server under Windows XP (Guest) and then access the server from Solaris (Host).

1. Install WindowsXP as a Guest OS and choose NAT as the network mode.

2. In WindowsXP, the network should be similar to this :


C:\> ipconfig /all

Windows IP Configuration

        Host Name . . . . . . . . . . . . : software-d59018
        Primary Dns Suffix  . . . . . . . :
        Node Type . . . . . . . . . . . . : Unknown
        IP Routing Enabled. . . . . . . . : No
        WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Local Area Connection:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : AMD PCNET Family PCI Ethernet Adapter
        Physical Address. . . . . . . . . : 08-00-27-EA-94-15
        Dhcp Enabled. . . . . . . . . . . : Yes
        Autoconfiguration Enabled . . . . : Yes
        IP Address. . . . . . . . . . . . : 10.0.2.15
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 10.0.2.2
        DHCP Server . . . . . . . . . . . : 10.0.2.2
        DNS Servers . . . . . . . . . . . : 10.0.2.3
        Lease Obtained. . . . . . . . . . : Saturday, March 01, 2008 3:34:07 PM
        Lease Expires . . . . . . . . . . : Sunday, March 02, 2008 3:34:07 PM

As you can see, the guest is in the 10.0.2.xxx subdomain (my Host is in the 192.168.0.xxx).

3. Install a FTP server under WinXP.

For my own purpose, I've used the FileZilla Server because it is free and easily configurable through a GUI interface.

Verify the ftp server is working from the Guest OS:

C:\> ftp localhost
Connected to software-d59018.
220-FileZilla Server version 0.9.24 beta
220-written by Tim Kosse (Tim.Kosse@gmx.de)
220 Please visit http://sourceforge.net/projects/filezilla/
User (software-d59018:(none)): anonymous
331 Password required for anonymous
Password:
230 Logged on
ftp>


4. Setup the Port Forwarding

By default, the FTP server uses the port 21 (make sure there is no firewall blocking the port 21 in WindowsXP; by default it is blocked by Windows's Firewall).

In Solaris, I'm going to map the port 4021 to 21 :


/usr/bin/VBoxManage setextradata <name_of_vm> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort” 4021
/usr/bin/VBoxManage setextradata <name_of_vm> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort” 21

/usr/bin/VBoxManage setextradata <name_of_vm> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol” "TCP"

- Replace name_of_vm with the name of your virtual machine
- Replace ssh with the prefered nam you want, it has to be unique

These commands update the .xml file under ~/.VirtualBox/Machines/<name of vm> therefore the configuration is persistent across reboots.

To remove the settings, run the same commands without the last argument.

5. Restart the Guest for the Port Forwarding to take effect.

You can verify if the VM is listening on port 4021

# pfiles 1872
1872:    /opt/VirtualBox/VirtualBox -comment winxp -startvm a805c093-566d-4a22-
  Current rlimit: 256 file descriptors
[...]
 34: S_IFSOCK mode:0666 dev:310,0 ino:7522 uid:0 gid:0 size:0
 O_RDWR
 SOCK_STREAM
 SO_REUSEADDR,SO_OOBINLINE,SO_SNDBUF(49152),SO_RCVBUF(49152)
 sockname: AF_INET 0.0.0.0&nbsp; port: 4021
[...]

6. Verify ftp is accessible from Solaris.

# ftp 192.168.0.4 4021
Connected to 192.168.0.4.
220-FileZilla Server version 0.9.24 beta
220-written by Tim Kosse (Tim.Kosse@gmx.de)
220 Please visit http://sourceforge.net/projects/filezilla/
Name (192.168.0.4:root): anonymous
331 Password required for anonymous
Password:
230 Logged on
Remote system type is UNIX.
ftp> ls
200 Port command successful
150 Opening data channel for directory list.
desktop.ini
My Music
My Pictures
My Videos
226 Transfer OK
47 bytes received in 0.0063 seconds (7.27 Kbytes/s)
ftp>



The same procedure can apply to communicate through http, ftp, etc... from Solaris to a WindowsXP guest.

Wednesday Feb 27, 2008

Antonello Cruz has just integrated its work about "Process Contract Decoration" into Solaris Nevada build 85

PSARC 2008/046 Process Contract Decorations
5079353 RFE: contract 'decoration' with service FMRI

----------------------------------------------------------------------------------------------------------------------------------------------------------

Contracts in Solaris are mainly used by SMF(4) to restart services (eg. when they die). Contract information
can be accessed through several commands:

ctstat(1), ptree(1) , ps(1) , svcs(1)

For more details about contracts and services, read Victor Latushkin's Weblog

The interesting thing about Antonello's enhancement is that FMRIs are now available at the contract level.
Since contracts are known by the kernel, it means that relationship between contracts and FMRIs is now
available within the kernel.
This allows observation and debugging (e.g. with DTrace) in both userland and the kernel. Also, post-mortem
tools (eg. mdb) are able to identify the ownership of contracts.

When previously, we would go from the instance FMRI to find the contract id and the processes associated

# svcs -o CTID,FMRI,STATE ssh
CTID   FMRI                                               STATE
73     svc:/network/ssh:default                           online

# svcs -p ssh
STATE          STIME    FMRI
online         10:21:51 svc:/network/ssh:default
               10:21:51      590 sshd


Now, we can do the opposite and go from the process to its FMRI associated and ctid

# ps -ae -o pid,ctid,comm | grep sshd
  590    73 /usr/lib/ssh/sshd

# ctstat -v -i 73
CTID    ZONEID  TYPE    STATE   HOLDER  EVENTS  QTIME   NTIME   
73      0       process owned   7       0       -       -       
        cookie:                0x20
        informative event set: none
        critical event set:    hwerr empty
        fatal event set:       none
        parameter set:         inherit regent
        member processes:      590
        inherited contracts:   none
        service fmri:          svc:/network/ssh:default
        svc_fmri ctid:         73
        creator:               svc.startd
        aux:                   start


Here is a Dtrace example for aggregating system calls by FMRI

#!/usr/sbin/dtrace -qs

syscall:::entry
{
@[stringof(curthread->t_procp->p_ct_process>conp_svc_fmri->rs_string)] = count();
}

^C

svc:/system/fmd:default 7
svc:/system/utmp:default 11
svc:/system/system-log:default 18
svc:/network/rpc/keyserv:default 20
svc:/system/hal:default 20
svc:/system/intrd:default 36
svc:/system/zones:default 72
svc:/network/smtp:sendmail 122
svc:/network/inetd:default 292
svc:/network/rpc/bind:default 372
svc:/system/cryptosvc:default 394
svc:/network/nfs/mapid:default 439
svc:/network/rpc/gss:default 623
svc:/network/nfs/cbd:default 668
svc:/system/filesystem/autofs:default 1402
svc:/network/nfs/status:default 1556
svc:/system/webconsole:console 1842
svc:/network/nfs/nlockmgr:default 1977
svc:/application/graphical-login/cde-login:default 2449
svc:/system/svc/restarter:default 2851
svc:/system/name-service-cache:default 3819
svc:/system/console-login:default 5124
svc:/system/svc/repository:default 9686
svc:/network/ssh:default 10819

 


Tuesday Feb 26, 2008

Microsoft's Windows has probably the best commercial chess softwares (eg. Fritz, Chessmaster). However, we can find some very interesting chess programs for Unix/Solaris in the free world! Today, I'd like to present two of them that I'm using on my laptop running SXDE 01/08.

Jin

The first one is Jin. Jin is a Java client for various chess servers. It currently supports the Internet Chess Club (chessclub.com) and the Free Internet Chess Server (freechess.org) but is designed to be able to support any chess server. You can download Jin from Soundforge.

 First, you need to login to your favorite chess server (mine is FICS). If you don't already have an account, you can create it from the Jin's login interface.

 

 

 

Then you can either seek an opponent by specifying what kind of game you want to play... 

 

 

 

Or just select your opponent from the Sought window 

 

 
 Here is an example of the chessboard window (totally configurable)

 

 

 

Scid

The second one is Scid ("Shane's Chess Information Database"), a chess database application for Windows and Linux operating systems.

Scid is not a chess client per say, I mean you won't be able to play chess with it. With Scid you can maintain a database of chess games, search games by many criteria, view graphical trends, and produce printable reports on players and openings. There are many more features as well; the screenshots show just some of what Scid can do. So, Scid is the perfect tool on Solaris to improve your chess game.

Scid is available here
 

 

 

I'm already the owner of a Nabaztag/tag called Mr Fermat (in memory of the mathematician Pierre de Fermat and its famous theorem) and it always fascinates my friends when they come over to my apartment and meet him for the first time.

 
 

The Nabaztag is a Wi-Fi Rabbit who can communicate with other Rabbits all around the world through the Internet. It can also tell the weather, play songs, read the news, etc... It integrates a RFID sensor located in his noze so it can detect RFID objects...

But I've just received an email from a friend telling me about

 

 

 

What Chumby has to say about Chumby :

 With an LCD touchscreen and embedded squeeze and motion sensors, the chumby delivers a robust audio and video entertainment experience to owners, including:

  • Personalized wake-up experience — programmed wake-up to any of the thousands of audio sources available on the chumby
  • Fun — games, humor, e-greetings, gossip, cool entertainment content
  • Photo sharing through top photo-sharing sites such as MySpace, flickr, Facebook and Photobucket
  • Music — over twenty thousand free radio stations
  • Constant updates from top Internet sites
  • Monitoring — auction updates, on-going searches, such as Craigslist, and friend status updates from MySpace

The chumby can be plugged into any electrical outlet, so users have the flexibility of placing it on a nightstand, bathroom counter, office cubicle, coffee table, kitchen counter or out on a patio. It automatically finds an available Wi-Fi connection and streams personalized channels from the Chumby Network, which continuously delivers refreshed content via widgets such as music, games, movie previews, customized alarm clocks, special offers and more.

Some of the most popular content and widgets include top streaming Internet radio stations, podcasts, daily video clips, news from The New York Times and Google, various fun and animated clocks, the addictive chumball™ game that uses the chumby's embedded motion sensor, moon phases, sports news and game updates, tech news from Engadget and TechCrunch, entertainment gossip blogs, and web-cams pointed at traffic, zoo animals and everything you can imagine.

The chumby, which measures about 5" wide, 4" tall, and 3" deep, comes in a soft Italian leather casing in a variety of colors including black, latte and pearl. In addition, chumby owners may express their personality by decorating their devices with chumby charms for sale on the site or their own "bling."

Its functionalities look very promising for its price (~ $150). 

Unfortunately, it seems to be sold in the US only at the moment :-(

I can't wait for it to come in Europe...

 

Monday Feb 25, 2008

 

Here is the first entry for my Queen's Gambit Declined's weblog!

I am a Software Sustaining Engineer at Sun Microsystems and I'm located near Paris, France.


View Larger Map

I work on the userland technologies around Solaris (SMF, Zones, libraries, etc...) fixing bugs.