1

Consider the following directory tree (mychroot):

mychroot/
├── proc
│   └── cpuinfo
└── usr
    └── bin
        └── ls

On Fedora 20:

$ fakechroot chroot ./mychroot/  /usr/bin/ls proc
cpuinfo

Version:

$ fakechroot --version
fakechroot version 2.9

On Ubuntu:

$ fakechroot chroot ./mychroot/  /usr/bin/ls proc

lists the /proc entries from outside chroot.

Version:

$ fakechroot --version
fakechroot version 2.17.2

What could be going on here? Thanks for any insights.

Update:

Definitely looks like a change in behavior. I installed 2.10 on Ubuntu and I see the same result as on Fedora (with 2.9):

$ /usr/local/bin/fakechroot --version
fakechroot version 2.10
$ /usr/local/bin/fakechroot chroot ./mychroot  /usr/bin/ls proc
cpuinfo

Filed an issue upstream.

Amit
  • 412

1 Answers1

1

Fakechroot can be configured to exclude some paths, i.e. those paths will refer to the same location inside the (fake) chroot and outside. This is especially useful for directories like /dev and /proc which it is useful to have everywhere as a lot of programs depend on them.

Excluded paths can be defined via:

  • the FAKECHROOT_EXCLUDE_PATH environment variable;
  • a FAKECHROOT_EXCLUDE_PATH setting in configuration files in ~/.fakechroot and /etc/fakechroot, named COMMAND.env where COMMAND is the command invoked by fakechroot (e.g. chroot.env).

Check whether /proc is on the excluded list in Ubuntu via the environment, in ~/.fakechroot/chroot.env or in /etc/fakechroot/chroot.env. In the Debian package, /etc/fakechroot/chroot.env adds /dev, /proc and /sys to FAKECHROOT_EXCLUDE_PATH. If you don't want that, copy /etc/fakechroot/chroot.env to ~/.fakechroot/chroot.env and edit the relevant line, or else pass the -e argument to specify a different configuration file (e.g. fakechroot -e /dev/null chroot …).

  • Will specifying FAKECHROOT_EXCLUDE_PATH while executing the command override the setting in any configuration file? If so, can you give an example? FAKECHROOT_EXCLUDE_PATH=/proc:/sys fakechroot chroot ./mychroot /usr/bin/ls proc doesn't seem to work. Thanks a lot. – Amit Apr 21 '14 at 00:45
  • @Amit No, the configuration file appends to FAKECHROOT_EXCLUDE_PATH. If you want to remove /proc from the list, you need to use a different configuration file. – Gilles 'SO- stop being evil' Apr 21 '14 at 01:02
  • Thanks. Okay, now I could get what I wanted by using "-e none" on 2.17, but the package included in Fedora is 2.9 which doesn't have, "-e" option. So, I removed all possible env files from Ubuntu, but it still doesn't obey the FAKECHROOT_EXCLUDE_PATH env variable. Can you suggest an alternative which would work with both versions? – Amit Apr 21 '14 at 01:11