How to set up a chroot environment

I never used chroot before so i do apologise if my questions seem to be noobish.
I`m running openSUSE Tumbleweed so the first question is: can i run ONLY another openSUSE OS inside the environment ? or can i run any distro i want ?
My second question is how do it set up the environment to act just like my normal OS, with both root and user rights on it? and of course can i run X ?
And finally third question: after googling a bit i did not found a tutorial for openSUSE but i have seen that is says that i have mount and/or bind certain things, how do i make the same thing under openSUSE for the respective chroot environment?

AFAIK you cannot use chroot to run another instance of openSUSE.

Here’s an example of chroot usage: boot from a LiveCD, mount the “/” partition of the system to, let’s say, “/mnt”. Then do “chroot /mnt” and the running LiveCD will consider “/mnt” as its root.

If you want to run another instance of openSUSE, use some virtualization software like Xen, VirtualBox.

Why? i found some other distro documentation that says it can run another instance of that OS either a new or older version.
So then i can run inside chroot another linux distro for e.g ?

creatura85 wrote:
> Knurpht;2378059 Wrote:
>> AFAIK you cannot use chroot to run another instance of openSUSE.
>> …
> Why? i found some other distro documentation that says it can run
> another instance of that OS either a new or older version.
> So then i can run inside chroot another linux distro for e.g ?

Let’s see. You’re the one asking for help. Yet you’re also the one
making unsubstantiated claims and asking others to justify why they
aren’t true.

That’s usually called trolling.

At least supply a URL to backup your claim. Better yet, why not read the
chroot manpage:

“This call changes an ingredient in the pathname resolution process and
does nothing else”.

On 08/25/2011 03:56 PM, creatura85 wrote:

> Why? i found some other distro documentation that says it can run
> another instance of that OS either a new or older version.

so, follow the guide provided by that “other distro documentation” to
learn how they do it, and when know how to do it with openSUSE you can
put together a how-to for here http://tinyurl.com/5v6ssca :wink:


DD
openSUSE®, the “German Engineered Automobile” of operating systems!

On Thu, 25 Aug 2011 13:56:02 +0000, creatura85 wrote:

> Why? i found some other distro documentation that says it can run
> another instance of that OS either a new or older version. So then i can
> run inside chroot another linux distro for e.g ?

chroot is not a virtualization solution. You would not end up with the
‘other’ distro’s kernel running, it would still be running under the
‘parent’ kernel.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

djh-novell: your opinion is wrong but you can keep it that way.

DenverD: do you think that DebootstrapChroot ( https://help.ubuntu.com/community/DebootstrapChroot) or dchroot ( https://help.ubuntu.com/community/BasicChroot ) are the same with chroot found on openSUSE ?

hendersj: thank you for the good point.

On 08/25/2011 08:06 PM, creatura85 wrote:
> DenverD: do you think that DebootstrapChroot …
> https://help.ubuntu.com/community/DebootstrapChroot
> are the same with chroot found on openSUSE ?

here is what i think: if you follow “Step 1” in the above URL you will
begin to understand that Dave knows just a little bit more about
openSUSE than you do at this point along your Linux journey, and you
would be well served to listen to him, grasshopper.


DD
openSUSE®, the “German Engineered Automobile” of operating systems!

To explain myself a bit more:
Let’s say one has 11.3 installed on one partition, with addition of program Y which has no dependencies. 11.4 is installed on another partition. It would be possible to boot 11.4, chroot to the “/” of 11.3 (with some additional commands) and run program Y. Still, the running OS would be 11.4. Yet one can make changes to the 11.3 install by running Yast after the chroot. This can be used for example to boot from one partition or a LiveCD, chroot to the computer’s installed linux version (on another partition), and reinstall the bootloader of that installed system. The chroot command does what it’s name says: it changes the root of the the OS.
Do a “man chroot” and you’ll see you cannot use it to virtualize other (linux) OS’s.

A couple of things I’d like to say, reading the above: please be aware that you’re all here for the same reason, which is openSUSE. Questions are never ever stupid or dumb. Better ask 10 times than assuming the wrong things.

Thats why im asking, to learn and understand from you advanced linux users of openSUSE :slight_smile:

chroot is not a virtualisation solution. Period.