Description of problem: Running a dnf install -y <package> produces an error when run from virt-builder: Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: gssproxy x86_64 0.4.1-3.fc23 updates 87 k keyutils x86_64 1.5.9-7.fc23 fedora 60 k libbasicobjects x86_64 0.1.1-27.fc23 fedora 29 k libcollection x86_64 0.7.0-27.fc23 fedora 45 k libevent x86_64 2.0.21-7.fc23 fedora 217 k libini_config x86_64 1.2.0-27.fc23 fedora 64 k libnfsidmap x86_64 0.26-3.1.fc23 fedora 51 k libpath_utils x86_64 0.2.1-27.fc23 fedora 31 k libref_array x86_64 0.1.5-27.fc23 fedora 30 k libtalloc x86_64 2.1.3-1.fc23 fedora 42 k libtevent x86_64 0.9.25-2.fc23 fedora 36 k libtirpc x86_64 0.3.2-3.0.fc23 fedora 100 k libverto-tevent x86_64 0.2.6-5.fc23 fedora 14 k nfs-utils x86_64 1:1.3.2-11.fc23 fedora 367 k quota x86_64 1:4.02-4.fc23 fedora 170 k quota-nls noarch 1:4.02-4.fc23 fedora 94 k rpcbind x86_64 0.2.3-0.2.fc23 fedora 63 k rsync x86_64 3.1.1-7.fc23 fedora 392 k screen x86_64 4.3.1-2.fc23 fedora 571 k tar x86_64 2:1.28-6.fc23 fedora 944 k tcp_wrappers x86_64 7.6-81.fc23 fedora 84 k Skipping packages with conflicts: (add '--best --allowerasing' to command line to force their upgrade): openssh x86_64 7.1p1-4.fc23 updates 443 k openssh-clients x86_64 7.1p1-4.fc23 updates 633 k openssh-server x86_64 7.1p1-4.fc23 updates 459 k Transaction Summary ================================================================================ Install 21 Packages Total download size: 3.4 M Installed size: 8.8 M Downloading Packages: -------------------------------------------------------------------------------- Total 527 kB/s | 3.4 MB 00:06 warning: /var/cache/dnf/fedora-fe3d2f0c91e9b65c/packages/rsync-3.1.1-7.fc23.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 34ec9cba: NOKEY The downloaded packages were saved in cache till the next successful transaction. You can remove cached packages by executing 'dnf clean packages'. Traceback (most recent call last): File "/bin/dnf", line 35, in <module> main.user_main(sys.argv[1:], exit_code=True) File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 198, in user_main errcode = main(args) File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 84, in main return _main(base, args) File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 144, in _main ret = resolving(cli, base) File "/usr/lib/python3.4/site-packages/dnf/cli/main.py", line 173, in resolving base.do_transaction(display=displays) File "/usr/lib/python3.4/site-packages/dnf/cli/cli.py", line 220, in do_transaction self.gpgsigcheck(downloadpkgs) File "/usr/lib/python3.4/site-packages/dnf/cli/cli.py", line 251, in gpgsigcheck if not sys.stdin.isatty() and not ay: AttributeError: 'NoneType' object has no attribute 'isatty' virt-builder: error: dnf -y install 'rsync' 'nfs-utils' 'sudo' 'openssh-server' 'openssh-clients' 'screen' 'tar': command exited with an error Version-Release number of selected component (if applicable): Fedora 23 How reproducible: 100% Should be fairly straightforward to understand the error from the python traceback. Someone oopsed :P
Created attachment 1092401 [details] full log from virt-builder on F21
Created attachment 1092402 [details] full log from virt-builder on F23
Full logs and easy reproducer attached.
*** Bug 1280034 has been marked as a duplicate of this bug. ***
Note that the affected dnf code is from 2011, so I suspect it's virt-builder or even python that changed something here (presumably it used to happen such that sys.stdin was set), not DNF. But the DNF code could reasonably handle the case where sys.stdin is None, yes.
https://github.com/rpm-software-management/dnf/pull/384
No dispute that it's a bug in virt-builder (bug 1280029). However it would be nice if dnf was a bit more robust. The patch you posted looks good to me.
dnf-1.1.4-2.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-93db5cd342
dnf-1.1.4-2.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-d060fec064
dnf-1.1.4-2.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with $ su -c 'dnf --enablerepo=updates-testing update dnf' You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-d060fec064
dnf-1.1.4-2.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with $ su -c 'dnf --enablerepo=updates-testing update dnf' You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-93db5cd342
dnf-1.1.4-2.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
dnf-1.1.4-2.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
A new virt-builder Fedora 23 image has been uploaded that includes dnf-1.1.4-2.fc23. https://github.com/libguestfs/libguestfs/commit/59ea51d358e4e4d8c8ef6535760fcfc9bfe0a3a3
The patch looks incorrect, or rather, insufficient. Normally all programs assume fds 0, 1 and 2 are open. Making the code more robust in case of weird circumstances is definitely a nice idea. However, just checking stdin in one place which may or may not need it does not look right. If stdin is missing, chances are stdout and stderr are missing too. Then, as you open/close file descriptors, you may end up with an important output file on fd 2 (stderr) and proceed to corrupt it because of some unrelated error. The patched function is not the only place using stdin right now (although the only using 'stdin' as the object), and the code is likely to get more in the future. As such, if such checks are considered valuable, they have to be done at the start program unconditionally. If exiting straight up seems too harsh, one can then try to remedy the situation by opening /dev/null for all missing fds. But if even that fails, it is too dangerous to continue due to aforementioned problems.
dnf-plugins-core-0.1.15-1.fc23 dnf-1.1.5-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-c72cd24fa0
dnf-plugins-core-0.1.15-1.fc22 dnf-1.1.5-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-1bb112ccc6
dnf-1.1.5-1.fc23, dnf-plugins-core-0.1.15-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with $ su -c 'dnf --enablerepo=updates-testing update dnf dnf-plugins-core' You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-c72cd24fa0
dnf-1.1.5-1.fc22, dnf-plugins-core-0.1.15-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-1bb112ccc6
dnf-1.1.5-1.fc23, dnf-plugins-core-0.1.15-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
dnf-1.1.5-1.fc22, dnf-plugins-core-0.1.15-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.