Bug 6484

Summary: No permission to execute for Python and G++
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Mihail Stanciu <stanciux.mihail>
Component: coreAssignee: Ross Burton <ross.burton>
Status: CLOSED FIXED QA Contact: Mihail Stanciu <stanciux.mihail>
Severity: major    
Priority: Medium+ CC: alexandru.c.georgescu, dvhart, elizabeth.flanagan, mark.hatle, meta.mr.watcher, meta.watcher, net147, nitin.a.kamble, richard.purdie, ross.burton, seebs, sgw, yp.kernel.watcher, yp.watcher
Version: 1.7   
Target Milestone: 1.7   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: Regression (Used to work)
Verified: Documentation change: Don't know
Attachments:
Description Flags
pseudo.log none

Description Mihail Stanciu 2014-06-26 15:07:50 UTC
meta-intel
poky
BSP: nuc
AB link: http://yocto-ab-master.jf.intel.com/pub/nightly-meta-intel/20140623-1/machines/nuc/nuc/core-image-sato-sdk-nuc.hddimg


Description: 
After boot when issuing python or g++ commands I received permission denied error as follows:
root@nuc:~# g++
-sh: /usr/bin/g++: Permission denied
root@nuc:~# python
-sh: /usr/bin/python: Permission denied

Investigation into /usr/bin found:
root@nuc:/usr/bin# ls -l python*
lrwxrwxrwx 1 root root    7 Jun 26 12:17 python -> python2
lrwxrwxrwx 1 root root   14 Jun 26 12:17 python-config -> python2-config
lrwxrwxrwx 1 root root    9 Jun 26 12:17 python2 -> python2.7
lrwxrwxrwx 1 root root   16 Jun 26 12:17 python2-config -> python2.7-config
-rw-r--r-- 1 root root 5064 Jun 21 15:35 python2.7
-rwxr-xr-x 1 root root 1618 Jun 21 15:33 python2.7-config

root@nuc:/usr/bin# ls -l *g++*
lrwxrwxrwx 1 root root     21 Jun 26 12:17 g++ -> x86_64-poky-linux-g++
-rw-r--r-- 1 root root 751728 Jun 21 16:14 x86_64-poky-linux-g++

Steps to reproduce:
Install image from above link.
Once systems boots, issue python or g++ command.

Expected results:
python2.7 and x86_64-poky-linux-g++ files should have execution rights enabled
Comment 1 Mihail Stanciu 2014-06-26 15:26:41 UTC
Target link is sato-sdk.

Will test tomorrow for other BSPs.
Comment 2 Mihail Stanciu 2014-06-27 14:49:12 UTC
Did not find bug on other BSPs. Seems only NUC is affected.
Comment 3 Mihail Stanciu 2014-06-30 08:14:27 UTC
Bug not found on qemu.
Comment 4 Darren Hart 2014-06-30 16:49:16 UTC
Nitin, can you see if you can reproduce this behavior? I suspect this is NOT a BSP issue, but since it didn't reproduce on qemu for Mihail, we should at least try to reproduce before handing off to the core team.
Comment 5 Nitin Kamble 2014-06-30 17:28:48 UTC
ok, now qemu data is out. I am planning to reproduce this myself, and see what is going on.

Thanks,
Nitin
Comment 6 Nitin Kamble 2014-06-30 21:44:15 UTC
I rebuilt the nuc sato sdk image with exact same commits here. And there are no file system permission issues as mentioned in this bug. I could not reproduce the issue. While I tried downloading the nuc core sdk image from the AB, and it does have the permission issues.
  So this points the issue back to the AB environment.
Comment 7 Nitin Kamble 2014-06-30 21:56:52 UTC
The permissions inside the rootfs dir of the core sdk image recipe are good. Means something went wrong in packaging.


/home/pokybuild/yocto-autobuilder/yocto-slave/nuc/build/build/tmp/work/nuc-poky-linux/core-image-sato-sdk/1.0-r0/rootfs/usr/bin> ls -l *g++*
lrwxrwxrwx 1 pokybuild users     21 Jun 25 05:15 g++ -> x86_64-poky-linux-g++
-rwxr-xr-x 1 pokybuild users 809168 Jun 25 04:23 x86_64-poky-linux-g++

