Permanent java apps on a USB stick


Forum: USB booting
Topic: Permanent java apps on a USB stick
started by: Chamane

Posted by Chamane on Feb. 02 2008,18:13
Hi,

I hope I am at the right place to post this. What I want to do is to make my DSL installation on a USB permanent with all the applications (mainly java apps, but also from MyDSL and apt-get command) I installed. The applications are related to geomatics. Here are the procedures I followed so far:

1°Partitionning and formating of my 4 Gb Flash drive. I copied from Windows the DSL 4.2 iso on the frist 500 Mb FAT 32 partition (/dev/sdb1), leaving the second 3500 Mb FAT 32 free (/dev/sdb2).

2°Setting my keyboard to "cf" from the control panel, restarting X.

3°Upgrading to GNU utils and enabling apt.

4°Changing the default repository in sources.list to "http://mirrors.usc.edu/pub/linux/distributions/debian oldstable main contrib non-free". The GRASS and QGIS geomatics apps are not available in the other repos.

5°Installing jre1_5_0 from MyDSL-System so I can install jar apps.

6°Downloading OpenJUMP (http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/s/si/sigle/OJ_ViatorisLinuxInstaller.jar)
wich is a geomatics software. There are others like Landserf, but the install procedure is the same.

7°Opening a terminal and typing PATH="$PATH:/opt/jre1_5_0/bin" so I can use the java -jar application.jar command.

8°Changing directory to where the downloaded file is. Installing the software with: java -jar OJ_ViatorisLinuxInstaller.jar successfully. The executable OpenJUMP-unix.sh file has been put in the /usr/local/OpenJUMP/bin directory.

9°In a terminal, changing directory to /usr/local/OpenJUMP/bin and typing again PATH="$PATH:/opt/jre1_5_0/bin" otherwise the software won't open.

10°Opening up the software with the command ./OpenJUMP-unix.sh.

There. Everything is set up properly, I can use the GRASS and QGIS softwares, and the OpenJUMP java software as well. My question is "How can I make all these installations permanent" so when I reboot my DSL stick everything will appear without having to reinstall?
1°the keyboard setting
2°the enabled apt
3°the installed apps (GRASS and QGIS) from apt-get
4°the jre1_5_0 java app from MyDSL (I have tried to modify the /etc/profile file without success)
5°the installed java apps (OpenJUMP)

Damnsmall is perfect for USB stick because it leaves lots of free space on the drive compared to other distros. I have been searching a lot to make averything working so far. I would appreciate a lot if someone could give the answers I am looking for.

Many thanks.

Chamane :)

Posted by ^thehatsrule^ on Feb. 02 2008,22:14
Assuming you do not want to remaster the base DSL image...

The file bootlocal.sh may be of interest to you and backup/restore.

Here's some pointers...
1. `loadkeys <mysetting>` (or boot with lang=?)
2. Look in `cat ~/.fluxbox/menu | grep -i apt`
4. What DSL version are you using? If newer, place a symlink to java in /opt/bin would be better than to modify /etc/profile.  In any case, you'd have to back up either file.

Suggestions:
For 2, 3: unless the version in those apt repos keeps changing, you're better off to either
- download the debs and installing them locally, or
- convert them, i.e. using deb2dsl, which will also reduce the need for dsl-dpkg

5: Depends how the installation goes.  Would be better to convert to a mydsl package as well (and installed in /opt)

Posted by humpty on Feb. 03 2008,15:58
it's hard to tell wether you did a frugal install or a hard-drive install.

anyway, have a read through this;
< http://www.damnsmalllinux.org/wiki/index.php/Persistence >

Posted by Chamane on Feb. 04 2008,19:57
Thanks both for your reply. I will give a feedback in a near future.

Chamane:)

Posted by Chamane on Feb. 08 2008,17:59
Hi,

I tried a few things without success. I followed the procedures in the link on persistence:

dsl@box:~$sudo su
   dsl@box:~$mkdir /mnt/sdb2/opt
   dsl@box:~$cp -arv /ramdisk/opt/ /mnt/sdb2/opt
   dsl@box:~$mkdir /mnt/sdb2/home
   dsl@box:~$cp -arv /ramdisk/home/dsl /mnt/sdb2/home
and setting up sdb2 as back/restore device from the DSL Control panel.

When rebooting, I typed:

dsl fromhd=/dev/sdb1 home=/dev/sdb2 restore=sdb2 keyb=cf

The only thing that worked was the home directory where I found my jar files again. I lost jre1_5_0 and the installed apps from apt-get and from java installation (OpenJUMP.sh).

I would be willing to give installation of deb files, but I am not that good with Linux (like I don't know what a symlink is) and it seems to me that there are a lot of dependencies that I would have to solve with GRASS.

BTW, my DSL version is 4.2.2.

Any solution welcomed.

Chamane :)

