Bug 1195749 - mock exits with traceback if there is no /etc/resolv.conf
Summary: mock exits with traceback if there is no /etc/resolv.conf
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-24 13:45 UTC by Tomáš Hozza
Modified: 2015-06-20 21:13 UTC (History)
6 users (show)

Fixed In Version: mock-1.2.10-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-05-01 16:51:30 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hozza 2015-02-24 13:45:54 UTC
Description of problem:
Due to some previous operations my system ended up without /etc/resolv.conf. Running mock on such system ends with traceback. This is unexpected, since the rest of the system and apps work just fine!

Version-Release number of selected component (if applicable):
mock-1.2.7-1.fc21.noarch

How reproducible:
always

Steps to Reproduce:
1. start mock on system without /etc/resolv.conf

Actual results:
$ fedpkg mockbuild --root fedora-rawhide-x86_64-bind-9.10


Wrote: /home/thozza/devel/fedora/dhcp/dhcp-4.3.2-0.5b1.fc23.2.src.rpm
INFO: mock.py version 1.2.7 starting (python version = 2.7.8)...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
INFO: Start(/home/thozza/devel/fedora/dhcp/dhcp-4.3.2-0.5b1.fc23.2.src.rpm)  Config(fedora-rawhide-x86_64)
Start: clean chroot
Finish: clean chroot
Start: chroot init
INFO: calling preinit hooks
INFO: enabled root cache
INFO: root cache aged out! cache will be rebuilt
INFO: enabled yum cache
Start: cleaning yum metadata
Finish: cleaning yum metadata
INFO: enabled ccache
Mock Version: 1.2.7
INFO: Mock Version: 1.2.7
ERROR: Exception(/home/thozza/devel/fedora/dhcp/dhcp-4.3.2-0.5b1.fc23.2.src.rpm) Config(fedora-rawhide-x86_64) 0 minutes 5 seconds
INFO: Results and/or logs in: /home/thozza/devel/fedora/dhcp/results_dhcp/4.3.2/0.5b1.fc23.2
INFO: Cleaning up build root ('cleanup_on_failure=True')
Start: clean chroot
Finish: clean chroot
ERROR: [Errno 2] No such file or directory: '/etc/resolv.conf'
Traceback (most recent call last):
  File "/usr/sbin/mock", line 829, in <module>
    main()
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/sbin/mock", line 650, in main
    run_command(options, args, config_opts, commands, buildroot, state)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/sbin/mock", line 725, in run_command
    do_rebuild(config_opts, commands, buildroot, args)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/sbin/mock", line 496, in do_rebuild
    post=post_build, clean=clean)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/sbin/mock", line 440, in rebuild_generic
    commands.init(prebuild=not config_opts.get('short_circuit'))
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/backend.py", line 122, in init
    self.buildroot.initialize(**kwargs)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/buildroot.py", line 80, in initialize
    self._init(prebuild=prebuild, do_log=do_log)
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/buildroot.py", line 135, in _init
    self._setup_resolver_config()
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/buildroot.py", line 180, in _setup_resolver_config
    self._copy_config('resolv.conf')
  File "/usr/lib/python2.7/site-packages/mockbuild/trace_decorator.py", line 84, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.7/site-packages/mockbuild/buildroot.py", line 175, in _copy_config
    shutil.copy2(os.path.join('/etc', filename), etcdir)
  File "/usr/lib64/python2.7/shutil.py", line 130, in copy2
    copyfile(src, dst)
  File "/usr/lib64/python2.7/shutil.py", line 82, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: '/etc/resolv.conf'
Could not run mockbuild: Command '['mock', '-r', 'fedora-rawhide-x86_64-bind-9.10', '--resultdir', '/home/thozza/devel/fedora/dhcp/results_dhcp/4.3.2/0.5b1.fc23.2', '--rebuild', '/home/thozza/devel/fedora/dhcp/dhcp-4.3.2-0.5b1.fc23.2.src.rpm']' returned non-zero exit status 1

Expected results:
No traceback and mock working as normally.

Additional info:
The rest of the system is able to deal with the non-existence of /etc/resolv.conf. Even firefox is able to resolve names, since there is still DNS resolver running on 127.0.0.1

Comment 1 Miroslav Suchý 2015-02-28 18:40:59 UTC
Fixed in:
* 62a4ca4 missing config file should not be fatal [RHBZ#1195749]

Comment 2 Fedora Update System 2015-04-29 13:17:08 UTC
mock-1.2.8-1.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/mock-1.2.8-1.fc22

Comment 3 Fedora Update System 2015-04-29 13:17:31 UTC
mock-1.2.8-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mock-1.2.8-1.fc21

Comment 4 Fedora Update System 2015-04-29 13:18:05 UTC
mock-1.2.8-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/mock-1.2.8-1.fc20

Comment 5 Fedora Update System 2015-04-29 13:19:38 UTC
mock-1.2.8-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.8-1.el7

Comment 6 Fedora Update System 2015-04-29 13:25:39 UTC
mock-1.2.8-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.2.8-1.el6

Comment 7 Fedora Update System 2015-04-29 19:19:22 UTC
Package mock-1.2.8-1.el7:
* should fix your issue,
* was pushed to the Fedora EPEL 7 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing mock-1.2.8-1.el7'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2015-6057/mock-1.2.8-1.el7
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2015-05-01 16:51:30 UTC
mock-1.2.8-1.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2015-05-02 18:09:09 UTC
mock-1.2.8-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2015-05-12 20:46:36 UTC
mock-1.2.8-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2015-06-04 11:42:02 UTC
mock-1.2.10-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.10-1.el7

Comment 12 Fedora Update System 2015-06-04 11:42:51 UTC
mock-1.2.10-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.2.10-1.el6

Comment 13 Fedora Update System 2015-06-20 21:10:28 UTC
mock-1.2.10-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2015-06-20 21:13:23 UTC
mock-1.2.10-1.el7 has been pushed to the Fedora EPEL 7 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.