1FAKECHROOT(1) FAKECHROOT(1)
2
3
4
6 fakechroot - gives a fake chroot environment
7
9 fakechroot [-s⎪--use-system-libs] [-l⎪--lib library] [--] [command]
10
12 fakechroot runs a command in an environment were is additional possi‐
13 bility to use chroot(8) command without root privileges. This is useful
14 for allowing users to create own chrooted environment with possibility
15 to install another packages without need for root privileges.
16
17 fakechroot replaces more library functions (chroot(2), open(2), etc.)
18 by ones that simulate the effect the real library functions would have
19 had, had the user really been in chroot. These wrapper functions are in
20 a shared library /usr/lib/fakechroot/libfakechroot.so which is loaded
21 through the LD_PRELOAD mechanism of the dynamic loader. (See ld.so(8))
22
23 In fake chroot you can install Debian bootstrap with `debootstrap
24 --variant=fakechroot' command. In this environment you can use i.e.
25 apt-get(8) command to install another packages from common user's
26 account.
27
28 In the current version, the fakechroot does not provide the fakeroot(1)
29 functionality! You might to call fakechroot with fakeroot command, if
30 you want to emulate root environment, i.e.:
31
32 $ fakeroot fakechroot /usr/sbin/chroot /tmp/debian
33 # id
34 uid=0(root) gid=0(root) groups=0(root)
35
37 -l library⎪--lib library
38 Specify an alternative wrapper library.
39
40 -s⎪--use-system-libs
41 Use system libraries before chroot's libraries. This might be a
42 workaround if system dynamic linker (/lib/ld-linux.so.2 for Linux)
43 can not load libc.so from fake chroot.
44
45 Try this setting if you noticed following errors:
46
47 $ fakechroot /usr/sbin/chroot /tmp/sarge /bin/true
48 /bin/true: relocation error: /srv/sarge/lib/tls/libc.so.6: symbol _dl
49 _starting_up, version GLIBC_PRIVATE not defined in file ld-linux.so.2
50 with link time reference
51
52 $ fakechroot /usr/sbin/chroot /tmp/centos4 /bin/true
53 Segmentation fault
54
55 [--] command
56 Any command you want to be ran as fakechroot. Use '--' if in the
57 command you have other options that may confuse fakechroot's option
58 parsing.
59
60 -h Display help.
61
62 -v Display version.
63
65 Here is an example session with fakechroot. Notice that inside the fake
66 root environment file manipulation that requires root privileges suc‐
67 ceeds, but is not really happening.
68
69 $ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
70 :/bin:/usr/bin/X11
71 $ fakeroot -s fakechroot.save fakechroot debootstrap --variant=fakech
72 root sarge /tmp/sarge
73
74 $ fakeroot -i fakechroot.save fakechroot chroot /tmp/sarge /bin/bash
75 # cd /
76 # sh /usr/share/doc/fakechroot/examples/savemode.sh
77 # echo deb http://ftp.debian.org/debian sarge main contrib non-free >
78 /etc/apt/sources.list
79 # echo deb-src http://ftp.debian.org/debian sarge main contrib non-fr
80 ee >> /etc/apt/sources.list
81 # apt-get update
82 # apt-get install adduser whiptail build-essential devscripts
83 # adduser --uid 1001 dexter
84 # cd /tmp
85 # apt-get source hello
86 # cd hello-*
87 # debuild --preserve-env -b
88 # exit
89
91 fakechroot is a regular, non-setuid program. It does not enhance a
92 user's privileges, or decrease the system's security.
93
95 /usr/lib/fakechroot/libfakechroot.so
96 The shared library containing the wrapper functions.
97
99 FAKECHROOT
100 The value is true for fake chroot environment.
101
102 FAKECHROOT_VERSION
103 The version of current fakechroot library.
104
105 FAKECHROOT_BASE
106 The root directory for fake chroot environment.
107
108 LD_LIBRARY_PATH, LD_PRELOAD
109 Fakechroot is implemented by wrapping system calls. This is accom‐
110 plished by setting LD_LIBRARY_PATH=/usr/lib/fakechroot and
111 LD_PRELOAD=libfakechroot.so. That library is loaded before the sys‐
112 tem's C library, and so most of the library functions are inter‐
113 cepted by it. If you need to set either LD_LIBRARY_PATH or
114 LD_PRELOAD from within a fakechroot environment, it should be set
115 relative to the given paths, as in
116 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/foo/bar/
117
119 o /lib/ld-linux.so.2 is always loaded from real environment. This
120 path is hardcoded by linker for all binaries.
121
122 o Every command executed within fakechroot needs to be linked to the
123 same version of the C library as fakechroot itself. If the
124 libraries in chroot are not compatible, try to use --use-sys‐
125 tem-libs option.
126
127 o You can provide symlinks to the outside. The symlink have to be
128 created before chroot is called. It can be useful for accessing the
129 real /proc and /dev directory.
130
131 o Statically linked binaries doesn't work, especially ldconfig(8), so
132 you have to wrap this command with dummy version and i.e. set the
133 dpkg diversion, see: dpkg-divert(8).
134
135 o ldd(1) also doesn't work. You have to use wrapper. The example
136 wrapper is available at scripts/ directory in fakechroot's source
137 package and it is located at /usr/share/doc/fakechroot/examples
138 directory.
139
140 o The full screen applications hangs up if /dev/tty file is not a
141 real device. Link /dev/tty file or whole /dev directory to the real
142 one or remove it from fake chroot environment.
143
144 o lckpwdf() and ulckpwdf() are ignored so passwd(1) command should
145 work
146
147 o Your real uid should exist in /etc/passwd. Create it with adduser
148 --uid realuid realuser.
149
150 o debuild(1) cleans environment. Use --preserve-env option to prevent
151 this behaviour.
152
154 fakechroot is distributed under the GNU Lesser General Public License.
155 (LGPL 2.1 or greater).
156
158 (c) 2003-2005 Piotr Roszatycki <dexter@debian.org>
159
161 fakeroot(1), dpkg-buildpackage(1), debuild(1), debootstrap(8)
162
163
164
165Debian 24 Oct 2005 FAKECHROOT(1)