2

I have Fedora and Ubuntu installed on different partitions on my system. Now i want to make programs such as "adobe reader" or "kerio-control-vpnclient-8.4.2-2869-linux" available to fedora. those programs are installed on my Ubuntu system. I want to know how can i make those programs available to Fedora with the help of chroot or other similar commands(like LXC).

ali129
  • 31
  • 2
    Why don't you just install them under Fedora? Libraries and binaries might be incompatible ... – Bichoy Apr 19 '15 at 05:45

2 Answers2

0

chroot will not solve your problem at all. In fact, chroot will make you run this program as if you were in Ubuntu itself and not in Fedora. You will need a complicated setup to make them access your file system outside chroot. chroot is meant more for isolation.

One good solution for your problem however is just to use environment variables. Maybe a small bash script that sets your path to Ubuntu location and also changes LD_LIBRARY_PATH might work.

For example, something like:

#!/bin/bash
export PATH=PATH_TO_UBUNTU_BIN:$PATH
export LD_LIBRARY_PATH=PATH_TO_UBUNTU_LIB:$LD_LIBRARY_PATH
acroread

where PATH_TO_UBUNTU_BIN and PATH_TO_UBUNTU_LIB should be the paths to your ubuntu bin (like /bin and /usr/local/bin or wherever your acroread resides) and PATH_TO_UBUNTU_LIB is the path to Ubuntu shared libraries directory (like /lib or /lib64).

Bichoy
  • 3,106
  • 2
  • 21
  • 34
  • chroot does help, because a lot of programs look for files at fixed locations. PATH and LD_LIBRARY_PATH doesn't do everything. Schroot provides the “complicated setup” (in fact not so complicated) to make the rest of the filesystem accessible in the chroot. – Gilles 'SO- stop being evil' Apr 20 '15 at 00:06
  • Thanks Gilles for the precious info. I didn't know about schroot before. I was thinking along the lines of chroot only, where he will have to somehow figure a setup so that he can access his original system, which would require maybe some directories or symlinks in his Ubuntu installation. And these might appear to be broken whenever he boots into Ubuntu. That's what I thought, but thanks for your info :) – Bichoy Apr 20 '15 at 01:08
0

Install schroot on your Fedora system. Schroot is a wrapper around chroot that allows non-root users to use predefined chroots and arranges for home directories, /proc, etc. to be present in the chroot.

I wrote a schroot guide in How do I run 32-bit programs on a 64-bit Debian/Ubuntu? With a Fedora host system, the setup is mostly the same — it's mostly the distribution in the chroot that needs to be tweaked. Install the debootstrap package to install Ubuntu in the chroot.

To invoke a program in the chroot from outside, you need to invoke schroot. You can use a shell wrapper like this for a chroot called trusty:

#!/bin/sh
exec schroot -c trusty -p -q -- "${0##*/}" "$@"

Make symbolic links to this script with the names of the programs you want to invoke. For example, if this script is located at /usr/local/bin/trusty, and you want the acroread command to invoke the program in the trusty chroot, make a symbolic link

ln -s trusty /usr/local/bin/acroread