Bug 5765

Summary: ROOT_HOME variable change not recognized
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Daniel Elstner <daniel.elstner>
Component: coreAssignee: Saul Wold <sgw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: jack, jessica.zhang, meta.mr.watcher, meta.watcher
Version: 1.5.1   
Target Milestone: 1.6   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Daniel Elstner 2014-01-29 12:17:11 UTC
When I changed ROOT_HOME in my custom distro conf file, I had to manually clean the sstate directories of base-files and base-passwd or the change would not appear in the generated RPM packages and the image rootfs.

Running the package task manually on those recipes did produce a package directory with correct content, but package_write_rpm again replaced it with the old incorrect content.  This had me stumped for a while, but cleaning the sstate fixed it.
Comment 1 Jack Mitchell 2014-02-20 11:42:35 UTC
I can confirm this is still an issue in the latest master.
Comment 2 Jack Mitchell 2014-02-20 11:50:10 UTC
This should also cause a re-build of the rootfs, which is doesn't trigger.
Comment 3 Saul Wold 2014-02-21 02:03:17 UTC
Can you provide a little more detail, like what version of Poky/OE-Core 
meta-data you are using, which bitbake?  I just tested this here with 
core-image-minimal built with no change and then set the ROOT_HOME, I also 
confirmed that the Signature stamps changed.  I looked at the generated rootfs 
and it has the root directory as /root not /home/root.

% cat 
tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/rootfs/etc/passwd 
root::0:0:root:/root:/bin/sh

There have been some critical changes recently, just want to make sure you are 
using the latest HEAD, as it may be fixed there.
Comment 4 Jack Mitchell 2014-02-21 10:05:53 UTC
oe-core: 9a98b8bfe13b94d89a9e39cca821f26fdeaeffc3
bitbake: 56321b18808f5ed932543d907b9ebcfbf4420233

The main offenders in my case were openshh still using /home/root and passwd still having /home/root. I'm sure there are others, but in order to get a truely clean build I had to wipre tmp/ and sstate/.

In order to get it to rebuild at all I had to force the clean of a few packages and then force a rebuild of the rootfs. It didn't pick up the change automatically.
Comment 5 Saul Wold 2014-02-21 20:00:30 UTC
Ok, I tried this again with openssh and it worked correctly for me.

Here is what I did: build core-image-minimal with IMAGE_FEATURES +- 
"ssh-server-openssh" to enable the openssh server.  I built that image and 
verified that the root's home directory is /home/root, then I set 
ROOT_HOME="/root" and rebuilt, I confirmed in the logs that both base-passwd 
and openssh rebuilt and the resulting rootfs contained a /root home directory 
that I could log into via the console and ssh remotely.

I am building with Poky master HEAD which has a few more patches, but I don't 
think any should affect this.

I also verified with bitbake-dumpsig the signatures were different before and 
after the ROOT_HOME change

I guess I still need more details about what's failing and how, since I can't 
reproduce it (yet).
Comment 6 Saul Wold 2014-02-26 07:22:23 UTC
I think I have tracked this down a little better, turns out that we are sed'ing 
the patch file and once it's changed, the next time we run do_install the 
change is maintained due to the orignal sed is not matched (since we changed it 
from /root -> /home/root) the next sed just changes /home/root -> /home/root 
(matching on the /root part).  So no change.

I found this is a problem in both base-files and base-passwd, but also found 
the systemd has a similar issue when it sed's the units directory.  For the 
base-* files, I am changing to sed after installing the file, so the installed 
file always starts out as the original.  The units directory issue is a little 
harder.
Comment 7 Jack Mitchell 2014-02-26 10:03:34 UTC
Ah hah, good shout. I don't use the systemd build so hadn't noticed any issues with that.

I found that the OpenSSH problem was seemingly one of my own making so I would cross that off from the list for the time being.

I'm glad you've found the issue, I was starting to doubt what I'd seen!