Posted by curaga on Feb. 08 2008,18:26
You should add opt=/dev/sdb2 to your boot line to have opt there too :)
Posted by ^thehatsrule^ on Feb. 08 2008,18:31
If you're using persistent dirs, you should use .tar.gz extensions for /opt as they will be permanent (or else use the mydsl autoload mechanism, or copy them over if you're using uci's).  Having said that, afaik you should avoid using a persistent home, since that is usually where many writes occur.
Posted by Chamane on Feb. 09 2008,20:35
I think I have done it. I feel like I'm on top of the Everest... After all those trials. Many thanks for the answers posted above. But there are still a few irritants. Here is what I did:

1- After installing Damnsmall on the USB drive (I changed for the 4.2.5 version), I booted with the CD with the following codes:
dsl fromhd=/dev/sdb2 mydsl=sdb2 keyb=cf
so when I install jre1_5_0 it goes directly on the mydsl directory of the stick.

2- I enabled APT and changed the repository for:
< http://mirrors.usc.edu/pub/linux/distributions/ > debian oldstable main contrib non-free
where the GRASS GIS and QGIS apps are available.

3- sudo apt-get update

4- sudo apt-get install grass grass-doc qgis. That command will put all the used deb files in /var/cache/apt/archives.

5- Copy all the .deb files of /var/cache/apt/archives in /mnt/sdb2/mydsl so they become persistant.

6- sudo beaver /opt/bootlocal.sh for editing. I added the command lines dpkg -i /mnt/sdb2/mydsl/debpackage.deb for all the deb files available in the directory. There were 41 of them...

7- Install jre1_5_0.tar.gz from the MyDSL Extension Tool.

8- Download OJ_ViatorisLinuxInstaller.jar in /home/dsl/softwares.

9- In a shell, go to /home/dsl/softwares and type:
PATH="$PATH:/mnt/sdb2/opt/jre1_5_0/bin" (I booted with mydsl=sdb2).

10- Install the jar file with: java -jar OJ_ViatorisLinuxInstaller.jar. To make the installation persistent, I chose the /mnt/sdb2/OpenJUMP directory.

11- In a shell, I typed:

sudo mkdir /mnt/sdb2/opt
sudo cp -arv /ramdisk/opt /mnt/sdb2/opt
sudo mkdir /mnt/sdb2/home
sudo cp -arv /ramdisk/home/dsl /mnt/sdb2/home

12- Setting up sdb2 for Backup/Restore in the DSL Control panel.

13- Reboot with the following codes:

fromhd=/dev/sdb2
home=/dev/sdb2
opt=/dev/sdb2
restore=sdb2
mydsl=sdb2
keyb=cf

That's it! I got an error message, though after trying to open up QGIS:

qgis: error while loading shared libraries: libXrandr.so.2: cannot open shared object file: No such file or directory.

I don't know what that means, but I'll try to find out. Also, I am not able to make: PATH="$PATH:/mnt/sdb2/opt/jre1_5_0/bin" persistent, so I have to type the line everytime I want to use my java apps. I wrote the line in bootlocal.sh, but it didn't work.

I tried to convert the .deb files with the deb2dsl script, but I got a deb file again. I think the compression worked, but I don't know why I still got debs. What if I rename the extension for dsl?

Many thanks again.

Chamane :laugh:

Posted by curaga on Feb. 09 2008,20:43
To make the PATH change persistent, modify /etc/bashrc and /etc/profile (and add them to .filetool.lst)

QGIS: hmm. libXrandr.so.2 is in /usr/lib. What do you get from ldd (on qgis)?

Posted by ^thehatsrule^ on Feb. 09 2008,21:26
I think libXrandr is not included in DSL... iirc it can be found in gnu-utils (mydsl)

For PATH, you could also just drop in symlinks to /opt/bin instead
or just modify ~/.bash_profile ~/.bashrc if you're just using 1 user.. so that it will avoid extra backup/restore files

Also, since it seems you decided to use persistent dirs (despite my warning), there should be no need to use the backup/restore feature.

Posted by Chamane on Feb. 10 2008,03:08
OK. I will delete /mnt/sdb2/home and forget home=/dev/sdb2 on my next boot.

I am not able to modify bashrc or profile even as superuser. I thought that it was because of the frugal install.

I also typed this:
dsl@box:~$ ldd -v grass

and got that (even as superuser):
ldd: ./qgis: No such file or directory

although I don't know if I did it right.

Chamane
:)

Posted by ^thehatsrule^ on Feb. 10 2008,04:16
If you don't know the full path, you can do something like
ldd `which grass`

If you really want to modify those system files, you problably have to remove those then copy them from KNOPPIX into ramdisk.

