Difference between revisions of "Install/Chroot"

From Funtoo
Jump to navigation Jump to search
(Undo revision 9978 by Gkn (talk))
Line 1: Line 1:
<noinclude>
<noinclude>
{{InstallPart|the chroot process}}
{{InstallPart|the chroot process}}
</noinclude>
<noinclude>
{{Note|This is a template that is used as part of the Installation instructions, to describe the process of chrooting into the stage3. Templates are being used to allow multiple variant install guides that use most of the same re-usable parts.}}
</noinclude>
</noinclude>
=== Chroot into Funtoo ===
=== Chroot into Funtoo ===
Before chrooting into your new system, there's a few things that need to be done first. You will need to mount /proc and /dev inside your new system. Use the following commands:
To install Funtoo Linux, the {{c|chroot}} command is first used. The chroot command will "switch into" the new Funtoo Linux system, so the commands you execute after running "chroot" will run within your newly-extracted Funtoo Linux system.
 
Before chrooting, there's a few things that need to be done to set up the chroot environment. You will need to mount {{f|/proc}}, {{f|/sys}} and {{f|/dev}} inside your new system. Use the following commands to do so:
<console>
<console>
# ##i##cd /mnt/funtoo
# ##i##cd /mnt/funtoo
Line 11: Line 16:
</console>
</console>


<noinclude>
You'll also want to copy over <code>resolv.conf</code> in order to have proper resolution of Internet hostnames from inside the chroot:
{{Note|This is a template that is used as part of the Installation instructions, to describe the process of chrooting into the stage3. Templates are being used to allow multiple variant install guides that use most of the same re-usable parts.}}
</noinclude>
 
You'll also want to copy over <code>resolv.conf</code> in order to have proper DNS name resolution from inside the chroot:
<console>
<console>
# ##i##cp /etc/resolv.conf etc
# ##i##cp /etc/resolv.conf etc
</console>
</console>


Now you can chroot into your new system. Use <code>env</code> before <code>chroot</code> to ensure that no environment variables from the installation media are used by your new system:
Now you can chroot into your new system. Use <code>env</code> before <code>chroot</code> to ensure that no environment settings from the installation media are pulled in to your new system:


<console>
<console>

Revision as of 17:46, May 20, 2015


   Note

This is a template that is used as part of the Installation instructions which covers: the chroot process. Templates are being used to allow multiple variant install guides that use most of the same re-usable parts.


   Note

This is a template that is used as part of the Installation instructions, to describe the process of chrooting into the stage3. Templates are being used to allow multiple variant install guides that use most of the same re-usable parts.

Chroot into Funtoo

To install Funtoo Linux, the chroot command is first used. The chroot command will "switch into" the new Funtoo Linux system, so the commands you execute after running "chroot" will run within your newly-extracted Funtoo Linux system.

Before chrooting, there's a few things that need to be done to set up the chroot environment. You will need to mount /proc, /sys and /dev inside your new system. Use the following commands to do so:

root # cd /mnt/funtoo
root # mount -t proc none proc
root # mount --rbind /sys sys
root # mount --rbind /dev dev

You'll also want to copy over resolv.conf in order to have proper resolution of Internet hostnames from inside the chroot:

root # cp /etc/resolv.conf etc

Now you can chroot into your new system. Use env before chroot to ensure that no environment settings from the installation media are pulled in to your new system:

root # env -i HOME=/root TERM=$TERM chroot . bash -l
   Note

Users of live CDs with 64-bit kernels installing 32-bit systems: Some software may use uname -r to check whether the system is 32 or 64-bit. You may want append linux32 to the chroot command as a workaround, but it's generally not needed.

   Important

If you receive the error "chroot: failed to run command `/bin/bash': Exec format error", it is probably because you are running a 32-bit kernel and trying to execute 64-bit code. SystemRescueCd boots with a 32-bit kernel by default.

It's also a good idea to change the default command prompt while inside the chroot. This will avoid confusion if you have to change terminals. Use this command:

root # export PS1="(chroot) $PS1"

Congratulations! You are now chrooted inside a Funtoo Linux system. Now it's time to get Funtoo Linux properly configured so that Funtoo Linux will boot successfully when your system is restarted.