Installing/Running Ubuntu on USB/Flash drive

I have tried to install Ubuntu in several ways as told in a number of sources (google: installing ubuntu on usb). However most of them are focused on mirroring the live USB CD which I indeed do not prefer.

I was looking for simulating a real (persistant) installation on the usb drive. And I came up with minimal installation.

1. Boot with either the Live CD, Minimal Installation CD or the DVD

I have rebooted with the minimal installation CD of Ubuntu Natty Narwhal 11.04 (If it’d be possible, better with its DVD).

I plug in the usb drive and re-detect the drives in the text based installation menu and do the configuration for the usb drive in the menu then install it.

2. Reinstall? :)

The trick is, when it is time to install GRUB it yields an error. So I restart and boot with the Ubuntu DVD open “rescue system” in the boot menu and go on with partition table (without any modification, but only configuring as in original, I have). It installs the system again.

3. GRUB install

I have booted from the DVD and used the line below for 11.04 (source: https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows)

sudo grub-install –boot-directory=/media/0d104aff-ec8c-44c8-b811-92b993823444/boot /dev/sda

After that,

# cd /media/???????

get into your usb drive and chroot to it:

# chroot .

then add a user within root group:

# useradd ?myname?

Just like that. Reboot and use the usb ubuntu. One more thing to remember: VMWare may not comply with a successful bootable USB Driver. I have wasted so much time before I understand that. I thought it was not complete just because VMWare did not boot from the USB which I have prepared. But no, though it works with real machine start up.
P.S.: If you need further help on VMWare have a look at this one: http://www.plop.at/en/bootmanagerdl.html

Java EE installation blows with “NoClassDefFoundError: appserv”

I have tried to install Java EE 5.07 bundle on Ubuntu 9.04 Jaunty. Besides I have downloaded different bundles with or without any download accelerator so that I was sure binary file [1] was not corrupt. I rechecked inside the binary archive and found nothing.

Somehow, installation was aborting with an error saying:

$ ./java_ee_sdk-5_07-linux.bin
Checking available disk space...
Checking Java(TM) 2 Runtime Environment...
Extracting Java(TM) 2 Runtime Environment files...
Extracting installation files...
Launching Java(TM) 2 Runtime Environment...
Exception in thread "main" java.lang.NoClassDefFoundError: appserv
Caused by: java.lang.ClassNotFoundException: appserv
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: appserv. Program will exit.
Deleting temporary files...

Eventually, thanks to Sathyan (scatari of java.net [2]) we have resolved that. I came up with this:
$ ./java_ee_sdk-5_07-linux.bin -javahome /opt/jdk1.6.0_13

Despite I updated my links for Java SDK of new installation. But it seems it had not worked well enough. Additionally denoting Java SDK path made it work.

Now happily working on Java EE.

[1] http://java.sun.com/javaee/downloads/?intcmp=1282?userOsIndex=1&userOsId=linux&userOsName=Linux
[2] http://forums.java.net/jive/message.jspa?messageID=346693

Joy of the penguin

I was looking around for pipe’s (|) and fifo type’s (<file> |) properties. I found pretty nice samples. Here are some of those:
1) Read mp3 from a fifo:

# mkfifo myfifo
# mpg123 -s BachAirInG.mp3 > myfifo &
# rawplay myfifo

2) Or we could directly read from net:

# wget -q http://www.mikekohn.com/music/bach.mp3 -O - | mpg123 -s - | rawplay

Liked it.

Reference: http://www.debian-administration.org/articles/145