Posted by Chamane on Feb. 10 2008,16:00
Hi,

I tried:

dsl@box:~$ ldd qgis
ldd: ./qgis: No such file or directory
dsl@box:~$ sudo ldd qgis
ldd: ./qgis: No such file or directory
dsl@box:~$ ldd which qgis
which:
ldd: ./which: No such file or directory
qgis:
ldd: ./qgis: No such file or directory
dsl@box:~$ ldd 'which qgis'
ldd: ./which qgis: No such file or directory
dsl@box:~$ sudo ldd 'which qgis'
ldd: ./which qgis: No such file or directory
dsl@box:~$ sudo ldd which qgis
which:
ldd: ./which: No such file or directory
qgis:
ldd: ./qgis: No such file or directory
dsl@box:~$

But QGIS is there:

dsl@box:~$ whereis qgis
qgis: /usr/bin/qgis /usr/lib/qgis /usr/share/qgis /usr/share/man/man1/qgis.1.gz

I doubt that my deb files are not written properly in bootlocal.sh, I used copy/paste. What else can I do to make it work?

Also, I copied bashrc and profile from /KNOPPIX/etc to /ramdisk/etc and added /mnt/sdb2/opt/jre1_5_0/bin to both for the PATH. What do I do from there? I tried to replace them back in /KNOPPIX/etc, but they cannot be removed as they are read-only files.

Thanks,

Chamane

Posted by ^thehatsrule^ on Feb. 11 2008,00:50
Those are back-ticks, usually left of your keyboard's 1 key and the same as the ~ key.  It's used for command substitution.
Why don't you select+paste?
Anyways, alternative ways are to use $() instead of `` or you could also manually type out the full path yourself.

Posted by Chamane on Feb. 11 2008,11:38
Sorry, I am a newbie with Linux. Here is what I got:

dsl@box:~$ ldd `which qgis`
       libqt-mt.so.3 => /usr/lib/libqt-mt.so.3 (0x4001c000)
       libgdal.so.1 => /usr/lib/libgdal.so.1 (0x40708000)
       libodbc.so.1 => /usr/lib/libodbc.so.1 (0x40ad1000)
       libltdl.so.3 => /usr/lib/libltdl.so.3 (0x40b4a000)
       libxerces-c.so.26 => /usr/lib/libxerces-c.so.26 (0x40b51000)
       libjasper-1.701.so.1 => /usr/lib/libjasper-1.701.so.1 (0x40e9b000)
       libmfhdf.so.4 => /usr/lib/libmfhdf.so.4 (0x40ee8000)
       libdf.so.4 => /usr/lib/libdf.so.4 (0x40f0a000)
       libungif.so.4 => /usr/lib/libungif.so.4 (0x40fa9000)
       libtiff.so.4 => /usr/lib/libtiff.so.4 (0x40fb2000)
       libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x41002000)
       libpng12.so.0 => /usr/lib/libpng12.so.0 (0x4101f000)
       libnetcdf.so.3 => /usr/lib/libnetcdf.so.3 (0x41044000)
       libcfitsio.so.2 => /usr/lib/libcfitsio.so.2 (0x41067000)
       libz.so.1 => /usr/lib/libz.so.1 (0x411d5000)
       libpthread.so.0 => /lib/libpthread.so.0 (0x411e3000)
       libdl.so.2 => /lib/libdl.so.2 (0x41234000)
       libpq.so.3 => /usr/lib/libpq.so.3 (0x41237000)
       libgeos.so.2 => /usr/lib/libgeos.so.2 (0x41253000)
       libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x41346000)
       libm.so.6 => /lib/libm.so.6 (0x41400000)
       libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x41423000)
       libc.so.6 => /lib/libc.so.6 (0x4142c000)
       libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x4155f000)
       libaudio.so.2 => /usr/lib/libaudio.so.2 (0x4158e000)
       libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x415a3000)
       libXrender.so.1 => /usr/lib/libXrender.so.1 (0x415ed000)
       libXrandr.so.2 => not found
       libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x415f6000)
       libXft.so.2 => /usr/X11R6/lib/libXft.so.2 (0x415ff000)
       libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x41612000)
       libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x4167c000)
       libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x41689000)
       libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x41746000)
       libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x4174e000)
       /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
       libssl.so.0.9.7 => /usr/lib/libssl.so.0.9.7 (0x41763000)
       libcrypto.so.0.9.7 => /usr/lib/libcrypto.so.0.9.7 (0x41791000)
       libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x41883000)
       libcrypt.so.1 => /lib/libcrypt.so.1 (0x418ec000)
       libresolv.so.2 => /lib/libresolv.so.2 (0x41919000)
       libnsl.so.1 => /lib/libnsl.so.1 (0x4192b000)
       libexpat.so.1 => /usr/lib/libexpat.so.1 (0x41940000)
       libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x41960000)
       libcom_err.so.2 => /lib/libcom_err.so.2 (0x41984000)

