FooBarWidget / debian-packaging-for-the-modern-developer

Debian packaging tutorials for the modern developer
439 stars 71 forks source link

Debian packages no longer require root with Debian buster or later #7

Open nthykier opened 4 years ago

nthykier commented 4 years ago

Hi,

Regarding "Debian packages are supposed to be built as root, for reasons that I also do not totally comprehend." in https://raw.githubusercontent.com/phusion/debian-packaging-for-the-modern-developer/master/tutorial-5/README.md. In Debian 10 (buster), it is possible to "opt-out" from the requirement for (fake)root has been removed.

This is done by setting Rules-Requires-Root: no in debian/control in the source paragraph along with removing any behaviours that require fakeroot or real root.

As for the rationale: Part of the reason for using root when building debs have been to ensure the "owner" and "group" of the files in the deb are recorded as root:root. This was often done with calls to "install -o root -g root ..." which attempted to chown the files to root. The use of (fake)root is still necessary for a few packages in the Debian archive that reason use "static ownership" recorded directly in the deb (as opposed dynamically creating the user at install time and using the postinst script to reassign ownership of the files/directories).