You are not logged in.

#1 2008-03-26 13:26:19

alcafar
Member
From: Italy
Registered: 2008-03-23
Posts: 47

Running 64b apps from chrooted 32b (e.g. ktorrent64 from firefox32)

I run arch64 with chroot for some 32 bit applications (did like the wiki http://wiki.archlinux.org/index.php/Arc … bit_system).
I'm new to arch and to 64 bit architecture (just two days!).
I run firefox @ 32bit for flash and java plugins.
When I try to open a file from firefox32, it won't find the application because searches in the 32 bit environment.
For example I want to click on a torrent file and say "open with ktorrent" (where of course ktorrent is installed in the 64 bit environment), or click on a tar.gz and say "open with ark". Let's use this last case as an example.
I succeeded to do it up to a certain point, but I miss the final one, so please help me to find the solution! The basic idea is chrooting from the 32 bit environment to the original 64 bit one.
This is what I did:

1) I created the directory /opt/arch32/opt/arch64 (to say the truth I did'n put the "/opt"s, but I will discuss as if I did to follow the wiki's notations

2) I added a "mount" and an "umount" line to  /etc/rc.d/arch32 rc

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

case $1 in
    start)
        stat_busy "Starting Arch32 chroot"
        mount --bind /proc /opt/arch32/proc
        mount --bind /proc/bus/usb /opt/arch32/proc/bus/usb
        mount --bind /dev /opt/arch32/dev
        mount --bind /dev/pts /opt/arch32/dev/pts
        mount --bind /dev/shm /opt/arch32/dev/shm
        mount --bind /sys /opt/arch32/sys
        mount --bind /tmp /opt/arch32/tmp
        mount --bind /home /opt/arch32/home
        mount --bind / /opt/arch32/opt/arch64 #ADDED LINE
        add_daemon arch32
        stat_done
        ;;
    stop)
        stat_busy "Stopping Arch32 chroot"
        umount /opt/arch32/proc/bus/usb
        umount /opt/arch32/proc
        umount /opt/arch32/dev/pts
        umount /opt/arch32/dev/shm
        umount /opt/arch32/dev
        umount /opt/arch32/sys
        umount /opt/arch32/tmp
        umount /opt/arch32/home
        umount /opt/arch32/opt/arch64 # ADDED LINE
        rm_daemon arch32
        stat_done
        ;;
    restart)
        $0 stop
        sleep 1
        $0 start
        ;;
    *)
        echo "usage: $0 {start|stop|restart}"
esac
exit 0

3) I installed dchroot inside the 32bit environment and then added the line

arch64 /opt/arch64

to /opt/arch32/etc/dchroot.conf

4) I created and made executable the script /opt/arch32/usr/bin/ark64

#!/bin/bash
dchroot -d "ark $@"

Now, this system works from the command line, for example I can do, from inside the 32bit environment,

ark64 file.tar.gz

but I don't know how to let it work from firefox. I guess I have something to change in the ark64 script, but I don't know what.

Another issue: if I do "chroot /opt/arch32" and then "chroot /opt/arch64", my home directory is empty. Maybe I should have added some other mount and umount lines? I'm a little scared of this, because I don't know what will happen of the content of my home directory when I stop the arch32 daemon.

Last edited by alcafar (2008-03-26 13:44:10)

Offline

#2 2008-04-03 13:54:22

Ibex
Member
Registered: 2006-03-02
Posts: 135

Re: Running 64b apps from chrooted 32b (e.g. ktorrent64 from firefox32)

Is it possible to do on a .tar.gz "open with" and then select the ark64 executable script? So that firefox tries to open the .tar.gz with the ark64 script.

Offline

#3 2008-04-04 14:48:46

alcafar
Member
From: Italy
Registered: 2008-03-23
Posts: 47

Re: Running 64b apps from chrooted 32b (e.g. ktorrent64 from firefox32)

Ibex wrote:

Is it possible to do on a .tar.gz "open with" and then select the ark64 executable script? So that firefox tries to open the .tar.gz with the ark64 script.

Yes, it is.
Respect to my previous post, I modified /etc/rc.d/arch32 to mount also the home directory in the arch64 chroot (I have /home on a different partition than /):

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

case $1 in
    start)
        stat_busy "Starting Arch32 chroot"
        mount --bind /proc /opt/arch32/proc
        mount --bind /proc/bus/usb /opt/arch32/proc/bus/usb
        mount --bind /dev /opt/arch32/dev
        mount --bind /dev/pts /opt/arch32/dev/pts
        mount --bind /dev/shm /opt/arch32/dev/shm
        mount --bind /sys /opt/arch32/sys
        mount --bind /tmp /opt/arch32/tmp
        mount --bind /home /opt/arch32/home

        mount --bind / /opt/arch32/opt/arch64
        mount --bind /home /opt/arch32/opt/arch64/home                                                                                                              

        add_daemon arch32
        stat_done
        ;;
    stop)
        stat_busy "Stopping Arch32 chroot"
        umount /opt/arch32/proc/bus/usb
        umount /opt/arch32/proc
        umount /opt/arch32/dev/pts
        umount /opt/arch32/dev/shm
        umount /opt/arch32/dev
        umount /opt/arch32/sys
        umount /opt/arch32/tmp
        umount /opt/arch32/home

        umount /opt/arch32/opt/arch64

        rm_daemon arch32
        stat_done
        ;;
    restart)
        $0 stop
        sleep 1
        $0 start
        ;;
    *)
        echo "usage: $0 {start|stop|restart}"
esac
exit 0

I created an executable script /opt/arch32/usr/bin/run64.sh

#!/bin/bash

cmd=`basename $0`

for i in "$@"
do
        cmd="$cmd '$i'"
done

exec dchroot -d "$cmd"

and created some links

ln -s run64.sh ark
ln -s run64.sh ktorrent
ecc.

Now in firefox32 you can do for example on a tar.gz file "open with /usr/bin/ark".
It works also if the file name contain spaces, but not if it contains other characters that need to be escaped in bash, for example [ or ].
It's just a scripting issue now.
I read your other thread about compatibility mode, sounds interesting, I'll read something in the weekend.

Offline

Board footer

Powered by FluxBB