Why do we need fakerootfakeroot command at all? Can't we simply use the sudo or su commands?
The man page says:
fakeroot - run a command in an environment faking root privileges for file manipulation
About.com says:
Gives a fake root environment. This package is intended to enable something like: dpkg-buildpackage -rfakeroot
dpkg-buildpackage -rfakerooti.e. to remove the need to become root for a package build. This is done by setting LD_PRELOADLD_PRELOADto libfakeroot.solibfakeroot.so, which provides wrappers around getuidgetuid, chownchown, chmodchmod, mknodmknod, statstat, ..., thereby creating a fake root environment. If you don't understand any of this, you do not need fakerootfakeroot!
My question is, what special purpose does it solve that a simple susu or sudosudo don't? For example, for repacking all installed packages in ubuntu we give following command:
$ fakeroot -u dpkg-repack `dpkg --get-selections | grep install | cut -f1`
Can we do the above command with sudo or su instead of fakeroot like this:
$ sudo dpkg-repack `dpkg --get-selections | grep install | cut -f1`
EDIT:
Running:
$ sudo dpkg-repack `dpkg --get-selections | grep install | cut -f1`
gives me this error:
control directory has bad permissions 700 (must be >=0755 and <=0775)
Any reason why?