Solaris 10 x86 - updating boot device

Recently at work I had a situation where I had to move a Solaris 10 x86 virtual machine from a VMware Server environment to a VMware ESXi environment. Unfortunately, the Server architecture presents IDE drives to the VM, and the ESXi environment presents SCSI drives to the VM, so when you move the VM between them Solaris has no idea how to boot.

After much searching, I found this post on an OpenSolaris mailing list which helped me out.

To summarize:

  1. Boot Solaris into the Failsafe mode from Grub
  2. Get the name of the new drive device using the format command
  3. Change the boot device path in the file /a/boot/solaris/bootenv.rc
  4. Run the command “bootadm update-archive -R /a”
  5. Run ‘disks -r /a’ to rebuild all the /dev/dsk and /dev/rdsk entries
  6. Edit /a/etc/vfstab to reflect the updated /dev/dsk entries (you can do some of this after reboot)
  7. Cross your fingers and reboot

Note that I’m not using zfs or ODS or anything exciting for the drives, just plain disks with file systems. Other configurations would likely be even more exciting.

Hopefully this can help someone else…

Google Chrome

So, Google has released a browser called Chrome. So far it’s only for Windows, and is being called beta, but Gmail is still beta, so whatever.

The install is nifty, it automagically imports all your Firefox settings, including saved passwords (!). This is rather nice, because I have a bunch of random passwords for sites (like this blog) that are only saved in my browser and some obscure text file or email somewhere, and I’d have to go dig them up if it didn’t suck the settings across.

So far it seems like a pretty good browser, though I haven’t done much aside from access Google properties (Reader, Mail). While these are admittedly a lot of what I use a browser for, they’re also likely Google’s optimization targets, so they’d better work really well. We’ll see how it does with other stuff down the road.

One interesting concept with Chrome is that separate tabs are separate processes. This is good and bad — it uses more memory, but if a site crashes the browser it only affects that tab (in theory, I haven’t tested this yet), and you can kill off that process. If this works as advertised it’d be really good, because I can’t count the number of times I’ve had to restart Firefox because a tab has hung.

I also really like the about:memory feature (also linked as “Stats for nerds” off the built-in task manager), which shows not only detailed data about Chrome, and also shows memory stats for any other browser you’re running. Excellent for comparisons, which I’m sure is the point.

Now if only Google would give me Offline reading for Gmail. Maybe some day…

VirtualBox Additions vs VMware Tools

I recently installed VirtualBox Guest Additions to an Ubuntu Server 8.04.1 VM that’s running the -virtual kernel mentioned in my last post.

It was a breeze. The installer told me specifically what it couldn’t find when necessary (make, gcc, kernel headers), didn’t barf with crazy error messages, didn’t spew pages and pages of unneeded details about how the kernel module compilation was proceeding when it was working properly, and it Just Worked the first time on a fully-updated machine. On reboot of the VM, the kernel modules loaded and worked exactly as expected.

Contrast this to VMware Tools, which is hit or miss on the “will it work the first time” front, especially when installing on a guest OS that’s newer than the Tools are designed for. It also spews files all over the place, and looking at the scripts gives me a headache, especially compared to the simplicity of the VirtualBox scripts.

I’m not sure if the elegance and simplicity of the VirtualBox Additions install and operation can be attributed to the original creators of the software, or to improvements since Sun purchased the company, or a bit of both, but regardless I like it.

Also, I’ve been doing some really intensive I/O and CPU work (transcoding DivX videos into MPEG2 using ffmpeg) inside this VirtualBox VM running on a Windows XP host, reading/writing files on a Shared Folder from the host, and both the guest and host have been very fast and entirely stable. I’d say the transcoding is at close to native speed, though that’s entirely subjective and without scientific evidence.

If VirtualBox could just get FreeBSD support working, I’d have no complaints left.

Ubuntu Hardy 8.04.1 guest on VirtualBox 1.6.4

I’ve been playing with VirtualBox and have been having an issue getting Ubuntu Hardy 8.04.1 working, specifically that everything installed fine but after reboot the system hung with an error about the kernel requiring “features not present on the CPU”.

Apparently the correct way to fix this is, after the OS installs but before you reboot, change to an alternate TTY (alt-F3), run:
chroot /target
then run:
apt-get install linux-virtual
This installs a stripped-down version of the kernel that’s optimized for running under a virtual machine. It seems to be a lot smaller than the default server kernel.

I’m going to need to play with this linux-virtual kernel at the day job under VMware ESX. We’re currently just using the default server kernel there, and this might be a lot cleaner.

Useful Ubuntu Answers page here

PHP4 to PHP5 - fun with echo

Found a legacy web site at work today running on PHP4. As the PHP folks no longer support version 4, I started testing the site on PHP5 to prep it for migration. I was rather surprised to find that some very basic pages, with just some if/else blocks for conditional content, were causing errors. The error being returned was “parse error, unexpected ‘;’”, which was rather odd, particularly because it was still giving the same error when I removed all ;’s from the offending line (!?).

The issue turned out to be that PHP4 allows you to just use echo ; or echo [your text] ;

PHP5, however, requires quotes:echo ""; or echo "[your text]“;

