KBEA-00123 - How to work around "fakeroot" in non-daemon mode

Summary

Prior to ElectricAccelerator v6.2, when a job using "fakeroot" in the eMake build was distributed to an agent, it was very likely to hang the agent at some point. Starting with Accelerator v6.2, "fakeroot" is supported "out-of-the-box," and does not require using "runlocal".

Solution

fakeroot is a Linux filesystem virtualization utility used primarily to build disk images and archives when not actually running as root. fakeroot runs a command in an environment wherein it appears to have root privileges for file manipulation. This is useful for allowing users to create archives (tar, ar, .deb, and so on) with files in them with root permissions/ownership. Without fakeroot, one would need to have root privileges to create the constituent files of the archives with the correct permissions and ownership, and then pack them up, or one would have to construct the archives directly, without using the archiver. fakeroot is heavily used when manipulating kernel builds and creating RPM or deb packages.

fakeroot can run in single shell command interception mode or daemon mode. In the single shell command interception mode, the user normally uses the fakeroot command to wrap the shell command. for example:

>fakeroot (PRJROOT)/makeutils/build-image.sh

When this command is triggered, there will be a corresponding daemon session (faked) launched automatically to record the changed permission by fakeroot for later usage. The daemon session sometimes cannot complete itself when the foreground fakeroot finishes. If this runs on Accelerator agent side, this "run away" daemon process will hold the EFS from being umounted. It subsequently causes Accelerator hanging and showing red. The error message from the agent would be something like the following.

unable to unmount EFS at "/efsroots/2/vobs": EBUSY (error code 16)

When you use "lsof|grep efsroot" after the job with fakeroot completes, you will see "faked-sysv" or similar still alive under /efsroot/.

 faked-sys 14052   user1   cwd  DIR  0,46  4096  4634 /efsroots/2/vobs/foo/bar
 faked-sys 14052  user1  rtd  DIR  104,2  4096   2 /efsroots/2
 faked-sys 14052  user1  txt  REG   104,2  29102   16089481 /efsroots/2/usr/bin/faked-sysv 
 faked-sys 14052  user1  mem   REG  104,2  1413684  11378801 /efsroots/2/lib/libc-2.9.so
 faked-sys 14052  user1  mem  REG  104,2  14012  11378807 /efsroots/2/lib/libdl-2.9.so
 faked-sys 14052  user1  mem  REG  104,2  125676  11378794 /efsroots/2/lib/ld-2.9.so

To work around this, you must make sure that the fakeroot command runs from the eMake machine instead of the agent. Using the "runlocal" directive could help. Because this normally occurs during the image creation stage, running it from local eMake machine will not significantly impact speed-up.

Examples

The original makefile has the following target:

build-image:

      fakeroot $(PRJROOT)/makeutils/build-image.sh

For this to work with eMake, you must add "runlocal" to force "fakeroot" to run on the local eMake machine.

#pragma runlocal

build-image:

       fakeroot $(PRJROOT)/makeutils/build-image.sh

Applies to

Product versions: Prior to 6.2
OS versions: Linux
Have more questions? Submit a request

Comments

Powered by Zendesk