D
D
DVoropaev2018-11-22 08:01:52
linux
DVoropaev, 2018-11-22 08:01:52

Why is fakeroot needed when building a deb package?

Why is it written in the manuals like this:
fakeroot dpkg-deb --build ./path
but this also works:
dpkg-deb --build ./path
Why is fakeroot needed here? Changes permissions to "read-only"? And for what?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
J
jcmvbkbc, 2018-11-22
@jcmvbkbc

fakeroot makes it so that an application that is not rooted but expects to be rooted does not crash due to lack of permissions when performing some functions, but continues to run. Those. it "swallows" errors caused by lack of privileges.
For example, a normal user cannot do chowh root:rootfor a file he owns:

$ chown root:root test ; echo $?
chown: changing ownership of 'test': Operation not permitted
1

fakeroot gives the application the appearance that no error is occurring. The owner of the file, of course, does not change:
$ fakeroot chown root:root test ; echo $?
0
$ ls -la test
-rw-rw-r--. 1 jcmvbkbc jcmvbkbc 1709 Jun  1  2011 test

Everything.
This is necessary so that make installsimilar scripts that change the rights of the files they install in the system do not end after the first error when launched under an unprivileged user, but work through to the end. The correctness of the owners and permissions set on the files must be ensured by other means.
Why do the manuals write like this:
fakeroot dpkg-deb --build ./path
but it also works like this:
dpkg-deb --build ./path

Because commands that need privileges were not executed during the package build, or their execution errors were ignored.
Andrey Burov , pfg21 all sorts of "sandboxes", "does not let the outside world", "the script can scatter binaries around the system, the sandbox will not release it" in relation to fakeroot - this is a fantasy. Building packages can and should be done under a normal user. The default privilege system ensures that an application running under an unprivileged user does not break anything.

A
Andrey Burov, 2018-11-22
@BuriK666

in short and simple:
fakeroot does not let the collector into the outside world of the
sandbox

S
SOTVM, 2018-11-22
@sotvm

man fakeroot
- run a command in an environment faking root privileges for
file manipulation
dpkg-deb --build ./path
so it builds the package in your environment and there will be permission issues when installing/using

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question