Tag Archives: OpenSolaris

The hunt for /etc/.pwd.lock

After upgrade Debian to kernel 3.0.0, I saw a hidden file called .pwd.lock in /etc which I didn’t noticed before. Checking other machines gave the same result as shown below, but both without a matching Debian-package or manpage.

$ ls -l /etc/.pwd.lock
-rw-------. 1 root root 0 feb 27  2009 /etc/.pwd.lock
$ ls -l --time=atime /etc/.pwd.lock
-rw-------. 1 root root 0 apr 10  2010 /etc/.pwd.lock
$ ls -l --time=ctime /etc/.pwd.lock
-rw-------. 1 root root 0 aug 14  2010 /etc/.pwd.lock

As time match at least the installation date of the machine and exists on other machines it appears to be a valid file, but with what purpose? After reading the Linux Programmer’s Manual two functions called lckpwdf and ulckpwdf where candidates for using this file. Checking the source code at Sourceware confirmed that both lckpwdf and ulckpwdf are using the file. And reading the manpage about these functions also confirms it’s purpose, a lock file the commands like passwd.

The lckpwdf() function is intended to protect against multiple simulta‐
neous accesses of the shadow password database. It tries to acquire a
lock, and returns 0 on success, or -1 on failure (lock not obtained
within 15 seconds). The ulckpwdf() function releases the lock again.
Note that there is no protection against direct access of the shadow
password file. Only programs that use lckpwdf() will notice the lock.
 
These were the functions that formed the original shadow API. They are
widely available.

This is another example why open source matters. You can get the evidence when you want and/or need instead of trusting some manual to explain things. Verification will become more important as systems get more complex. It was/is also a big advantage when OpenSolaris was created with it’s web accessible source repository.

Is CDDL genoeg of niet?

Op de NLOSUG-mailinglist is een discussie ontstaan over het voortbestaan van OpenSolaris nu Oracle eigenaar is geworden van Sun Microsystems. Het meest interessante punt is dat mensen denken dat een licentie automatisch hun investering kan beschermen, maar is dat wel zo? Geeft CDDL die garantie zoals GPL bijvoorbeeld?

3.1. Availability of Source Code.
Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange.

Dit lijkt minder strikt dan de voorzieningen in GPL, maar juristen kunnen dit mogelijk beter beantwoorden. Het meest interessante wat kan gebeuren als Oracle besluit als 100% eigenaar van de code om de licentie te veranderen en OpenSolaris laat voor wat het is. Dit kan misschien weleens de belangrijkste gebeurtenis in de FOSS-wereld zijn van de afgelopen 10 jaar. Zoals ook besproken is bij DebConf 6 bijvoorbeeld.

Het laat misschien ook zien hoe open sommige bedrijven echt (kunnen) zijn en dat het altijd verstandig is om een kopie te hebben de broncode. Wat het ook laat zien hoe lastig het is om voor een groot bedrijf om te veranderen van bedrijfs- en verdienmodel waarbij je iedereen tevreden wilt houden. Zeker in een wereld die heel snel aan het veranderen is waarbij het model gaat van voornamelijk aanschafkosten naar een subscribermodel, zodat de kosten alleen daar zijn waar je ze ook verbruikt.

ZFS vs Btrfs

Solaris 10 ZFS EssentialsIn 2006 integreerde Sun Microsystems een nieuw filesystem onder de naam ZFS in Solaris 10 en vele waren skeptisch. Ook was er voldoende commentaar vanwege de gekozen licentie en het commentaar is er nog steeds nu ZFS ook ontbreekt in Snow Leopard van Apple. Met de overname door Oracle wordt het er mogelijk niet beter op, maar toch staat er een boek voor ZFS op de roadmap.

In dezelfde periode is Oracle begonnen aan Btrfs voor Linux welke in de kernel is op genomen sinds Linux 2.6.29. Nu begint ZFS redelijk volwassen te worden en het heeft wat jaren geduurt, maar hoe staat Btrfs ervoor. Een virtuele testmachine met een paar lege disken en de laatste versie van Debian Testing zou dus voldoende moeten zijn. Helaas is dit nog geen succesvolle combinatie en geeft aan dat Btrfs misschien nog niet helemaal volwassen is.

