LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-10-2008, 06:45 PM   #1
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Rep: Reputation: 49
Question Can you run a program in one Linux partition from another Linux partition?


OK, I'm probably crazy for even asking, but I will in case there is some small chance this is possible: if I have say Linux Distro1 installed on a partition, and Linux Distro2 installed on another partition, is it possible to run a program on Distro2 that is intalled in Distro1?

It seems like it might be conceivable if I somehow set up the environmental variables correctly so that the program, when it looks for directories for instance, it goes to /mnt/distro1/ as the root directory instead of / in distro2. But that may just be the tip of the iceberg. Yes, maybe it's a ludicrous idea, but I ask because otherwise I have to download and install ALL the same programs, libraries, etc in Distro2 as I have in Distro1. Would be great if I could somehow share them!

Thanks for any help.
 
Old 05-10-2008, 07:23 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Quote:
Originally Posted by CJS View Post

if I have say Linux Distro1 installed on a partition, and Linux Distro2 installed on another partition, is it possible to run a program on Distro2 that is intalled in Distro1?
Yes, it is possible. Mount the second partition and give the full pathname to the program you want to execute.

---------------------
Steve Stites
 
Old 05-10-2008, 08:34 PM   #3
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Original Poster
Rep: Reputation: 49
Quote:
Originally Posted by jailbait View Post
Yes, it is possible. Mount the second partition and give the full pathname to the program you want to execute.

---------------------
Steve Stites
Thanks, Steve, but when I run the command in Distro2 with full path to the Distro1 mounted partition, Distro2 complains I don't have the necessary libraries installed (which are installed in Distro1). Is there a way to make the command run totally in Distro1's environment, i.e. so it finds the necessary libraries?
 
Old 05-10-2008, 08:43 PM   #4
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Look up the CHROOT command. That should accomplish what you are looking for

You would CHROOT (CHange ROOT) into the other distro, effectively 'moving' into that filesystem as the root filesystem, and then run the command or application you want to use.

Sasha

Last edited by GrapefruiTgirl; 05-10-2008 at 08:44 PM. Reason: typo
 
Old 05-10-2008, 08:52 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Mmmm - dunno about that.
Presumably the OP wants the program to run "in" distro2 - for whatever reason.

Me, I just install what I want/need.
 
Old 05-10-2008, 09:38 PM   #6
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
True enough, @ syg00, I see your point;

But as an example, for clarity, I once (OK, more than once ) borked my Slackware install a little bit (let's call it distro2 in this context) by screwing up my shared libraries, but I had another working Linux installed on a different partition (Distro1).

I wanted to use Distro2's Midnight Commander to fix some stuff on Distro2, but Distro2's mc wouldn't run. Not much *would* run at the time. But, I could mount stuff, and I could chroot; so I mounted the Distro1 partition, chrooted into it, and ran the Midnight Commander of Distro1, which I then used to navigate around and fix stuff in Distro2.

When all done, I exited the chroot, rebooted Distro2, and.. Happiness reigned

Sasha


Also, an idea (untested, so try at own risk): couldn't one add the [library?] path of the second distro, to the beginning of the [library?] path of the first distro (and maybe run ldconfig?), and then simply run the desired application using an /absolute/path/to/it, as suggested earlier? Not sure if this would work, just an idea...

Last edited by GrapefruiTgirl; 05-10-2008 at 09:43 PM.
 
Old 05-11-2008, 03:37 PM   #7
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Original Poster
Rep: Reputation: 49
Quote:
Originally Posted by GrapefruiTgirl View Post
Look up the CHROOT command. That should accomplish what you are looking for

You would CHROOT (CHange ROOT) into the other distro, effectively 'moving' into that filesystem as the root filesystem, and then run the command or application you want to use.

Sasha
Thanks for the idea, but it doesn't quite work, at least not for the programs I tried. For instance, one program returned:
Code:
Error: Unable to initialize gtk, is DISPLAY set properly?
And yet $DISPLAY was :0.0, which is what it is when I run it OK in my other distro. Could part of the problem be that distro1 is set up primarily for Gnome, while I'm using KDE in distro2?

Another program, Amarok, returned:
Code:
: cannot connect to X server :0.0
And Audacity returned:
Code:
Gtk-WARNING **: cannot open display: :0.0
So it looks like my problem at the moment is getting the display set correctly, but there could be more problems.

Any other ideas? Thanks for the help.
 
Old 05-11-2008, 09:00 PM   #8
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Maybe a long shot, but you could try telling it to run on another display. The default display is 0:0 when running a normal single instance of X. By following a command with -- :1 you can tell the program to start on display 0:1. This may however, if it works, start the application on another screen that is not part of your running desktop session, making interaction with it rather difficult.. If the application is something you want to use to do a task, then quit (like in my Midnight Commander example), it may be OK; but for something Like Amarok, which I presume you will want to interact with and have running in the background, this probably isn't a useful solution.

As an example (which works for sure) so you can get the idea, open a console window and type
startx -- :1
and the display should switch to a new X session and start up a new instance of X. When done, just exit or log out as usual, and you will be returned to your original session (or hit CTRL-ALT-F7 to switch back while leaving the new session running).

Note that I am uncertain whether this will help with the GTK errors, but in the case of the error Amarok returned to you, it *might* work.. Maybe chrooting, then running the application with the "-- :1" switch will provide interesting results. Again, I haven't tried it, but there's nothing to lose..

Ultimately, as someone mentioned earlier (and which I agree with) the obvious solution is to simply install the apps you want, into the distro you want them to run in. There are certain tools and commands that I ALWAYS want to have access to, so they are always the first things I install into a new installation if they are not already present.

Another workaround, which is again much more trouble than it's worth, would be to compile a static version of the application (as opposed to one that uses shared libraries) thereby including the usually external parts (like GTK) into the app itself. I *guess* this would solve the GTK problem. Again, I haven't tried this either (I generally build with shared libs) but if you do, let us know what you learn.

PS - Part of the problem could indeed be the difference between Gnome and KDE. A Gnome install uses GTK, while KDE is build against Qt. This doesn't mean that you can't install GTK on the KDE system, or install Qt on the Gnome system if it is not present, but just that by default, the respective packages may not be present. But, I was hoping that by chrooting, the application would be able to use the graphical toolkit of the distro you chrooted into; maybe the stuff I mentioned about editing the library path would solve this issue, but really, for what its worth, I wouldn't bother. Too much hassle, and possibly introducing the chance of very weird shared library problems.

SVA

Last edited by GrapefruiTgirl; 05-11-2008 at 09:18 PM. Reason: more info, ideas.. Maybe a typo somewhere..
 
Old 05-13-2008, 09:02 AM   #9
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247

Original Poster
Rep: Reputation: 49
Thanks Sasha, for the additional ideas, but I think it is getting a little too messy/complex at this point to keep fiddling with. I think I'll just have to resign myself to installing all the same apps that I want. I appreciate your help though.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
partition program for linux? mimithebrain Linux - General 7 10-26-2005 06:10 PM
Is there a program to DEFRAG a partition under linux?? piggyaugu Linux - Newbie 3 08-06-2005 11:36 PM
Partition my computer to run Linux hernan Linux - Newbie 3 01-27-2005 03:03 AM
creating a partition to run Linux Redhat 7.0 ecawilkinson Linux - Laptop and Netbook 5 01-28-2004 01:40 PM
Partition Magic-like program for Linux? hstang Linux - General 1 02-18-2003 01:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration