注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Install/Chroot"

From Funtoo
Jump to navigation Jump to search
m (fix chroot prompts exactly mirroring behavior that goes on with the prompt, and then forcing ps1 reassignment upon users.)
 
(16 intermediate revisions by 4 users not shown)
Line 3: Line 3:
== Chroot into Funtoo == <!--T:1-->
== Chroot into Funtoo == <!--T:1-->
</includeonly><noinclude><languages/>
</includeonly><noinclude><languages/>
== Install Guide: Chroot into Funtoo ==
= Install Guide: Chroot into Funtoo =  


<!--T:2-->
<!--T:2-->
Line 9: Line 9:


<!--T:14-->
<!--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 set up your Funtoo Linux system, we need to "enter into" it before we boot. If you are using the Funtoo Linux LiveCD, this can be easily done with the {{c|fchroot}} command:


*if you would like to compile in ram, expand your run tmpfs to be half of your ram:
<!--T:17-->
{{console|body=
{{console|body=
###i## mount -t tmpfs tmpfs /run
# ##i##fchroot /mnt/funtoo
%fchroot%
}}
}}


<!--T:8-->
<!--T:18-->
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:
The {{c|fchroot}} command will take care of all necessary steps to enter into your new Funtoo Linux system, as well as clean up things when you exit the fchroot by typing
{{console|body=
{{c|exit}} or {{c|ctrl-D}}.
###i## cd /mnt/funtoo
/mnt/funtoo ###i## mount -t proc none proc
/mnt/funtoo ###i## mount --rbind /sys sys
/mnt/funtoo ###i## mount --rbind /dev dev
/mnt/funtoo ###i## mount --rbind /run run
}}


<!--T:9-->
<!--T:19-->
You'll also want to copy over {{f|resolv.conf}} or insert cloudflares DNS in order to have proper resolution of Internet hostnames from inside the chroot:
If you are using another LiveCD or USB media to install Funtoo, you can manually chroot by using the following set of commands:
{{console|body=
###i## cp /etc/resolv.conf /mnt/funtoo/etc/
or
###i## echo "nameserver 1.1.1.1" > /mnt/funtoo/etc/resolv.conf
}}
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:


<!--T:10-->
<!--T:8-->
{{console|body=
{{console|body=
/mnt/funtoo ###i## env -i HOME=/root TERM=$TERM /bin/chroot /mnt/funtoo bash -l
# ##i##cd /mnt/funtoo
/ #
# ##i##mount --rbind /proc proc
/ ###i##export PS1="FUNTOO $PS1"
# ##i##mount --rbind /sys sys
# ##i##mount --rbind /dev dev
# ##i##cp /etc/resolv.conf /mnt/funtoo/etc/
# ##i##chroot . /bin/su --login
%chroot% }}
%chroot% }}


<!--T:11-->
<!--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-->
<!--T:12-->

Latest revision as of 00:59, May 26, 2023

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 set up your Funtoo Linux system, we need to "enter into" it before we boot. If you are using the Funtoo Linux LiveCD, this can be easily done with the fchroot command:

root # fchroot /mnt/funtoo
fchroot #

The fchroot command will take care of all necessary steps to enter into your new Funtoo Linux system, as well as clean up things when you exit the fchroot by typing exit or ctrl-D.

If you are using another LiveCD or USB media to install Funtoo, you can manually chroot by using the following set of commands:

root # cd /mnt/funtoo
root # mount --rbind /proc proc
root # mount --rbind /sys sys
root # mount --rbind /dev dev
root # cp /etc/resolv.conf /mnt/funtoo/etc/
root # chroot . /bin/su --login
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.

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 >