Curtin fails to deploy when /etc/resolv.conf is missing

Bug #1834382 reported by Lee Trager
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
curtin
Fix Released
Medium
Ryan Harper

Bug Description

I'm trying to deploy an image[1] which does not contain /etc/resolv.conf. Curtin fails when it tries to make a copy of /etc/resolv.conf since the file is missing. Adding a blank /etc/resolv.conf fixes the issue although the image still fails to deploy due to other reasons.

inish: cmd-install/stage-curthooks/builtin/cmd-curthooks/installing-missing-packages: FAIL: installing missing packages
finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: curtin command curthooks
Traceback (most recent call last):
  File "/curtin/curtin/commands/main.py", line 201, in main
    ret = args.func(args)
  File "/curtin/curtin/commands/curthooks.py", line 1290, in curthooks
    builtin_curthooks(cfg, target, state)
  File "/curtin/curtin/commands/curthooks.py", line 1139, in builtin_curthooks
    install_missing_packages(cfg, target, osfamily=osfamily)
  File "/curtin/curtin/commands/curthooks.py", line 705, in install_missing_packages
    installed_packages = distro.get_installed_packages(target)
  File "/curtin/curtin/distro.py", line 406, in get_installed_packages
    with ChrootableTarget(target) as in_chroot:
  File "/curtin/curtin/util.py", line 656, in __enter__
    os.rename(rconf, tmp)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmple0wlo3_/target/etc/resolv.conf' -> '/tmp/tmple0wlo3_/target/etc/tmpz3lnm5v5/resolv.conf'
[Errno 2] No such file or directory: '/tmp/tmple0wlo3_/target/etc/resolv.conf' -> '/tmp/tmple0wlo3_/target/etc/tmpz3lnm5v5/resolv.conf'
curtin: Installation failed with exception: Unexpected error while running command.
Command: ['curtin', 'curthooks']
Exit code: 3
Reason: -
Stdout: start: cmd-install/stage-curthooks/builtin/cmd-curthooks: curtin command curthooks
        Running curtin builtin curthooks
        Configuring target system for distro: opensuse osfamily: suse
        start: cmd-install/stage-curthooks/builtin/cmd-curthooks/installing-missing-packages: installing missing packages
        Running command ['mount', '--bind', '/dev', '/tmp/tmple0wlo3_/target/dev'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/proc', '/tmp/tmple0wlo3_/target/proc'] with allowed return codes [0] (capture=False)
        Running command ['mount', '--bind', '/sys', '/tmp/tmple0wlo3_/target/sys'] with allowed return codes [0] (capture=False)
        finish: cmd-install/stage-curthooks/builtin/cmd-curthooks/installing-missing-packages: FAIL: installing missing packages
        finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: curtin command curthooks
        Traceback (most recent call last):
          File "/curtin/curtin/commands/main.py", line 201, in main
            ret = args.func(args)
          File "/curtin/curtin/commands/curthooks.py", line 1290, in curthooks
            builtin_curthooks(cfg, target, state)
          File "/curtin/curtin/commands/curthooks.py", line 1139, in builtin_curthooks
            install_missing_packages(cfg, target, osfamily=osfamily)
          File "/curtin/curtin/commands/curthooks.py", line 705, in install_missing_packages
            installed_packages = distro.get_installed_packages(target)
          File "/curtin/curtin/distro.py", line 406, in get_installed_packages
            with ChrootableTarget(target) as in_chroot:
          File "/curtin/curtin/util.py", line 656, in __enter__
            os.rename(rconf, tmp)
        FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmple0wlo3_/target/etc/resolv.conf' -> '/tmp/tmple0wlo3_/target/etc/tmpz3lnm5v5/resolv.conf'
        [Errno 2] No such file or directory: '/tmp/tmple0wlo3_/target/etc/resolv.conf' -> '/tmp/tmple0wlo3_/target/etc/tmpz3lnm5v5/resolv.conf'

[1] http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.3/images/openSUSE-Leap-42.3-OpenStack-rootfs.x86_64-0.0.1-Build8.268.tbz

Related branches

Revision history for this message
Lee Trager (ltrager) wrote :
Revision history for this message
Ryan Harper (raharper) wrote :

Yes, curtin ChrootableTarget and skip the rename if the target resolv.conf isn;'t present.

Are you going to file a separate bug for the failure after providing a resolv.conf in the image?

Changed in curtin:
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
Lee Trager (ltrager) wrote :

What Curtin is doing is catching the exception being thrown that the rename fails, does some clean up, and then raises the exception again. Because of this Curtin stops and fails the deployment if $TARGET/etc/resolv.conf is missing. If $TARGET/etc/resolv.conf is missing Curtin should ignore it.

[1] https://git.launchpad.net/curtin/tree/curtin/util.py#n654

Changed in curtin:
status: Incomplete → New
Dan Watkins (oddbloke)
Changed in curtin:
status: New → In Progress
assignee: nobody → Ryan Harper (raharper)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

This bug is fixed with commit 9bc91364 to curtin on branch master.
To view that commit see the following URL:
https://git.launchpad.net/curtin/commit/?id=9bc91364

Changed in curtin:
status: In Progress → Fix Committed
Revision history for this message
Ryan Harper (raharper) wrote : Fixed in curtin version 19.3.

This bug is believed to be fixed in curtin in version 19.3. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in curtin:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.