/home/pokybuild/yocto-autobuilder/yocto-slave/nuc/build/build/tmp/work/nuc-poky-linux/core-image-sato-sdk/1.0-r0/rootfs/usr/bin> ls -l *python*
lrwxrwxrwx 1 pokybuild users    7 Jun 25 05:15 python -> python2
lrwxrwxrwx 1 pokybuild users    9 Jun 25 05:15 python2 -> python2.7
-rwxr-xr-x 1 pokybuild users 5048 Jun 25 04:06 python2.7
-rwxr-xr-x 1 pokybuild users 1618 Jun 25 04:05 python2.7-config
lrwxrwxrwx 1 pokybuild users   16 Jun 25 05:15 python2-config -> python2.7-config
lrwxrwxrwx 1 pokybuild users   14 Jun 25 05:15 python-config -> python2-config
Comment 8 Nitin Kamble 2014-06-30 22:06:19 UTC
inside the rootfs.img file g++ has right permissions, while python script is not executable.

So the python2.7 script's permissions got messed up in the rootfs.img creation process. And the x86_64-poky-linux-g++ script's permissions got messed up afterwords.


nitin@yocto-hm1:/tmp> sudo mount rootfs.img  mnt
nitin@yocto-hm1:/tmp> cd mnt/usr/bin/

nitin@yocto-hm1:/tmp/mnt/usr/bin> ls -l *g++*
lrwxrwxrwx 1 root root     21 Jun 25 05:15 g++ -> x86_64-poky-linux-g++*
-rwxr-xr-x 1 root root 809168 Jun 25 04:23 x86_64-poky-linux-g++*

nitin@yocto-hm1:/tmp/mnt/usr/bin> ls *python* -l
lrwxrwxrwx 1 1006 users    7 Jun 25 05:15 python -> python2
lrwxrwxrwx 1 root root     9 Jun 25 05:15 python2 -> python2.7
-rw-r--r-- 1 root users 5048 Jun 25 04:06 python2.7
-rwxr-xr-x 1 root root  1618 Jun 25 04:05 python2.7-config*
lrwxrwxrwx 1 root root    16 Jun 25 05:15 python2-config -> python2.7-config*
lrwxrwxrwx 1 root root    14 Jun 25 05:15 python-config -> python2-config*
Comment 9 Nitin Kamble 2014-06-30 22:25:37 UTC
This is not a meta-intel layer related issue, and looks like issue is in packaging of rootfs or post-install of python & gcc packages on the autobuilder environment, assigning the bug owner as Saul, to delegate or look further.
Comment 10 Nitin Kamble 2014-06-30 22:27:53 UTC
Adding Mark Hatle to the CC list.
Comment 11 Alexandru Georgescu 2014-07-02 14:19:31 UTC
not sure, but might be related to bug 6500
Comment 12 Mark Hatle 2014-08-08 15:10:20 UTC
I believe this issue occurred during a very small window when pseudo was being updated. 

There was a random permissions issue that was created for about day or so.. I suspect this is the problem.

I'm going to close this and if it reoccurs we should open it again.
Comment 13 Alexandru Georgescu 2014-08-11 08:17:23 UTC
Mihai will verify.
Also, Mihai please see if a TC is needed for this types of behavior and if so, add it to our runtime testing.

Thanks!
Comment 14 Mihail Stanciu 2014-08-11 09:23:00 UTC
Verified on master: 2d1660112e54653f7bb763939d0416472c49fe01
TC isn't needed. If this problem reappears our existing TCs will pick it up.
Comment 15 Ross Burton 2014-09-16 15:29:19 UTC
I just managed to replicate this on the autobuilder:

https://autobuilder.yoctoproject.org/main/builders/nightly-qa-systemd/builds/41/steps/Running%20Sanity%20Tests_1/logs/stdio

