Sunday, December 17, 2006

klik on Gentoo

I was looking for new less painful ways to test bleeding edge software. I didn't really want to have to write ebuilds for programs I may only start a few times and then remove and have to deal with it messing with my normal libraries. So I thought of a couple methods I could use, a chroot in my home directory or as another user like I do for KDE4, but both methods are cumbersome and kinda tricky. I just wanted something that worked and that I could install and uninstall software as a user for testing that wouldn't wreak havoc on the rest of the system.

Enter klik. Klik follows a simple paradigm of "1 application == 1 file." I ripped that right off their wiki. Now this is quite cool. Normal users can download and install software for themselves easily and the programs will just be stored as a single file. So if they don't want the program any more they just delete that file. System administrators and software testers rejoice!

Now most of the documentation for installing and using klik exists for (K)Ubuntu and OpenSuSE. I run Gentoo and I wanted to give it a shot. I mean klik is meant to be cross-distribution so this should be a cakewalk right?

I started as the documentation says
wget klik.atekon.de/client/install -O -|sh
The first thing I noticed is that klik requires two things to install properly:
  1. hald needs to be running. To do this just run /etc/init.d/hald start.
  2. You also need to be in the /etc/sudoers file.

No problem now I have klik installed and I'm going to install a piece of software using it. So I point my browser (you can use FireFox, Konqueror, Opera etc.) to klik://opera91 to install Opera 9.1 beta.

Here's where the problem really starts. klik requires rpm2cpio to install Opera91 (I'm not sure if this is required for all recipies). I go and emerge rpm to get rpm2cpio, but there's a nasty Gentoo bug that prevents beecrypt(the only dependency I have for rpm) from compiling. So I use the workaround by setting CFLAGS="-march=i686 -O2 -pipe" and emerge beecrypt. Then I emerge rpm using my normal settings from /etc/make.conf.

So now I have klik installed and I have the requisite rpm2cpio on the system. So once again I point my browser to klik://opera91. I get another error:
Please install libstdc++5.so in order to use klik. The installation will continue, but the resulting cmg files will be larger than neccessary.

I do have that library. I checked. It's in /usr/lib/libstdc++-v3 and I checked in /etc/ld.so.conf and that directory is there. Just for kicks I ran ldconfig just to be sure the library is findable and retried the klik installation of Opera 9.1 beta. I still got the same warning message. No biggie I guess it does say that installation will still run so here goes.

It prompts me to ask if it should download the files required to do the installation and I answer yes and it begins downloading the software. Then I get another error:
Unable to mount /tmp/app/1
Where is this coming from? I click OK to that dialog and I get this error:
/home/krakrjak/.zAppRun: line 132: /tmp/app/1/wrapper: No such file or directory
hrm....

The code says
RESULT=$($MOUNT/wrapper $@ 2>&1) || derror "$RESULT"
I didn't work out all the details, but it appears that it's trying to run a file from one of the mount points that klik puts in /etc/fstab. I checked my /etc/fstab and the entries are there, but I did notice something in particular. The new entries are marked as cramfs. I didn't have cramfs installed, so I quickly issued an emerge cramfs and went to check the kernel. Sure enough I didn't have support for cramfs either so I added it CONFIG_CRAMFS=m and compiled the module.

Now that I have the cramfs module compiled and loaded and the userland programs installed I set off to give klik another shot.

I still got the warning about libstdc++5.so, but the installation went off without a hitch this time. Here's a screenshot of Opera 9.1 Beta running:


So to recap, if you are running Gentoo and you want to install klik you need a few things to get it working correctly these are:
  • You need to be in /etc/sudoers

  • Start hald or install it then start it

  • Install rpm

  • Make sure you have cramfs installed and configured in your kernel

1 comment:

Anonymous said...

Thanks for your Wiki post. As one of the core klik developers, I'd like to welcome you to klik. Please note that Gentoo isn't yet one of the officially supported distributions for klik, however we try to do our best to make it work as smooth an experience for Gentoo users as possible.

The easiest way to use klik on a Gentoo system might be [http://www.sabayonlinux.org/index.php?option=com_content&task=view&id=93&Itemid=2 Sabayon Linux] which appears to come pre-configured for klik.

klik uses some technologies that are enabled in all kernels of large mainstream distributions. Since many Gentoo users compile their own kernels, however, they have to take care of:
* Make sure your Kernel has loop mounting
* Make sure your Kernel has cramfs and zisofs filesystem support (You can check with "cat /proc/filesystems" - it should return cramfs and zisofs, among others. See http://klik.atekon.de/wiki/index.php/Troubleshooting#What_if_my_kernel_is_not_cramfs_and.2For_loop_enabled.3F if it doesn't.)

klik doesn't need root rights to download and run software, but you need root rights (once) to prepare the system for klik and to install the klik client. After the klik client is properly installed on the system, klik doesn't need root rights any more. (On systems that come pre-configured for klik, you never need root rights to use klik.)
* If the current user is in the "sudoers" file, then the klik installer uses that
* If the current user is not in the "sudoers" file, then the klik installer asks for the root password
* If all else fails, then klik puts a file called "klik-cmg-install-root" into the current user's home directory, and asks you to run that as root once. (The file basically sets up some entries in /etc/fstab in order to allow for mounting compressed application images.)
In summary, klik CAN use "sudoers" but does NOT require it.

klik doesn't actively use hald, maybe Gentoo does in some subtle way that makes it necessary, but at least the klik developers aren't actively aware of any need for hald.

Many software packages distributed by klik use libstdc++5.so, so please make sure you have it installed in its standard location (/usr/lib/libstdc++5.so), if you don't have it already. For example, a symlink "ln -s /usr/lib/libstdc++-v3 /usr/lib/libstdc++5.so" should do the trick.

Since klik occasionally makes use of the rpm format internally, you need to have rpm2cpio present on your system. On most distributions, it is present by default or can be easily added by installing the "rpm" package.

I have posted this information also to the newly created wiki page which you can edit without registration. Since I don't use Gentoo myself I would be thankful if you could review and update the information in the Wiki so that your fellow Gentoo users will have an easier start using klik.

Thanks for your attention and have fun with klik.