Thursday Jul 16, 2009

How to share data between Mac OS X(host) and OpenSolaris(guest)

If you haven't heard already, Sun xVM Virtual Box allows you to run Open Solaris on your laptop (and for free !) . However, for a long time, Virtual Box did not have a simple way to share data between your host (MacOS X/Linux/Windows) and OpenSolaris guest. Finally, after a long wait, Sun xVM Virtual Box now is able to successfully share data between these two.

Here is how I did it

Within your host machine (whether Mac OS X or Windows), you will need to open Virtual Box settings for your guest image and then click on Shared Folders and   select to a share a location that you would like to share.


.




Now, you will need to boot up Open Solaris as guest and will need to install the new guest additions. Here is how you can do so


a) From the top level Virtual Box menu, click on Devices and then click on Install Guest Additions. This will cause Virtual Box to mount Guest additions ISO image.

b) Now, open a command line terminal to install this new guest additions.

  • Before proceeding to install the new version of guest additions, let us check if there are any old versions already installed on the system

    • sriramn@opensolaris:-~$> pfexec pkginfo -i | grep SUNWvboxguest

    • If the above command returned any output, then you will need to remove the previous guest additions like :

    • sriramn@opensolaris:-~$> pfexec pkgrm SUNWvboxguest

  • Now, you will need to install the latest Virtual Box guest additions package. To do so, you will need to select 'Install Guest Additions..' item from VirtualBox -> Devices menu item.
    • sriramn@opensolaris:-~$> pfexec pkgadd -d  /media/VBOXADDITIONS\*/VBoxSolarisAdditions.pkg

c) Depending upon your configuration, you might have to reboot your Open Solaris guest.

If you would like to try out Open Solaris on your laptop for the first time, then Virtual Box is a great way to do so. You can get latest builds of OpenSolaris from here and here is a nice screen cast on how to use Virtual Box.

