Skip to main content

What is the need for 'fakeroot'`fakeroot` command in linux.

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 -rfakerootdpkg-buildpackage -rfakeroot i.e. to remove the need to become root for a package build. This is done by setting LD_PRELOADLD_PRELOAD to 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?

What is the need for 'fakeroot' command in linux.

Why do we need fakeroot 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 i.e. to remove the need to become root for a package build. This is done by setting LD_PRELOAD to libfakeroot.so, which provides wrappers around getuid, chown, chmod, mknod, stat, ..., thereby creating a fake root environment. If you don't understand any of this, you do not need fakeroot!

My question is, what special purpose does it solve that a simple su or sudo 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?

What is the need for `fakeroot` command in linux

Why do we need fakeroot 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 i.e. to remove the need to become root for a package build. This is done by setting LD_PRELOAD to libfakeroot.so, which provides wrappers around getuid, chown, chmod, mknod, stat, ..., thereby creating a fake root environment. If you don't understand any of this, you do not need fakeroot!

My question is, what special purpose does it solve that a simple su or sudo 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?

deleted 49 characters in body; edited tags
Source Link
Michael Mrozek
  • 95.7k
  • 40
  • 245
  • 236

whyWhy do we need fakeroot command at all, can't? Can't we simply use sudothe sudo or su command. I tries to google on it but got no satisfying explanation.su commands?

The man page says  :

"fakeroot - run a command in an environment faking root privileges for file manipulation"

fakeroot - run a command in an environment faking root privileges for file manipulation

aboutAbout.com says:

"Gives a fake root environment. This package is intended to enable something like: dpkg-buildpackage -rfakeroot i.e. to remove the need to become root for a package build. This is done by setting LD_PRELOAD to libfakeroot.so, which provides wrappers around getuid, chown, chmod, mknod, stat, ..., thereby creating a fake root environment. If you don't understand any of this, you do not need fakeroot! " --funny.

Gives a fake root environment. This package is intended to enable something like: dpkg-buildpackage -rfakeroot i.e. to remove the need to become root for a package build. This is done by setting LD_PRELOAD to libfakeroot.so, which provides wrappers around getuid, chown, chmod, mknod, stat, ..., thereby creating a fake root environment. If you don't understand any of this, you do not need fakeroot!

My question is, what special purpose does it solves other thensolve that a simple su or sudo command.

fordon'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

$ fakeroot -u dpkg-repack `dpkg --get-selections | grep install | cut -f1`

canCan we do the above command with sudo or su instead of fakeroot like this:

$ sudo dpkg-repack dpkg --get-selections | grep install | cut -f1

$ sudo dpkg-repack `dpkg --get-selections | grep install | cut -f1`

EDIT:

running Running:

$ sudo dpkg-repack dpkg --get-selections | grep install | cut -f1

$ 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 reasonsreason why??

why do we need fakeroot command at all, can't we simply use sudo or su command. I tries to google on it but got no satisfying explanation.

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 i.e. to remove the need to become root for a package build. This is done by setting LD_PRELOAD to libfakeroot.so, which provides wrappers around getuid, chown, chmod, mknod, stat, ..., thereby creating a fake root environment. If you don't understand any of this, you do not need fakeroot! " --funny.

My question is what special purpose does it solves other then simple su or sudo command.

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 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 reasons why??

Why do we need fakeroot 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 i.e. to remove the need to become root for a package build. This is done by setting LD_PRELOAD to libfakeroot.so, which provides wrappers around getuid, chown, chmod, mknod, stat, ..., thereby creating a fake root environment. If you don't understand any of this, you do not need fakeroot!

My question is, what special purpose does it solve that a simple su or sudo 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?

Post Migrated Here from stackoverflow.com (revisions)
Source Link
gkt
  • 1.7k
  • 2
  • 12
  • 7

What is the need for 'fakeroot' command in linux.

why do we need fakeroot command at all, can't we simply use sudo or su command. I tries to google on it but got no satisfying explanation.

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 i.e. to remove the need to become root for a package build. This is done by setting LD_PRELOAD to libfakeroot.so, which provides wrappers around getuid, chown, chmod, mknod, stat, ..., thereby creating a fake root environment. If you don't understand any of this, you do not need fakeroot! " --funny.

My question is what special purpose does it solves other then simple su or sudo command.

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 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 reasons why??