As previously, the rootfs directory in tmp/work has the right permissions, but the image doesn't.
Comment 16 Ross Burton 2014-09-16 16:20:34 UTC
So I downloaded the file system and looked at it:

$ ls *python* -l
lrwxrwxrwx 1 root root    7 Sep 16 01:27 python -> python2
lrwxrwxrwx 1 root root    9 Sep 16 01:27 python2 -> python2.7
-rwxr-xr-x 1 root root 5064 Sep 15 23:31 python2.7
-rwxr-xr-x 1 root root 1618 Sep 15 23:30 python2.7-config
lrwxrwxrwx 1 root root   16 Sep 16 01:27 python2-config -> python2.7-config
lrwxrwxrwx 1 root root   14 Sep 16 01:27 python-config -> python2-config

Not funny.
Comment 17 Mihail Stanciu 2014-09-26 12:41:04 UTC
Issue has not reappeared in any of the images we test normally.
This seems to point to something going wrong during AB operations, as Nitin suggested.

Ross,

Is there anything the QA team can do to help you?
Comment 18 Ross Burton 2014-09-26 19:50:06 UTC
Lets close it again as worksforme until some can replicate again, ideally outside the autobuilder.
Comment 19 Mihail Stanciu 2014-09-29 13:13:34 UTC
Verified. See previous comment.
Comment 20 Mihail Stanciu 2014-09-29 13:13:57 UTC
Closing.
Comment 21 Ross Burton 2014-10-01 10:41:50 UTC
Happened again https://autobuilder.yoctoproject.org/main/builders/nightly-ipk/builds/52/steps/Running%20Sanity%20Tests_2/logs/stdio.

The permissions are corrupt in the work/rootfs directory:

[ross@centos7 bin]$ ls -l pytho*
lrwxrwxrwx. 1 pokybuild users     7 Oct  1 00:20 python -> python2
lrwxrwxrwx. 1 pokybuild users     9 Oct  1 00:20 python2 -> python2.7
-rw-r--r--. 1 pokybuild users 11215 Sep 30 22:39 python2.7
-rw-r--r--. 1 pokybuild users  1618 Sep 30 22:39 python2.7-config
lrwxrwxrwx. 1 pokybuild users    16 Oct  1 00:20 python2-config -> python2.7-config
lrwxrwxrwx. 1 pokybuild users    14 Oct  1 00:20 python-config -> python2-config
Comment 22 Ross Burton 2014-10-01 10:54:43 UTC
[ross@centos7 package]$ ls -l usr/bin/
total 48
-rw-r--r--. 2 pokybuild users    96 Apr  9  2012 2to3
-rw-r--r--. 2 pokybuild users    95 Apr  9  2012 idle
-rw-r--r--. 2 pokybuild users    79 Apr  9  2012 pydoc
lrwxrwxrwx. 1 pokybuild users     7 Sep 30 22:39 python -> python2
lrwxrwxrwx. 1 pokybuild users     9 Sep 30 22:39 python2 -> python2.7
-rw-r--r--. 2 pokybuild users 11215 Sep 30 22:39 python2.7
-rw-r--r--. 2 pokybuild users  1618 Sep 30 22:39 python2.7-config
lrwxrwxrwx. 1 pokybuild users    16 Sep 30 22:39 python2-config -> python2.7-config
lrwxrwxrwx. 1 pokybuild users    14 Sep 30 22:39 python-config -> python2-config
-rw-r--r--. 2 pokybuild users 18543 Apr  9  2012 smtpd.py


[ross@centos7 image]$ ls -l usr/bin/
total 48
-rwxr-xr-x. 1 pokybuild users    96 Apr  9  2012 2to3
-rwxr-xr-x. 1 pokybuild users    95 Apr  9  2012 idle
-rwxr-xr-x. 1 pokybuild users    79 Apr  9  2012 pydoc
lrwxrwxrwx. 1 pokybuild users     7 Sep 30 22:39 python -> python2
lrwxrwxrwx. 1 pokybuild users     9 Sep 30 22:39 python2 -> python2.7
-rwxr-xr-x. 1 pokybuild users 11215 Sep 30 22:39 python2.7
-rwxr-xr-x. 1 pokybuild users  1618 Sep 30 22:39 python2.7-config
lrwxrwxrwx. 1 pokybuild users    16 Sep 30 22:39 python2-config -> python2.7-config
lrwxrwxrwx. 1 pokybuild users    14 Sep 30 22:39 python-config -> python2-config
-rwxr-xr-x. 1 pokybuild users 18543 Apr  9  2012 smtpd.py
Comment 23 Mark Hatle 2014-10-01 14:50:28 UTC
is this build still available?

