failure if target provided in config and directory already exists.

Bug #1775622 reported by Scott Moser on 2018-06-07
This bug affects 1 person
Affects Status Importance Assigned to Milestone
curtin (Ubuntu)

Bug Description

Subiquity provides /target as in config like:
  install: {target: /target}

if /target already exists, then WorkingDir will fail and stack trace.

stack trace looks something like this:

Running command ['tar', '-cvf', '/var/log/curtin/curtin-error-logs.tar', 'curtin-logs-2018-06-07-13-33'] with allowed return codes [0] (capture=True)
Wrote: /var/log/curtin/curtin-error-logs.tar
finish: cmd-install: FAIL: curtin command install
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/curtin/commands/", line 469,
in cmd_install
    raise e
  File "/usr/lib/python3/dist-packages/curtin/commands/", line 433,
in cmd_install
    workingd = WorkingDir(cfg)
  File "/usr/lib/python3/dist-packages/curtin/commands/", line 119,
in __init__
FileExistsError: [Errno 17] File exists: '/target'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/curtin/commands/", line 201, in
    ret = args.func(args)
  File "/usr/lib/python3/dist-packages/curtin/commands/", line 473,
in cmd_install
    copy_install_log(logfile,, log_target_path)
UnboundLocalError: local variable 'workingd' referenced before assignment
local variable 'workingd' referenced before assignment

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: curtin 18.1-17-gae48e86f-0ubuntu1~18.04.1
ProcVersionSignature: User Name 4.15.0-22.24-generic 4.15.17
Uname: Linux 4.15.0-22-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
ApportVersion: 2.20.9-0ubuntu7.1
Architecture: amd64
Date: Thu Jun 7 13:45:03 2018
Ec2AMI: ami-0000059f
Ec2AMIManifest: FIXME
Ec2AvailabilityZone: nova
Ec2InstanceType: m1.small
Ec2Kernel: unavailable
Ec2Ramdisk: unavailable
PackageArchitecture: all
 PATH=(custom, no user)
SourcePackage: curtin
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Scott Moser (smoser) wrote :
Scott Moser (smoser) on 2018-06-07
Changed in curtin:
status: New → Confirmed
Changed in curtin (Ubuntu):
status: New → Confirmed
Changed in curtin:
importance: Undecided → Medium
Changed in curtin (Ubuntu):
importance: Undecided → Medium
Scott Moser (smoser) wrote :

An upstream commit landed for this bug.

To view that commit see the following URL:

Changed in curtin:
status: Confirmed → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package curtin - 18.1-25-g9d0e557e-0ubuntu1

curtin (18.1-25-g9d0e557e-0ubuntu1) cosmic; urgency=medium

  * New upstream snapshot.
    - Fix WorkingDir class to support already existing target directory.
      (LP: #1775622)
    - Fix extraction of local filesystem image. (LP: #1775630)
    - Fix tip-pyflakes imported but unused call to util.get_platform_arch
    - subp: update return value of subp with combine_capture=True.
    - tox: add a xenial environments, default envlist changes.
    - tests: Fix race on utcnow during timestamped curtin-log dir creation
      (LP: #1772481)
    - curtainer: patch source version from --source.
    - pyflakes: fix unused variable references identified by pyflakes 2.0.0.

 -- Scott Moser <email address hidden> Thu, 07 Jun 2018 14:59:20 -0400

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

Other bug subscribers