Difference between revisions of "Install/Chroot"

From Funtoo
Jump to navigation Jump to search
m (/mnt/funtoo/proc, not /proc)
(33 intermediate revisions by 4 users not shown)
Line 1: Line 1:
=== Chroot into Funtoo ===  
<translate>
<includeonly>
== Chroot into Funtoo == <!--T:1-->
</includeonly><noinclude><languages/>
= Install Guide: Chroot into Funtoo =  
 
<!--T:2-->
{{InstallNavigation|num=9|prev=Download and Extract Stage3|next=Download Portage Tree}}</noinclude>
 
<!--T:14-->
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.
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.


<!--T:8-->
Before chrooting, there are 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:
Before chrooting, there are 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|body=
{{console|body=
Line 10: Line 20:
}}
}}


<!--T:9-->
You'll also want to copy over {{f|resolv.conf}} in order to have proper resolution of Internet hostnames from inside the chroot:
You'll also want to copy over {{f|resolv.conf}} in order to have proper resolution of Internet hostnames from inside the chroot:
{{console|body=
{{console|body=
Line 16: Line 27:
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:
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|body=###i## env -i HOME=/root TERM=$TERM /bin/chroot . bash -l}}
<!--T:10-->
{{console|body=###i## env -i HOME=/root TERM=$TERM chroot . bash -l
%chroot% }}


<!--T:11-->
{{Note|For users of live CDs with 64-bit kernels installing 32-bit systems: Some software may use {{c|uname -r}} to check whether the system is 32 or 64-bit. You may want to append linux32 to the chroot command as a workaround, but it's generally not needed.}}
{{Note|For users of live CDs with 64-bit kernels installing 32-bit systems: Some software may use {{c|uname -r}} to check whether the system is 32 or 64-bit. You may want to append linux32 to the chroot command as a workaround, but it's generally not needed.}}
{{Important|If you receive the error "{{c|chroot: failed to run command `/bin/bash': Exec format error}}", it is most likely because you are running a 32-bit kernel and trying to execute 64-bit code. Make sure that you have selected the proper type of kernel when booting SystemRescueCD.}}
{{Important|If you receive the error "{{c|chroot: failed to run command `/bin/bash': Exec format error}}", it is most likely because you are running a 32-bit kernel and trying to execute 64-bit code. Make sure that you have selected the proper type of kernel when booting your live CD.}}


<!--T:12-->
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:
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:
{{console|body=# ##i##export PS1="(chroot) $PS1"}}
{{console|body=%chroot% ##i##export PS1="(chroot) $PS1"}}
Test internet name resolution from within the chroot:
Test internet name resolution from within the chroot:
{{console|body=###i## ping -c 5 google.com}}
{{console|body=%chroot% ##i##ping -c 5 google.com}}
If you can't ping, make sure {{f|/etc/resolv.conf}} doesn't contain things like {{c|127.0.x.x}} addresses, if it does, change the {{c|127.0.x.x}} entry to {{c|8.8.8.8}} -- Google's public dns address.  Make sure to replace this with your dns of choice once the system is installed.
 
<!--T:15-->
If you can't ping, make sure that {{f|/etc/resolv.conf}} specifies a valid IP address for a reachable nameserver in its {{c|nameserver}} setting.


<!--T:13-->
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 start successfully, without any manual assistance, when your system is restarted.
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 start successfully, without any manual assistance, when your system is restarted.
</translate>
<noinclude>{{InstallNavigation|num=9|prev=Download and Extract Stage3|next=Download Portage Tree|align=right}}</noinclude>

Revision as of 20:02, April 17, 2021

Other languages:
English • ‎Türkçe • ‎español • ‎polski • ‎português do Brasil • ‎русский • ‎中文(中国大陆)‎

Install Guide: Chroot into Funtoo

Install Guide, Chapter 9 < Prev Next >

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 are 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 /mnt/funtoo/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
chroot #
   Note

For 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 to 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 most likely because you are running a 32-bit kernel and trying to execute 64-bit code. Make sure that you have selected the proper type of kernel when booting your live CD.

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:

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

Test internet name resolution from within the chroot:

chroot # ping -c 5 google.com

If you can't ping, make sure that /etc/resolv.conf specifies a valid IP address for a reachable nameserver in its nameserver setting.

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 start successfully, without any manual assistance, when your system is restarted.

Install Guide, Chapter 9 < Prev Next >