I couldn’t find this with 15-20 minutes of searching the web, just figured it out by trying various changes to the page, so here it is for posterity and people looking in the future

Fun times.

Fun with MS errors

I decided to install SQL Server 2008 Express Edition, because I want SQL Server Management Studio Express and figure it can’t hurt to have the whole SQL Server to play with. One of the dependancies is .NET 3.5 SP1 beta, and while installing it gives this fun recursive error.

Oh MS, sometimes you’re still better than lolcats.

LinkedIn SSL cert expired this morning…

Trying to login to LinkedIn this morning with Firefox 3, this morning I saw….

Secure Connection Failed
www.linkedin.com uses an invalid security certificate.
The certificate expired on 06/07/08 02:53 AM.
(Error code: sec_error_expired_certificate)
* This could be a problem with the server's configuration, or it could be someone trying to impersonate the server.
* If you have connected to this server successfully in the past, the error may be temporary, and you can try again later.
Or you can add an exception…

Very nice. It is fixed now, of course.

Wordpress code/pre tags

More things for posterity, as I had to search several times to find what I wanted…

To make the pretty formatting boxes for command output in the Grails post I just finished, I had to use both pre and code tags, like this:

<pre><code>[content here]</code></pre>

If I just used pre the font was monospace but huge, and if I just used code it stopped after the first blank line and the rest was just text. I could probably adjust this in the CSS of the theme or something, but whatever, I’ll just take the simpler path. I also had to reformat some of the longer lines because they were jutting out of the code box. Some still will if you’re using a really skinny browser window, but that’s your problem, get a bigger screen. ;)

I found this post useful in figuring the pre/code formatting stuff out.

Grails on Ubuntu Hardy

Just for the posterity of the Internet, and because I didn’t find an immediately useful answer when searching with Google…

I’ve been looking at Groovy, a really cool language with similarities to Ruby and Smalltalk that runs as Java bytecode in a standard Java container, and Grails, which is the Groovy equivalent of Ruby on Rails — namely, a framework for quickly and easily creating web applications. Very neat stuff. I hope my interview this afternoon with the company using it goes well. :)

So, while reading up on Groovy and Grails I wanted to play with it on my Ubuntu Hardy laptop. I already had the sun-java6-jre package installed so I could do standard Java stuff. However, in order to publish a Grails application, which is required in order to run it, you need the JDK. So I also installed sun-java6-jdk. It’s possible I should have just removed the JRE and replaced it with the JDK, but the Ubuntu package manager didn’t complain, so I didn’t.

Doing a ‘which java’ pointed to /usr/bin/java, so I set my JAVA_HOME to /usr and move on to installing the rest. [at this point smart people may feel a tingling in their Spidey Sense]

I installed the Ubuntu groovy package, and downloaded the grails package and installed it with dpkg. Everything looks good, I can run ‘grails help’ from the command line without errors. So I create my grails app.

bryanf@ronin2:~$ grails create-app test

Welcome to Grails 1.0.3 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/share/grails		

Base Directory: /home/bryanf
Note: No plugin scripts found
Running script /usr/share/grails/scripts/CreateApp.groovy
Environment set to development
    [mkdir] Created dir: /home/bryanf/test/src
    [mkdir] Created dir: /home/bryanf/test/src/java
    [mkdir] Created dir: /home/bryanf/test/src/groovy
    [mkdir] Created dir: /home/bryanf/test/grails-app
    [mkdir] Created dir: /home/bryanf/test/grails-app/controllers
    [mkdir] Created dir: /home/bryanf/test/grails-app/services
    [mkdir] Created dir: /home/bryanf/test/grails-app/domain
    [mkdir] Created dir: /home/bryanf/test/grails-app/taglib
    [mkdir] Created dir: /home/bryanf/test/grails-app/utils
    [mkdir] Created dir: /home/bryanf/test/grails-app/views
    [mkdir] Created dir: /home/bryanf/test/grails-app/views/layouts
    [mkdir] Created dir: /home/bryanf/test/grails-app/i18n
    [mkdir] Created dir: /home/bryanf/test/grails-app/conf
    [mkdir] Created dir: /home/bryanf/test/test
    [mkdir] Created dir: /home/bryanf/test/test/unit
    [mkdir] Created dir: /home/bryanf/test/test/integration
    [mkdir] Created dir: /home/bryanf/test/scripts
    [mkdir] Created dir: /home/bryanf/test/web-app
    [mkdir] Created dir: /home/bryanf/test/web-app/js
    [mkdir] Created dir: /home/bryanf/test/web-app/css
    [mkdir] Created dir: /home/bryanf/test/web-app/images
    [mkdir] Created dir: /home/bryanf/test/web-app/META-INF
    [mkdir] Created dir: /home/bryanf/test/lib
    [mkdir] Created dir: /home/bryanf/test/grails-app/conf/spring
    [mkdir] Created dir: /home/bryanf/test/grails-app/conf/hibernate
