Bert JW Regeer (畢傑龍)

Hosting NFS shares from a Zone

I am currently trying to get my web development environment all set up. While I like using vi, I really do prefer TextMate on my Mac OS X to do the real heavy lifting and all of the editing.

As I was working on getting my homedir on my zone to be shared over NFS I was getting errors that NFS was not a valid protocol from sharemgr, the program that is used to add new shares to the system. sharemgr create -P nfs homedir  
Invalid protocol specified: nfs

A little bit of Googling brought me to a mailling list message saying that some server packages may be missing. This is entirely possible since my Zone was created with a minimal set of packages, so I log into the global host where NFS sharing does work and run the following: pkg list | grep nfs
SUNWnfsc                                      0.5.11-0.101    installed  ----
SUNWnfsckr                                    0.5.11-0.101    installed  ----
SUNWnfss                                      0.5.11-0.101    installed  ----
SUNWnfsskr                                    0.5.11-0.101    installed  ----

Ah, so those are probably not installed in the zone, quick pkg install later: pkg install SUNWnfsc SUNWnfsckr SUNWnfss SUNWnfsskr
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    3/3       17/17     0.28/0.28

PHASE                                        ACTIONS
Install Phase                                  55/55 
PHASE                                          ITEMS
Reading Existing Index                           9/9 
Indexing Packages                                3/3

Now, lets re-run the sharemgr command again and see if this time we do indeed get our group created: sharemgr create -P nfs homedir sharemgr show -vp
default nfs=()
homedir nfs=()

Yes, there we go. Now I can add a share to that group. Until more errors start showing up: sharemgr add-share -s /export/home/xistence/ homedir
NFS: Cannot share remote filesystem: /export/home/xistence
NFS: Service needs to be enabled by a privileged user
Failed to enable share for "nfs": system error

This time Google does not help out, instead it gives me the option to search without quotes around the search terms which gives me absolutely nothing.

Well, lets see if the services are running in the first place: svcs -a | grep nfs    
disabled       22:19:04 svc:/network/nfs/client:default
disabled       22:24:26 svc:/network/nfs/server:default
online         22:24:20 svc:/network/nfs/rquota:default
online         22:24:20 svc:/network/nfs/status:default
online         22:24:20 svc:/network/nfs/mapid:default
online         22:24:20 svc:/network/nfs/cbd:default
online         22:24:21 svc:/network/nfs/nlockmgr:default

Nope, for some reason the nfs server keeps being disabled eventhough I did enable it using svcadmin.

Okay, lets take a look with svcs what is going on: svcs -l nfs/server
fmri         svc:/network/nfs/server:default
name         NFS server
enabled      false (temporary)
state        disabled
next_state   none
state_time   Fri Feb 20 22:25:26 2009
logfile      /var/svc/log/network-nfs-server:default.log
restarter    svc:/system/svc/restarter:default
dependency   require_any/error svc:/milestone/network (online)
dependency   require_all/error svc:/network/nfs/nlockmgr (online)
dependency   optional_all/error svc:/network/nfs/mapid (online)
dependency   require_all/restart svc:/network/rpc/bind (online)
dependency   optional_all/none svc:/network/rpc/keyserv (disabled)
dependency   optional_all/none svc:/network/rpc/gss (absent)
dependency   optional_all/none svc:/network/shares/group (multiple)
dependency   require_all/error svc:/system/filesystem/local (online)

Ah, it has a log file, lets see what that log file says: cat /var/svc/log/network-nfs-server\:default.log 
[ Feb 20 22:11:07 Disabled. ]
[ Feb 20 22:11:07 Rereading configuration. ]
[ Feb 20 22:18:43 Enabled. ]
[ Feb 20 22:19:04 Enabled. ]
[ Feb 20 22:24:21 Executing start method ("/lib/svc/method/nfs-server start"). ]
The NFS server is not supported in a local zone