Can you get me the full contents of the affected directories?

I'm looking specifically at the run scripts, pseudo database and pseudo logs for failure conditions.

The perms on the actual filesystem may be different (but usually '+x' is preserved there.)  But it's really the permissions on the pseudo side (captured in the db) that are interesting.
Comment 24 Ross Burton 2014-10-01 19:43:09 UTC
The build directory is still in place if you have ssh access to that builder.  If not, I've archived the python build directory already, where is the pseudo db kept?
Comment 25 Mark Hatle 2014-10-01 20:04:21 UTC
Pseudo DB is located in the tmp/work/.../${pn}/${pv}/pseudo

So if you have two whole work directory, we should have everything we need to investigate.

The ../pseudo/*.log files would be the first place to investigate and see if there is an entry for the files with the wrong information.
Comment 26 Ross Burton 2014-10-01 20:21:40 UTC
Is this useful:

sqlite> select path, mode from files where path like "%usr/bin/python2.7";
.../work/i586-poky-linux/python/2.7.3-r0.3/image/usr/bin/python2.7|33261

.../work/i586-poky-linux/python/2.7.3-r0.3/packages-split/python-core/usr/bin/python2.7|33188
Comment 27 Seebs 2014-10-01 21:13:49 UTC
That's interesting. The one in image/ is 755, the one in packages-split is 644.

I am not entirely sure what permissions I expect to really have on the filesystem, but I think normally I'd expect to get reasonable permissions for things; pseudo masks out write bits in some cases, but I don't think it's masking out execute bits, in general.

It seems very odd that this is only sometimes happening.

Is there a "pseudo.log" file in the build directory? If so, any contents?
Comment 28 Ross Burton 2014-10-01 21:19:47 UTC
Created attachment 2157 [details]
pseudo.log

pseudo.log attached.
Comment 29 Seebs 2014-10-02 22:31:44 UTC
Oh-hoh.

creat for '/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-ipk/build/build/tmp/work/i586-poky-linux/python/2.7.3-r0.3/package/usr/lib/python2.7/encodings/hz.pyc' replaces existing 4869771627 ['/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-ipk/build/build/tmp/work/i586-poky-linux/python/2.7.3-r0.3/package/usr/bin/pydoc'].

I can tell you what this means, and the fact that it is happening tells us roughly what's going wrong.

What it means is, at some point in the past, pseudo became aware of inode 4869771627, which was usr/bin/pydoc. Then a request came in for encodings/hz.pyc, using the same inode number. But pseudo never saw the old file removed, so it reports a mismatch.

What usually causes this:
* Files being removed by a process which isn't running under pseudo.
* Files being removed or recreated by some unrelated thing, like if objcopy were running outside of pseudo, that could result in replacing a file with another file with a new inode number.

So the question, basically, is what happened to package/usr/bin/pydoc between when it was created and when this message showed up.
Comment 30 Ross Burton 2014-10-03 16:27:46 UTC
Suspected cause is 64-bit inodes going into a 32-bit data type in sqlite.  pseudo has been fixed in git.
Comment 31 Ross Burton 2014-10-06 13:45:49 UTC
pseudo 1.6.2 is in master-next.
Comment 32 Ross Burton 2014-10-15 22:08:40 UTC
And was merged in b2c6a032d6e5deb07e76ed75fcd0931fad6a748c.
Comment 33 Mihail Stanciu 2014-10-17 12:59:38 UTC
Marking as closed, as there is no reliable way to verify. Will revisit if problem resurfaces.