Als we naar de techniek en implementatie kijken dan zijn er nog meer verschillen tussen ZFS en Btrfs. Waar ZFS beschikt over RAID 0, 1, 10 maar ook over verschillende RAIDZ generaties en combinaties hiervan waarmee RAID 5 en 6 worden geimplementeerd. Dit terwijl Btrfs voorlopig alleen beschikt over RAID0, RAID1 en RAID10 zonder enige uitbreidingen hierop. Ook blijft Btrfs vertrouwen op bv andere RAID- en LVM-oplossingen, maar ook op de hardware die altijd correct is. Een mooi punt van oa ZFS is dat het de hardware meeneemt in de beslissingen waar het snelst te lezen is bv.

Op bijna alle punten lijkt ZFS volwassen te zijn en behoeft Btrfs nog vele jaren ontwikkeling terwijl ZFS al in 2006 productierijp was. En hoewel ZFS strict in Solaris verweven is en een niet GPL-licentie heeft is het zeer zeker de moeite waard om te gebruiken. Het is misschien ook de vraag of met de komt van Solaris 11 en de uitkomst van de Sun-Oracle merger het nog wel interessant is naar Btrfs te kijken. Zeker als je kijkt naar hoe volwassen OpenSolaris nu is tov wat Linux niet biedt. Alleen een licentie is vaak niet voldoende of het moet de moeite waard zijn om te wachten, maar live upgrade met ZFS is tegenwoordig echt de moeite waard en een verademing.

Bug ID 6843138: can not boot off of a 2.2TB and zfs root

Bij het upgraden van OpenSolaris naar build 125 werd mijn aandacht getrokken door meldingen die ik kon negeren zo bleek later. Maar mijn aandacht werd getrokken door bug ID 6843138 en met de komst van 2.5TB disken wordt deze bug werkelijkheid als GRUB wordt gebruikt.

Installed snv_144 on an about 2.2 TB disk, using zfs for root.
First reboot after install, I can boot from the disk. However
issuing a reboot while booted from the hard disk, I get the grub prompt.
doing a findroot (pool_rpool,0,a) results in

zio_read_data failed
Error 15: File not found.

I saw the problem originally with opensol 0906 111b.

One problem here is that grub has total_sectors as unsigned long instead
of unsigned long long. So if a file we need for booting falls after
the chopped off total sectors (ulong) we won’t even attempt to read
the file in rawread().
Even when I modify total_sectors to be unsigned long long and
not to chop it in get_diskinfo() I can not fully boot. Problem is
that bios is not reporting correct capacity. Based on int 13 fn 48
data, it is reporting 0x199fb000 instead of 0x1199fb000.

Removing some checks, I can boot. details in a bit.

De vraag is natuurlijk of je nu een bootdisk van 2.5TB wilt hebben, maar denkende aan een opmerking over 640kB ken ik het antwoord wel.

TOR op OpenSolaris

Sun Solaris is een platform met een militairniveau van beveiliging en nog veel maar. Met de komst van OpenSolaris en SourceJuicer lijkt het platform opener te voor wat gebruikers daadwerkelijk op hun platform willen. Zo ook met TOR, the onion router, en privoxy. Beide kunnen samen worden gebruikt om anoniemer te surfen op Internet en zijn ook beschikbaar in OpenSolaris.

$ pfexec pkg install SUNWtor SUNWprivoxy

Voeg aan /etc/privoxy/config de volgende regel toe (inclusief de laatste punt):

forward-socks4a / 127.0.0.1:9050 .

Enable de juiste services:

$ svcadm enable tor privoxy

Vanaf dit moment kun je gebruik maken van het TOR-netwerk door bv de Torbutton toe te voegen aan FireFox. Deze addon maakt het mogelijk om snel te switchen tussen het wel of niet gebruiken van het TOR-netwerk. Dit is nodig om vertrouwen te krijgen en te kijken waarvoor het te gebruiken ipv direct op te nemen in de globale proxysetttings.

Timeouts in IPS