Eh? What? That seems weird, but it is off course plausible. Zones are new to Solaris and thus not everything may be virtualised yet. Taking that query to google brings me to a web page asking the same question I am asking: Local zone as NFS server. Taking a look it brings me to a bug report and ultimately to: Bug ID: 4964859 RFE: Zones should be able to be NFS servers. Well, I guess that ends that little stunt. I will be sharing it from the global zone. While this is acceptable to me, I do not believe that it is acceptable to most other people using Zones, and while it is unfortunate but it does not look like there is a whole lot of activity on the bug, as apparently there are no resources available.

Well, I learned something new, and wasted a few minutes of my time attempting to set this up. While generally I don't post my failures I find it important as other people may run into the same errors and have the same issue with getting things up and running.

I ended up doing the following:

sharemgr create -P nfs webdev-homedir

Then I followed that up with some servers that should be allowed access, and others that should not:

sharemgr set -P nfs -S sys -p 'rw= none=*' webdev-homedir

And then finally I added the share I wanted to share all along:

sharemgr add-share -r "homedir" -d "xistence home dir" -s /storage/zones/dev-web/root/export/home/xistence webdev-homedir

This creates a long NFS share to type in, since the full path now becomes:


Which is not that big of a problem for me, especially since I just save it in my favourites in Mac OS X and everything is peachy. It works like a charm.

FIRST Robotics mentoring

The last six weeks have been the fastest few weeks of this new semester that I am currently in. FIRST Robotics season had started again and I tagged along with two friends of mine, Zach and Jason, to mentor high school students at Hamilton High School in Chandler, AZ. The team number for those of you interested in 698, which is not that far away from 637 the team that I was on in 2006.

It was interesting being back in a High School. First and foremost because I had not realised how much I had grown up in just two years of University, and how different everything was. I forgot all about the scheduled classes with bells to signify when to go the next class, the weird schedules whereby classes shift around depending on the day, and various other oddities (the chairs for example are a lot smaller, and have desks attached to them). When I say I had not realised how much I had grown up, I mean that in the worst possible way. While me and my friends are able to joke around when we need to get something done we can sit down and get it done. Most of these students would sit around and joke and would not be able to get anything done no matter how long you gave them, they needed serious directions and to be told exactly what to do. Micromanaging in this environment is an absolute must. As for the differences, I am in University that means I get to decide if I got to class or not, I get to decide what classes I take, and I have to keep track of my schedule because my classes are not going to be offered one after the other, and there is not a single bell or paging system in the building.

Team 698 was off to a rocky start this build season, for various reasons, but the main issue was that the leader of the team was not leading but instead was trying to build the entire robot by himself, thereby killing team morale, and their reasons for even working, as everything they'd come up with would not be good enough. Once this was rectified and the team's mentors including myself started to pull the team in the right direction everything started rolling.

Tutoring people in high school is actually an awesome experience, and while I generally hate teaching people (Google is your best friend) I found that I enjoyed working with the students. Even if they could be a little childish, easy to derail and get off track from the task at hand. That being said, I have a much greater respect for my High School teachers now that I have gone through what they have to go through every single day. That is no easy task and it takes a lot of energy. The students in Robotics are probably a different breed though and they were more eager to learn and build new ideas than probably most other high school students.

The end result is that the robot was shipped. There are still some things that need to be worked on, but for now there is a small break before the Arizona FIRST Robotics Regionals. If you get the chance to be a mentor on a FIRST Robotics team I would totally suggest it. It is absolutely fantastic and more people should get involved. When I was a student and on the FIRST Robotics team it was an absolutely exhilarating experience, and something that even to this day I still remember vividly. I may have had some major arguments with people on the team (most notably my Physics teacher at the time), but we worked through them, and it is to this day that I remember something my Physics teacher, Mr. Giraud, said to me:

"You can write software expecting the hardware to be perfect, unfortunately hardware is not perfect and you have to fix it in code." (May not be exact, but the basic gist is there)

That has stayed with me, and it is something I will probably always remember. It has certainly changed the way I program for embedded devices.