FAKECHROOT(1) | FAKECHROOT(1) |
fakechroot - gives a fake chroot environment
fakechroot [-s|--use-system-libs] [-l|--lib library] [-d|--elfloader ldso] [-e|--environment type] [-c|--config-dir directory] [-b|--bindir directory] [--] [command]
fakechroot -h|--help
fakechroot -v|--version
fakechroot runs a command in an environment where is additional possibility to use chroot(8) command without root privileges. This is useful for allowing users to create own chrooted environment with possibility to install another packages without need for root privileges.
fakechroot replaces some C library functions (chroot(2), open(2), etc.) by ones that simulate the effect of being called with root privileges.
These wrapper functions are provided as a shared library libfakechroot.so which is loaded through the "LD_PRELOAD" mechanism of the dynamic loader. (See ld.so(8))
In fake chroot you can install i.e. Debian bootstrap with debootstrap(8) command. In such environment you can run i.e. apt-get(8) command to install another packages. You don't need a special privileges and you can run it on common user's account.
The environment type is guessed based on command name with optional extension removed (e.g. running gettext.sh loads "gettext" environment file). If command argument is fakeroot(1) this argument is omitted and next argument is taken as environment type.
The configuration file name is type.env and is searched at $HOME/.fakechroot and /etc/fakechroot directories.
The default environment type is default and its configuration file name is "default.env".
The special environment none means that no environment settings are loaded at all.
Try this setting if you noticed following errors:
$ fakechroot /usr/sbin/chroot /tmp/sarge /bin/true /bin/true: relocation error: /srv/sarge/lib/tls/libc.so.6: symbol _dl _starting_up, version GLIBC_PRIVATE not defined in file ld-linux.so.2 with link time reference $ fakechroot /usr/sbin/chroot /tmp/centos4 /bin/true Segmentation fault
An example session with fakechroot:
$ id uid=1000(dexter) gid=1000(dexter) groups=1000(dexter) $ fakechroot fakeroot debootstrap sid /tmp/sid I: Retrieving Release I: Retrieving Release.gpg I: Checking Release signature ... I: Base system installed successfully. $ fakechroot fakeroot chroot /tmp/sid apt-get install -q hello Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: hello 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 57.4 kB of archives. After this operation, 558 kB of additional disk space will be used. Get:1 http://ftp.us.debian.org/debian/ sid/main hello amd64 2.8-4 [57.4 kB] Fetched 57.4 kB in 0s (127 kB/s) Selecting previously unselected package hello. (Reading database ... 24594 files and directories currently installed.) Unpacking hello (from .../archives/hello_2.8-4_amd64.deb) ... Processing triggers for man-db ... Processing triggers for install-info ... Setting up hello (2.8-4) ... $ fakechroot chroot /tmp/sid hello Hello, world!
fakeroot(1) is a complementary tool which emulates root environment. fakeroot and fakechroot might wrap the same C library functions, i.e. mknod(2) function. It is important to start fake environment in proper order. fakeroot should be started inside fakechroot:
$ fakechroot fakeroot chroot /tmp/sid /bin/mknod /tmp/device c 1 2
fakechroot is a regular, non-setuid program. It does not enhance a user's privileges.
fakechroot should not be used as a tool for enhancing system security i.e. by separating (sandboxing) applications. It is very easy to escape from a fake chroot environment.
fakechroot should not be run with real root privileges. It might decrease the security of the system because the fakechroot provides own version of core functions with behavior depended on some environment variables.
The substituted command inherits "FAKECHROOT_*" variables but the original "FAKECHROOT_BASE" variable which is saved as "FAKECHROOT_BASE_ORIG". It means that substituted command runs outside fakechroot environment. Also original command name is saved as "FAKECHROOT_CMD_ORIG".
For example:
export FAKECHROOT_CMD_SUBST=/usr/bin/mkfifo=/bin/true
will substitute "/bin/true" for "/usr/bin/mkfifo" and will make possible to install sysvinit binary package.
Give as many substitute commands as you want, separated by ":" (colon) characters.
It is suggested to substitute at least:
to make debootstrap(8) working correctly.
To prevent some looping, the command substitution is done only if "FAKECHROOT_CMD_ORIG" variable is not set currently.
$ case "`FAKECHROOT_DETECT=1 /bin/echo`" in fakechroot*) echo LOADED;; esac
This dynamic linker will be invoked directly. The dynamic linker don't allow to change "argv[0]" besides the file name of the executable file, so some application won't work correctly, i.e. busybox(1).
The /dev, /proc and /sys directories are excluded by default if this environment variable is not set.
This list has to contain at most 100 elements.
The default value is "/lib/systemd:/usr/lib/man-db" for systemctl(1) and man(1) commands.
$ export FAKECHROOT_EXCLUDE_PATH=/tmp:/proc:/dev:/sys:/var/run:/home
fakeroot(1), debuild(1), debootstrap(8), rinse(8), http://fakechroot.alioth.debian.org/
If you find the bug or want to implement new features, please report it at <https://github.com/fakechroot/fakechroot/issues>
Copyright (c) 2003-2017, 2019 Piotr Roszatycki <dexter@debian.org>
Copyright (c) 2007 Mark Eichin <eichin@metacarta.com>
Copyright (c) 2006, 2007 Alexander Shishkin <virtuoso@slind.org>
Copyright (c) 2006, 2007 Lionel Tricon <lionel.tricon@free.fr>
fakechroot is distributed under the GNU Lesser General Public License (LGPL 2.1 or greater).
16 Mar 2019 | fakechroot |