Looks like the file is not found.

Chamane

Posted by curaga on Feb. 11 2008,15:03
Check gnu-utils for libXrandr.so.2, and for the PATH, you can add something like this to /home/dsl/.bashrc:
Quote
PATH=$PATH:/what/i/want/to/add
(both were suggestions of ^hats^, I just recapped them here)

Posted by Chamane on Feb. 11 2008,15:52
Hi. Thanks for answering.

I decided to delete everything and reinstall dsl on the stick just to make sure I didn't forget something along the way. I installed GRASS and QGIS from apt-get. GRASS worked, but not QGIS because of the same reason (libXrandr.so.2 missing). That seems strange to me because it was working the first time without the use of dpkg all the debs. So I decided to try different repositories where the softwares were available. QGIS didn't work using two repositories, but finally decided to work with:

< http://mirror.linux.org.au/debian > oldstable main contrib non-free

I continued with the rest of the procedures and now it is working:

dsl@box:~$ ldd `which qgis`
       libqt-mt.so.3 => /usr/lib/libqt-mt.so.3 (0x4001c000)
       libgdal.so.1 => /usr/lib/libgdal.so.1 (0x40708000)
       libodbc.so.1 => /usr/lib/libodbc.so.1 (0x40ad1000)
       libltdl.so.3 => /usr/lib/libltdl.so.3 (0x40b4a000)
       libxerces-c.so.26 => /usr/lib/libxerces-c.so.26 (0x40b51000)
       libjasper-1.701.so.1 => /usr/lib/libjasper-1.701.so.1 (0x40e9b000)
       libmfhdf.so.4 => /usr/lib/libmfhdf.so.4 (0x40ee8000)
       libdf.so.4 => /usr/lib/libdf.so.4 (0x40f0a000)
       libungif.so.4 => /usr/lib/libungif.so.4 (0x40fa9000)
       libtiff.so.4 => /usr/lib/libtiff.so.4 (0x40fb2000)
       libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x41002000)
       libpng12.so.0 => /usr/lib/libpng12.so.0 (0x4101f000)
       libnetcdf.so.3 => /usr/lib/libnetcdf.so.3 (0x41044000)
       libcfitsio.so.2 => /usr/lib/libcfitsio.so.2 (0x41067000)
       libz.so.1 => /usr/lib/libz.so.1 (0x411d5000)
       libpthread.so.0 => /lib/libpthread.so.0 (0x411e8000)
       libdl.so.2 => /lib/libdl.so.2 (0x41239000)
       libpq.so.3 => /usr/lib/libpq.so.3 (0x4123c000)
       libgeos.so.2 => /usr/lib/libgeos.so.2 (0x41258000)
       libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4134b000)
       libm.so.6 => /lib/libm.so.6 (0x41405000)
       libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x41428000)
       libc.so.6 => /lib/libc.so.6 (0x41431000)
       libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x41564000)
       libaudio.so.2 => /usr/lib/libaudio.so.2 (0x41593000)
       libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x415a8000)
       libXrender.so.1 => /usr/lib/libXrender.so.1 (0x415f2000)
       libXrandr.so.2 => /usr/X11R6/lib/libXrandr.so.2 (0x415fb000)
       libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0x415fe000)
       libXft.so.2 => /usr/X11R6/lib/libXft.so.2 (0x41607000)
       libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x41618000)
       libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x41682000)
       libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x4168f000)
       libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x4174c000)
       libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x41754000)
       /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
       libssl.so.0.9.7 => /usr/lib/libssl.so.0.9.7 (0x41769000)
       libcrypto.so.0.9.7 => /usr/lib/libcrypto.so.0.9.7 (0x41797000)
       libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x41889000)
       libcrypt.so.1 => /lib/libcrypt.so.1 (0x418f2000)
       libresolv.so.2 => /lib/libresolv.so.2 (0x4191f000)
       libnsl.so.1 => /lib/libnsl.so.1 (0x41931000)
       libexpat.so.1 => /usr/lib/libexpat.so.1 (0x41946000)
       libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x41966000)
       libcom_err.so.2 => /lib/libcom_err.so.2 (0x4198a000)

The explanation is out of my reach. Anyway, I put PATH="$PATH:/mnt/sdb2/opt/jre1_5_0/bin" as the last line of /home/dsl/.bashrc as you suggested and now, guess what, EVERYTHING IS WORKING FINE! I get to the directory where my java app is and just launch it. Perfect.

Thanks so much to all!

Chamane :laugh:

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.