I have a stage 3 gentoo tarball.. extracted it to /mnt which is hosting /dev/sda3. Though there was no bin and no sign of bash after unpacking. Far as I'm aware, the rest of the configuration involves being in this fake gentoo environment to set it up initially. So.. I figure I could transplant bash from my running Fedora. This is one issue to a larger problem, but one part at a time.. I've heard something about a few files in lib or lib64, but wasn't clear on which..

edit: haven't used 'make' yet. to clarify where I'm at

  • Is /dev/sda3 an empty partition? – eyoung100 Jun 8 '15 at 17:34
  • ldd /bin/bash – Jeff Schaller Jun 8 '15 at 17:52
  • Yes, it's empty. and jeff, i dunno how that made bash spontaneously work (i would say appear, but bash itself was already in bin copied from my fedora) but it did. – Reimy Jun 8 '15 at 19:52
  • You are polluting the install by linking a tool outside /dev/sda3. If you were to reboot into Gentoo, after completing the handbook, your bash wouldn't function, unless you mounted Fedora – eyoung100 Jun 8 '15 at 20:38


First of all, never transplant/copy/link etc a live tool to the stage3 working area. As such, lets start over. First, I'm assuming /dev/sda3 is a blank partition. If not:

  1. Create /dev/sda3 using a tool like GParted.
  2. If you've already done Step 1, issue: mke2fs -j /dev/sda3
  3. mkdir /mnt/gentoo && mount /dev/sda3 /mnt/gentoo
  4. cd /mnt/gentoo
  5. wget http://distfiles.gentoo.org/releases/amd64/autobuilds/20150604/stage3-amd64-20150604.tar.bz2 -P /mnt/gentoo (Assuming amd64 arch.)
  6. tar xvjpf stage3-*.tar.bz2 --xattrs
  7. Continue in Stage - Section 2


The Stage 3 Tarball will contain a working Bash when unzipped. The following commands, in Section 1.4 of Installing the Gentoo base system:

chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) $PS1"

will enter a clean change root for building/installing.

Following the handbook assumes you want Gentoo as another live system. In your case, the only thing you should ignore is the GRUB configuration section, because Fedora contains a working Grub. As such, the boot option for Gentoo should be added to Fedora's Grub options.


As per comment, each linux distribution contains a profile file. It's stored in different places depending on the distribution. In Gentoo's case it's stored in the /etc directory because in Gentoo, every configuration file is meant to be customized. Quoting the Beyond Linux From Scratch Handbook:

The shell program /bin/bash (hereafter referred to as just "the shell") uses a collection of startup files to help create an environment. Each file has a specific use and may affect login and interactive environments differently. The files in the /etc directory generally provide global settings. If an equivalent file exists in your home directory it may override the global settings.

In this way, line 2, the source command, separates the environment of the build system (in your case Fedora) from the environment contained in the unzipped tarball that you entered with the chroot command. This ensures that no outside build tools, i.e. bash, configure, make will be able to "pollute" the build process (See my comment above). In other words: The configure, make and gcc compiler used to build the system will be those inside the chroot.

As for Line 3, exporting $PS1 prints (chroot) root@host #/

This is so people following the Handbook who like to flip thru TTY's or graphical consoles, to read all the documentation can tell where the chroot they are creating/updating is...

| improve this answer | |
  • 'ldd /bin/bash' from the post above made it appear. ..don't know what to say on that one. Thank you for helping, though! I honestly do half of those things outside of the terminal. And as for the actual install instructions, I dont get the purpose of the other two commands after chrooting.. if you would clarify, even though it's off-topic. Asking an actual human is much nicer, please understand :3 – Reimy Jun 8 '15 at 19:51
  • @Reimy You should never do anything outside of a change root. I hope I clarified for you. – eyoung100 Jun 9 '15 at 0:11

To transplant bash from your running Fedora, you'd need not only the bash executable, but also all the libraries it depends on. That's going to be fiddly and could conflict with the Gentoo files.

Get a statically-linked shell, so you can just add a single binary to your chroot that will work on its own. I don't think that Fedora provides any; you can obtain one of several from Debian: bash-static, sash (no command line edition, but several useful builtins such as cp, rm, mount, etc.), busybox-static (has basic command line edition and lots of builtins), zsh-static (better command line edition than bash and several useful builtins that you can activate with zmodload zsh/files). To extract a file from a .deb package, use e.g.

ar p zsh-static_5.0.7-5_amd64.deb | tar xJO ./bin/zsh5-static >/path/to/zsh-static

The point here is to have some debugging tools for your chroot. Of course you should fix the problem and install bash properly.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.