[propertyfile] Creating new property file: /home/bryanf/test/application.properties
     [copy] Copying 2 files to /home/bryanf/test
     [copy] Copied 1 empty directory to 1 empty directory under /home/bryanf/test
     [copy] Copying 2 files to /home/bryanf/test/web-app/WEB-INF
     [copy] Copying 5 files to /home/bryanf/test/web-app/WEB-INF/tld
     [copy] Copying 87 files to /home/bryanf/test/web-app
     [copy] Copying 18 files to /home/bryanf/test/grails-app
     [copy] Copying 1 file to /home/bryanf/test
     [copy] Copying 1 file to /home/bryanf/test
     [copy] Copying 1 file to /home/bryanf/test
     [copy] Copying 1 file to /home/bryanf/test
[propertyfile] Updating property file: /home/bryanf/test/application.properties
Created Grails Application at /home/bryanf/test
bryanf@ronin2:~$

Yay, it works!

Then I try to run my Grails app, using HTTPS because hey… it’s there.

bryanf@ronin2:~$ cd test
bryanf@ronin2:~/test$ grails run-app-https test

Welcome to Grails 1.0.3 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/share/grails		

Base Directory: /home/bryanf/test
Note: No plugin scripts found
Running script /usr/share/grails/scripts/RunAppHttps.groovy
Environment set to development
    [mkdir] Created dir: /home/bryanf/.grails/1.0.3/projects/test/classes
  [groovyc] Compiling 6 source files to /home/bryanf/.grails/1.0.3/projects/test/classes
    [mkdir] Created dir: /home/bryanf/.grails/1.0.3/projects/test/resources/grails-app/i18n
[native2ascii] Converting 11 files from /home/bryanf/test/grails-app/i18n
  to /home/bryanf/.grails/1.0.3/projects/test/resources/grails-app/i18n
Error starting Sun’s native2ascii:
bryanf@ronin2:~/test$ 

After several muttered curses and much searching around, I finally figured out the issue, extrapolated from all the search results saying “There’s something wrong with your JAVA_HOME”.

The way Ubuntu handles packages that may have overlapping commands is to setup a links in /usr/bin to files within /etc/alternatives, which are themselves links to places around the machine. The JRE apps link into /usr/lib/jvm/java-6-sun/jre/bin, while the JDK apps link into /usr/lib/jvm/java-6-sun/bin.

After setting JAVA_HOME to /usr/lib/jvm/java-6-sun, everything is happy.

bryanf@ronin2:~/test$ grails run-app-https test

Welcome to Grails 1.0.3 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/share/grails		

Base Directory: /home/bryanf/test
Note: No plugin scripts found
Running script /usr/share/grails/scripts/RunAppHttps.groovy
Environment set to development
[native2ascii] Converting 11 files from /home/bryanf/test/grails-app/i18n
 to /home/bryanf/.grails/1.0.3/projects/test/resources/grails-app/i18n
     [copy] Copying 1 file to /home/bryanf/.grails/1.0.3/projects/test/classes
     [copy] Copying 1 file to /home/bryanf/.grails/1.0.3/projects/test/resources
     [copy] Copying 1 file to /home/bryanf/.grails/1.0.3/projects/test
2008-07-04 10:59:45.498::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
Creating SSL Cert…
Created SSL Cert
2008-07-04 10:59:46.283::INFO:  jetty-6.1.4
2008-07-04 10:59:46.440::INFO:  No Transaction manager found - if your webapp
 requires one, please configure one.
2008-07-04 10:59:52.760:/test:INFO:  Set web app root system property:
 ‘test-development-0.1′ = [/home/bryanf/test/web-app/]
2008-07-04 10:59:52.760:/test:INFO:  Initializing log4j from
 [file:/home/bryanf/.grails/1.0.3/projects/test/resources/log4j.properties]
2008-07-04 10:59:52.787:/test:INFO:  Initializing Spring root WebApplicationContext
[0] spring.GrailsWebApplicationContext Refreshing org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@1bc93a7:
 display name [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@1bc93a7];
 startup date [Fri Jul 04 10:59:53 EDT 2008];
 parent: org.springframework.web.context.support.XmlWebApplicationContext@fdb413
[0] spring.GrailsWebApplicationContext Bean factory for application context
 [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@1bc93a7]:
 org.springframework.beans.factory.support.DefaultListableBeanFactory@1c0ae76
2008-07-04 10:59:55.516:/test:INFO:  Initializing Spring FrameworkServlet ‘grails’
2008-07-04 10:59:56.611::INFO:  Started SelectChannelConnector@0.0.0.0:8080
2008-07-04 10:59:56.910::INFO:  Started SslSocketConnector@0.0.0.0:8443
Server running. Browse to https://localhost:8443/test

Note: at this point all I’ve done is create the Grails application and run it, without adding any of my own code, and I have a running HTTPS application that will serve a static page. Cool beans.

This post
was eventually useful in getting things working, though it’s a huge whack of text to plow through, and with several bits I didn’t really need. (do I need VNC instructions when talking about installing Grails?)

Now, back to reading more JavaOne presentations about Grails.

Ruby problems

Interesting post at Matasano with details about some possibly exploitable bugs in Ruby. I’m glad I’m not currently supporting any Ruby on Rails apps, I’m sure there are many web 2.0 companies freaking out right now.

Next Page »