OpenSolarisNu SXCE in oktober ter ziele gaat is de tijd gekomen om dieper in OpenSolaris te duiken en te zien hoe de volgende Sun Solaris release eruit gaat zien. Een van de grootste wijzigingen is de introductie van IPS om SVR4-packaging te vervangen. Aangezien nog veel software in SourceJuicer mist werd het dus ook tijd om zelf te gaan compileren en bij het installeren van SunStudio bleeft de installer constant dezelfde file opnieuw ophalen. Het commando zelf is redelijk simpel en er lijkt weinig in te stellen.

$ pfexec pkg install sunstudio

Het probleem deed zich ook voor bij OpenDS en VirtualBox. Bij wat testen kon ik zelf de benodigde bestanden wel goed ophalen. Na wat zoeken en wat vragen op IRC kwam de volgende bug naar voren, maar ook een oplossing. Na wat verder zoeken lijkt deze bug voort te komen uit het feit dat ze een timeout hebben toegevoegd voor machines die verbinding verliezen met hun repositories.

$ PKG_CLIENT_TIMEOUT=900 pfexec pkg install sunstudio

Dit kan natuurlijk ook worden losgetrokken en het plaatsen van deze timeout in je ~/.profile zorgt ervoor dat het voor elk pkg commando werkt die je uitvoert.

$ export PKG_CLIENT_TIMEOUT=900
$ pfexec pkg install sunstudio
$ pfexec pkg install opends

Tijd om eens wat verder in OpenSolaris te duiken de komende maanden, want de stap van Solaris 9 naar 10 was al redelijk groot, maar van 10 naar 11 zal misschien nog wel groter worden.

OpenSolaris 2009.06

OpenSolarisDuring CommunityOne 2009 Sun Microsystems released OpenSolaris 2009.06 and Open HA Cluster 2009.06. With this release comes an improved Time Slider, support for the Intel Nehalem processor, integration of project Crossbow, SourceJuicer and much more.

First the upgrade from a previous version of OpenSolaris is very simple. The commands below should be enough to upgrade to version 2009.06 and would only depend on your download speed.

$ pfexec pkg refresh --full
$ pfexec pkg install SUNWipkg
$ pfexec pkg image-update --be-name opensolaris-200906

After the reboot you can see which environments there are and which one is active now or will be active after the next reboot.

$ beadm list
BE Active Mountpoint Space Policy Created
-- ------ ---------- ----- ------ -------
opensolaris - - 72.79M static 2009-05-30 02:00
opensolaris-200906 NR / 7.35G static 2009-05-30 11:22
$ uname -a
SunOS homer 5.11 snv_111b i86pc i386 i86pc Solaris

The machine is now up and running with the latest stable release. So the next couple of weeks I’m going to experiment with a lot of new things like SourceJuicer and Crossbow to get a feeling for them.

OpenSolaris 2008.11 with ZFS-mirroring

OpenSolarisBoth Sun Solaris and OpenSolaris now support ZFSboot which allows you to have your operating system on a ZFS-pool. Also the text-installer for Sun Solaris lets you define if you want your ZFSboot device to be mirrored, but with the OpenSolaris installer this option isn’t given and with the default options it isn’t even possible. This due to selection of the whole disk option for ZFS which appears to be a wise option for people who know ZFS. The truth is that you need to select Solaris partitions during installation if you want your ZFSboot environment to support mirroring.

After OpenSolaris has been installed you can turn on mirroring as in the good old days with SVM. The first step it get the VTOC the same on both disks.

$ pfexec prtvtoc /dev/rdsk/c3d0s2 | pfexec fmthard -s - /dev/rdsk/c4d1s2
fmthard: New volume table of contents now in place.

ZFS can be tolled to create a mirror and the resilvering starts.

$ pfexec zpool attach -f c3d0s0 c4d1s0

Now the last step is to install GRUB on the second disk.

$ pfexec installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c4d1s0

Afterwards I did a scrub to make sure the data on both disks was correct and the following output confirms I have mirrored my two disks.

$ zpool status
pool: rpool
state: ONLINE
scrub: scrub completed after 0h5m with 0 errors on Sat May 30 11:50:12 2009
config:
NAME STATE READ WRITE CKSUM
rpool ONLINE 0 0 0
mirror ONLINE 0 0 0
c3d0s0 ONLINE 0 0 0
c4d1s0 ONLINE 0 0 0
errors: No known data errors

You’re ready to go and as long as you do a scrub on a regular basis the zpool should stay a safe place to store your data.