d) Finally, you will need to run the following command within OpenSolaris guest to mount the location that you decided to share from your host (in my case, it is Mac OS's ~/Public ) directory.  I was able to do this as shown below




Also, if you would like this particular location to be mounted every time you boot your OpenSolaris guest, you could also add this below line to your /etc/



Now, if you need to copy any file from your OpenSolaris (guest) VM to your host machine , you could simply do something like

sriramn@opensoaris:~$ pfexec cp ~/Documents/foo  /Public/Drop\\ Box/

Hope you find this useful.


Monday Apr 27, 2009

DTrace probes within MySQL 5.1 in OpenSolaris Web Stack

With the recent release of OpenSolaris 2009.06 build 111a , you will notice that MySQL 5.1 is integrated within AMP meta cluster. What this means is that now after installing OpenSolaris 2009.06, you can now easily install MySQL 5.1, Apache 2.2.11 and PHP 5.2.9 components by using either Package Manager or running the following command from the command line window :

pfexec pkg install amp

For more back ground on how to install these components on OpenSolaris, check out my earlier this and this link.

DTrace probes within MySQL 5.1

One of the goals of Open Solaris Web Stack project , that I am currently involved with, has been to enhance the number of static probes within open source web tier components like Apache, MySQL, PHP and Ruby . This is to provide the web administrators with complete end to end "under the hood" monitoring functionality. With the upcoming release of OpenSolaris 2009.06, we are making more progress along these lines - now  MySQL 5.1 includes static DTrace probes that are back ported from MySQL 6.0 source tree. For detailed information on these probes, please refer to MySQL 6.0 DTrace probe reference. Similarly, PHP 5.2.9 within OpenSolaris PHP runtime also now includes enhanced static DTrace probes as well. Ah, if you wonder on the status of Ruby, Ruby DTrace probes is already integrated within Ruby in OpenSolaris !.

Coming back to MySQL 5.1 DTrace probe , the title of my blog today, I thought, it is worthwhile to mention some of the few probes that are made available for MyISAM Key cache (but is still undocumented..)

\* keycache-read-start (filepath, bytes, mem_used, mem_free)  -> This probe is fired at the start of key cache read operation and provide the following arguments :

  1. filepath -> MyISAM index file
  2. bytes -> Size of the read request.
  3. memory used
  4. memory available

\* keycache-read-done(mem_used, mem_free) -> This probe is fired at the end of keycache read operation.

\* keycache-read-block(bytes) -> This probe is fired if MyISAM key cache performs a blocked read from key cache.

\* keycache-read-hit / keycache-read-miss -> This probe is appropriately fired whether a given request is available within MyISAM key cache file .

\* keycache-write-start(filepath, bytes, mem_used, mem_free) -> This probe is fired at the start of key cache write operation and provide the following arguments :

  1. filepath -> MyISAM index file
  2. bytes -> Size of the read request.
  3. memory used of the current key cache
  4. memory available

\* keycache-write-block(bytes) -> This probe is fired while performing blocked key cache write operation. 

\* keycache-write-end(mem_used, mem_free) -> This probe is fired at the end of keycache write operation.

Monday Feb 09, 2009

Lessons learnt with OpenSolaris 2008.11

Couple of weeks back, for some weird reason my desktop (running on OpenSolaris 2008.11) failed to boot successfully.  After some digging into the boot log files, it turned out that hald daemon does not want to start and this failed service is causing other dependent services to fail as well. I was charging my Palm Treo cell phone through USB within my OpenSolaris 2008.11 based workstation before it happened. Not sure, if it had anything to do with it. Once I recover my system, I will need to try it again to see if that is what kept the system from booting up successfully..

Since, this is my primary workstation, I decided to quickly restore my workstation using some of the tools provided by OpenSolaris 2008.11. Hope, some one wanting to recover their installation finds this useful.

One of the advantage(s) of OpenSolaris 2008.11 is that it uses the power of ZFS intrinsically to provide us with the ability to take a snapshot and rollback to the previous , if necessary. For example, OpenSolaris Boot Environment Manager (beadm(1M)Image Package Manager tool - pkg(1M) - instantly takes a ZFS snapshot of your boot environment and installation files after every successful operation. This allows us  to roll back to the snap shot if we screw some thing up and want to restore to previous state.

Now, in my case, I booted my system in single user mode and checked out the list of snapshots available for my boot environment by running the following command:

sriramn@sriramn:~$ pfexec beadm list -s

(-s informs beadm command to provide the list of snapshots)

(I was doing all this in single user mode. So, I haven't written down the output here.. )

Now, in my case, I was not able to use those snapshot(s) because I had upgraded my zpool to run on newer version of kernel. If I hand't upgraded my zpool , I could have simply done some thing like 

sriramn@sriramn:~$ pfexec beadm create -e opensolaris@install opensolaris-1

sriramn@sriramn:~$ pfexec beadm activate opensolaris-1

sriramn@sriramn:~$ pfexec init 6

Well, in any case, this is what I had to do to recover my system

  • Use OpenSolaris 2008.11 LiveCD to boot up my system. Unforuntately, OpenSolaris LiveCD based installer does not allow one to do reinstallation.So, I had to backup my home directory (using zfs send along with zfs receive ) before proceeding to install.
  • Opened a command line terminal window to back up my home directory to an external hard disk by doing some thing like

  • sriramn@sriramn:~$ pfexec zpool import -f rpool (this is where my corrupted opensolaris installation along with my home directory exists)

    sriramn@sriramn:~$ pfexec zfs list

    (above command should list all the dataset that is available in the pool. You could use this information to determine which one to be backed up). 

           NAME                               USED  AVAIL  REFER  MOUNTPOINT
           rpool/export                         69.9G   144G    19K  /export
           rpool/export/home                    69.9G   144G  2.22G  /export/home
           rpool/export/home/sriramn            67.7G   144G  66.6G  /export/home/sriramn

    sriramn@sriramn:~$ pfexec zfs snapshot rpool/export/home/sriramn@jan09

    sriramn@sriramn:~$ pfexec zfs send rpool/export/home/sriramn@jan09 | gzip > /mnt/backupfile.gz

  • Finally, I had to start a new installation by clicking on 'Install Now' icon. Once the system came up successfully, I simply recovered my old data by running the following command

<my external had disk is mounted as /mnt where I have saved a ZFS stream of my home directory to /mnt>
sriramn@sriramn:~$ gunzip -c /mnt/backupfile.gz | pfexec /usr/sbin/zfs recv rpool/export/home/sriramn@jan09


Thought, I would capture some of the lessons that I have learnt during this recovery experience...
  • Think twice before running 'zpool update' on your OpenSolaris 200[8-9].xx based desktop.  Why ?
    • Within OpenSolaris, invoking zpool upgrade command ensures that your disk pool is instantly converted to run on newer version of ZFS there by supporting the newer features of ZFS. However, older version of OpenSolaris kernel will not be able to read your data any more. 
    • If you would like to know what is in each version of ZFS, you could simply run the following command from the command line
      • pfexec /usr/sbin/zpool upgrade -v
    • For example, with OpenSolaris 2008.11 (build 101b), released version of ZFS is version 13 and with the latest released Nevada build 106, ZFS version is 14 !. Now, let us say, if you update your system to run on Nevada build 106, and then you explicitly invoked zpool upgrade , now you will not be able to use your OpenSolaris 2008.11 LiveCD and access your home directory !
  • Take regular snapshot of your file system as well as boot environment because unlike other platforms, snapshots on ZFS doesn't cost that much in space and the benefits are huge.. OpenSolaris installer automatically create a '@install' snapshot of the boot environment as well as the files created as part of an installation. This is very cool. This would allow us to revert back to this snapshot any time some thing gets messed up.

Tuesday Jul 01, 2008

What I like with OpenSolaris 2008.05 (build 91)

One of the advantages of using  OpenSolaris 2008.05 based distribution is that  you can very easily upgrade to the latest bleeding edge changes that is happening within Open Solaris projects.  - thanks to IPS based repository updates. So, if you would like to try out these bleeding edge developments , then you might want to subscribe to opensolaris-announce  mailing alias to know about the latest OS updates available. Accordingly, this blog describes as to how simple is to upgrade to build 91 within OpenSolaris 2008.05.

So, what excites me with OpenSolaris 2008.05 (build 91) is that I can now mount an ISO image (DVD or CD) in a single command and the mount(1M) command will automatically figure out that it is an ISO image and will use lofiadm(1M) command in the back end and mount accordingly.

For example, I can now mount an ISO image in OpenSolaris by doing something like

pfexec pkg /usr/sbin/mount -F hsfs -o ro  /export/home/sriramn/solarisdvd.iso /mnt

Af course, for a Linux guy - he is used to ยดloop'  mount options all along to mount stuffs like this. Finally, I am glad that now this is possible within  OpenSolaris as well.

Wednesday Jun 25, 2008

How to automatically start my applications within OpenSolaris 2008.05

Now that I am a proud OpenSolaris 2008.05 convert and have started using OpenSolaris both on my Toshiba Tecra M2 laptop as well as on my Sun Ultra-40 workstation (needless to say I am quite happy...) I realized that  the best way to learn a OS is use it for your every day task. You just run into some - that you wanted to work in a different way and google your way around until you get what you are looking for.. - no other best way to learn, IMO.

Today, I was looking around to see how I could get my set of applications to start automatically after a system restart - you need this when you are running stuffs on your laptop where you need to shut it down at the end of the day. Now, this feature would allow me to login to OpenSolaris desktop and have all these applications running automatically without any need to start them individually.

Ok, here we go... it seems that you will need to click on System->Preferences->Sessions . check out these below pictures to get a better grasp of how to get this done.

and then select the third tab to save all the currently running applications.


Af course, if you wanted to have one selected application to start automatically, then you could select the first tab and provide the command to get this application to run automatically every time you login to your laptop.

That's it. Now, your GNOME applications like Instant Messenger client like Pidgin can automatically start up and keep me online ...

Af course, if you like OpenSolaris 2008.05, feel free to subscribe to indiana-discuss mailing list and let us know how it works out for you.

Saturday May 17, 2008

How to find Ethernet (MAC) address in OpenSolaris 2008.05

Well, most of the Linux and Solaris users should probably know that 'ifconfig' is the command to get and manage your network interfaces - something similar to 'ipconfig' on Windows but just more powerful. Anyway, what I didn't realize is that on OpenSolaris , you will need to run the ifconfig in the following way to get the MAC address .

pfexec /usr/sbin/ifconfig -a

Hope, some one finds this useful.

Friday May 16, 2008

Setting up Static IP and NIS for OpenSolaris 2008.05

As part of OpenSolaris 2008.05 installation, Caiman installer automatically configures your ethernet card  to provide a dynamic IP address. This is perfectly fine if you are working from your laptop.

However, if you, like me installed it on your workstation like Sun Ultra 40 then you might want to do necessary things like assigning a static IP address with NIS authentication enabled etc to transition the system as a developer workstation. Now that I have tried out OpenSolaris 2008.05 LiveCD for more than 2 weeks now, I guess I am now ready to make OpenSolaris 2008.05 as my default OS. If you haven't yet, you might wanna download a copy from here

So, here is how I went ahead with this transition

- Disable Network AutoMagic(NWAM) service and enable traditional networking service

svcadm enable physical:default 

svcadm disable physical:nwam

-  Now, you need to configure the static IP address for your ethernet interface. You could do this by using the network configuration GUI - 'System->Administration->Network GUI window to configure this as shown here

Note: I am assuming that you know the IP address and the default gateway that you need to provide here. If not, you might want to talk to your Network administrator before you attempt this.

- Now, I will restart all network services by doing some thing like

 svcadm restart milestone/network


Now, I will move ahead and configure NIS for my system. Here is how it
worked for me

- Setup your domain name of your current network. NIS server need to reside within this domain as well.  So, let us save the current domain name of your network to /etc/defaultdomain file.

    pfexec domainname <name here> 

   pfexec domainname > /etc/defaultdomain

For example,

    pfexec domainname sfbay.sun.com

    pfexec domainname  > /etc/defaultdomain

- Copy /etc/nsswitch.nis to /etc/nsswitch.conf

    pfexec cp /etc/nsswitch.nis /etc/nsswitch.conf

- Configure NIS Services

    pfexec ypinit -c

This above command will walk you through and ask you to provide NIS server IP addresses etc. and then bind the configured NIS server.

    pfexec /usr/lib/netsvc/yp/ypbind -broadcast

- Finally, enable NIS service and restart all network services..

    svcadm enable nis/client

    svcadm restart milestone/network

- Now, you should be able to verify if NIS is working on your system by doing something like

    ypcat -k passwd -> should return a whole bunch of NIS user names within your domain.

That is all there to do to translate a OpenSolaris system running in DHCP to a static IP address with NIS enabled



Tuesday May 13, 2008

Taking OpenSolaris 2008.05 to a developer workstation

For the last week or so, I have been successfully using OpenSolaris 2008.05 on Tecra M2 laptop and I totally love it. 

 
Since the default installation of OpenSolaris 2008.05, I had to install few packages to make it a developer friendly. Here is the list that I have on my system. You could very well customize it - depending on your needs

Open a command line terminal window and run the following commands to get (you could go through the GUI route if you are GUI person)

    \* GCC, Sun Studio, Netbeans (Compiler and Developer IDE)

           pfexec pkg install gcc-dev sunstudio netbeans

    \* Apache, MySQL, PHP runtime

           pfexec pkg install amp

    \* VNC Client RDesktop (Allows remote connectivity to other desktop. You need VNC Client to connect to other Linux desktop and RDesktop to connect to Windows XP etc)

           pfexec pkg install SUNWvncviewer SUNWrdesktop

Hope, you find this useful.

Thursday Feb 07, 2008

So many ways to get Open Solaris...

If you are new to Open Solaris community, you might want to check out the different distributions available here.  Out of these different distributions, Open Solaris Community Express, Open Solaris Developer Express and Open Solaris Developer Preview  is released from Open Solaris community while the rest of the distributions seems to be developed by third party or volunteers. Here is quick 2 minute run down on these different distributions as I understand it -

 

Open Solaris Developer Preview  - Internal code name for this project is 'Indiana' .  It is still in 'beta'  and its goal seems to be to simplify the Open Solaris installation experience and provide a LiveCD of the OS as well.  The promising feature in this distribution is that it touts a new 'packaging' system known as 'Image Packaging System' that allows users like us to get updates and new packages on regular basis. Af course, in Linux world, folks has been using 'Yum' or 'apt-get' for quite some time now. However, for Open Solaris community , this is probably one of the most wanted features for quite some time now.

 

Open Solaris Community Express -  Unsupported binary release of Open Solaris source code. This release happens almost biweekly.  With every release, the milestone's build number is increased. If you would like to get the latest and greatest Open Solaris snapshot, then this is the way to go. Here is a quick link of the different features that have been integrated with every milestone build. Typically, if I like to try out a feature then I download the appropriate milestone build.

 

Open Solaris Developer Express - Well tested and stable snap shot of the Open Solaris Community Express translates into a Open Solaris Developer Express release. This release happens once in every 3-4 months. You can download and use it for free. Also, if you would like to run it on your production system, you can buy support for this release from Sun 

 

Unless you are seasoned veteran within Open Solaris world, Open Solaris Developer Express  is the best way to get your hands on it.

 

 

 

 

Technorati Tags:

 

About

Sharing what little I know

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today