Bug 5364 - Incorrect uid/gid if starting target via NFS
Summary: Incorrect uid/gid if starting target via NFS
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 1.5
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.5.1
Assignee: Chen Qi
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-10-18 06:12 UTC by Chen Qi
Modified: 2013-11-07 06:15 UTC (History)
7 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chen Qi 2013-10-18 06:12:32 UTC
Problem Description
--------------------
Under the following circumstances will the problem appear:
1. The same user name exists both on target and on the build host, but the uids/gids are different. For example, there's a user named postfix, its UID on host is 119 and on target is 1024.
2. The target is started with NFS. That means we're using runqemu-extract-sdk to extract the rootfs tarball.

If the above two conditions are satisfied, the uid/gid would be incorrect on target. In the above example, the uid for postfix on target (if started via NFS) will be 119 instead of 1024.


Root Cause
----------
The tar command will respect the username/groupname when extracting a tarball.
So when we're using runqemu-extract-sdk, the uid/gid will be changed to the host ones.


Solution
--------
1. Set a correct value for PSEUDO_PASSEWD environment variable and export it in the runqemu-extract-sdk script.
However, this solution is not possible as we can't guess the correct rootfs directory merely based on the image tarball name.

2. When creating the rootfs tarball, use --numeric-owner option to the tar command in image_types.bbclass. In this case, the username/groupname will not be recorded in the tarball. As our task is to build an image, we should have used this option. Because, in our image, we have our own passwd and group file.

//Chen Qi
Comment 1 Chen Qi 2013-11-07 06:15:54 UTC
Branch: master
Commit: acce6ff1a77cfd29e3868faa89b120becb58bbbf
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=acce6ff1a77cfd29e3868faa89b120becb58bbbf

//Chen Qi