Hide Forgot
Description of problem: When running `atomic scan' in cron, command fails with "[Errno 2] No such file or directory" Version-Release number of selected component (if applicable): atomic-1.12.3-2.el7.x86_64 How reproducible: reliably Steps to Reproduce: 1. start docker 2. docker pull rhel7 (to have a target) 3. in root cron, add "* * * * * atomic --debug scan --images" 4. wait for 1+ minute 5. look into /var/spool/mail/root Actual results: command does not report scan results Expected results: command reports scan results Additional info: output of `atomic --debug scan --images': Created /run/atomic/2016-09-21-15-09-01-548951 docker run -t --rm -v /etc/localtime:/etc/localtime -v /run/atomic/2016-09-21-15-09-01-548951:/scanin -v /var/lib/atomic/openscap/2016-09-21-15-09-01-548951:/scanout:rw,Z -v /etc/oscapd:/etc/oscapd:ro rhel7/openscap oscapd-evaluate scan --no-standard-compliance --targets chroots-in-dir:///scanin --output /scanout Created /run/atomic/2016-09-21-15-09-01-548951/c54a2cc56cbb2f04003c1cd4507e118af7c0d340fe7e2720f70976c4b75237dc [Errno 2] No such file or directory Unmounted /run/atomic/2016-09-21-15-09-01-548951/c54a2cc56cbb2f04003c1cd4507e118af7c0d340fe7e2720f70976c4b75237dc Traceback (most recent call last): File "/usr/bin/atomic", line 186, in <module> sys.exit(_func()) File "/usr/lib/python2.7/site-packages/Atomic/scan.py", line 156, in scan self._mount_scan_rootfs(scan_list) File "/usr/lib/python2.7/site-packages/Atomic/scan.py", line 244, in _mount_scan_rootfs self.mount(mountpoint=mount_path, image=docker_object['Id']) File "/usr/lib/python2.7/site-packages/Atomic/scan.py", line 455, in mount m.mount() File "/usr/lib/python2.7/site-packages/Atomic/mount.py", line 141, in mount d.mount(self.image, self.options) File "/usr/lib/python2.7/site-packages/Atomic/mount.py", line 417, in mount driver_mount_fn(identifier, options) File "/usr/lib/python2.7/site-packages/Atomic/mount.py", line 503, in _mount_devicemapper dm_pool) File "/usr/lib/python2.7/site-packages/Atomic/mount.py", line 180, in _activate_thin_device r = util.subp(cmd) File "/usr/lib/python2.7/site-packages/Atomic/util.py", line 109, in subp universal_newlines=newline) File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__ errread, errwrite) File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory
As the issue was triggered by cron environment, simpler reproducer is: env -i 'USER=root PATH=/usr/bin:/bin PWD=/root LANG=en_US.UTF-8 SHLVL=1 HOME=/root LOGNAME=root XDG_RUNTIME_DIR=/run/user/0 _=/usr/bin/env ' atomic --debug scan --images Quick workaround is to set cron PATH to PATH=/usr/bin:/bin:/usr/sbin But even though user currently can guess there is a problem with PATH [as usual when dealing with cron], there is no indication which binary is actually not found. So from my perspective, it is sufficient to print clearly worded error, like "error: dmsetup binary not found" to consider this bug fixed.
We should fully path dmsetup then.
Fixed in atomic-1.12.5-2.el7.x86_64
To move the bug to VERIFIED status per Comment 8 and my actual testing in atomic-1.12.5-2.el7.x86_64
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2016-2857.html