[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: building 2.6.35



On Tue, 10 Aug 2010 14:58:04 -0400 (EDT), Tom H wrote:
> 
> I have and I agree with you regarding what fakeroot does (based on the
> manpage that I've read in the past and read again after you posted
> part of it).
> 
> IIUC, instead of giving you additional powers, fakeroot gives your
> environment additional powers (otherwise, why would it be used?) and
> that's probably why the kernel-package documentation doesn't
> differentiate between fakeroot and sudo, refers to them both as
> "$Get_Root", and describes them as "whatever you need to become root
> -- fakeroot or sudo...)."

In order to build a binary Debian package, some functions are used
internally by make-kpkg (or lower level commands called by make-kpkg,
such as dpkg-buildpackage) that would normally require root privileges.
Examples are chmod(2), stat(2), etc.  Compiling the kernel source code
does not require root privileges, but building the .deb file normally
does.  There are several solutions to this problem, such as:

(1) login as root.
(2) login as a non-root user and issue su to get a nested shell
    session that has root privileges, assuming that you know the
    root password.
(3) preface the make-kpkg command with sudo, assuming that you have
    proper sudo permissions.
(4) use the --rootcmd option of make-kpkg, supplying sudo as its
    argument.  For example,

       make-kpkg --rootcmd sudo ...

    This way, make-kpkg executes as a non-root user most of the time
    and uses sudo to become root only when it needs to be.

(5) preface the make-kpkg command with fakeroot
(6) use the --rootcmd option of make-kpkg, supplying fakeroot as its
    argument.  For example,

       make-kpkg --rootcmd fakeroot ...

And there are probably other scenarios that I haven't thought of.

fakeroot, as its name implies, does not actually give you true root
privileges.  Rather, it supplies temporary replacements for the library
functions needed by dpkg-buildpackage that would ordinarily require
root privileges, such as chmod(2), stat(2), etc.  These replacement
functions simulate the effect the real library functions would have
had, had the user really been root.  It gives you "just enough"
apparent root authority to build a package (selected file manipulation
functions) and no more.

If you've looked at my kernel building web page,
http://www.wowway.com/~zlinuxman/Kernel.htm, you will see that I
don't cover this.  That's because I don't use it when I build my
own custom kernels.  I do use it when building a "regular"
Debian package, but for some reason I've never bothered with it for
creating my own custom kernels.  I just log in as root and forget
about it.  For some people, this seems to be a "religious" issue.
But I never bother with it.  I just login as root and forget about it.
So many of the steps require root authority (real root authority)
that it's simpler for me just to stay root the whole time.
If I ever get burned by it, I'll probably change my lazy ways.
But I've never had a problem with it.

To each his own.  Live and let live.  Etc.

-- 
  .''`.     Stephen Powell    
 : :'  :
 `. `'`
   `-


Reply to: