chzdev export/prepare-for-import/import bombs out on import in python3.6

Bug #1825007 reported by Dimitri John Ledkov
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
curtin
Fix Released
High
Ryan Harper
curtin (Ubuntu)
Fix Released
High
Unassigned
Disco
Won't Fix
High
Unassigned

Bug Description

chzdev export/prepare-for-import/import bombs out on import in python3.6

like so:

Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: Running command ['chzdev', '--quiet', '--persistent', '--no-root-update', '--base', '/etc=/target/etc', '--import', '-'] with allowed return codes [0] (capture=True)
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: finish: cmd-install/stage-curthooks/builtin/cmd-curthooks/installing-kernel: FAIL: installing kernel
Apr 16 14:05:49 ubuntu-server curtin_event.1663[2372]: finish: cmd-install/stage-curthooks/builtin/cmd-curthooks/installing-kernel: FAIL: installing kernel
Apr 16 14:05:49 ubuntu-server curtin_event.1663[2372]: finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: curtin command curthooks
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: curtin command curthooks
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: Traceback (most recent call last):
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: File "/snap/subiquity/876/lib/python3.6/site-packages/curtin/commands/main.py", line 202, in main
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: ret = args.func(args)
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: File "/snap/subiquity/876/lib/python3.6/site-packages/curtin/commands/curthooks.py", line 1410, in curthooks
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: builtin_curthooks(cfg, target, state)
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: File "/snap/subiquity/876/lib/python3.6/site-packages/curtin/commands/curthooks.py", line 1281, in builtin_curthooks
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: chzdev_persist_active_online(cfg, target)
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: File "/snap/subiquity/876/lib/python3.6/site-packages/curtin/commands/curthooks.py", line 163, in chzdev_persist_active_online
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: persistent=True, noroot=True, base={'/etc': target_etc})
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: File "/snap/subiquity/876/lib/python3.6/site-packages/curtin/commands/curthooks.py", line 210, in chzdev_import
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: return util.subp(cmd, data=data, capture=True)
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: File "/snap/subiquity/876/lib/python3.6/site-packages/curtin/util.py", line 275, in subp
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: return _subp(*args, **kwargs)
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: File "/snap/subiquity/876/lib/python3.6/site-packages/curtin/util.py", line 112, in _subp
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: (out, err) = sp.communicate(data)
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: File "/snap/subiquity/876/usr/lib/python3.6/subprocess.py", line 843, in communicate
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: stdout, stderr = self._communicate(input, endtime, timeout)
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: File "/snap/subiquity/876/usr/lib/python3.6/subprocess.py", line 1499, in _communicate
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: input_view = memoryview(self._input)
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: TypeError: memoryview: a bytes-like object is required, not 'str'
Apr 16 14:05:49 ubuntu-server curtin_log.1663[1766]: memoryview: a bytes-like object is required, not 'str'
Apr 16 14:05:50 ubuntu-server curtin_log.1663[1766]: builtin command failed

http://paste.ubuntu.com/p/KKdr9GFKg5/

Related branches

description: updated
Changed in curtin (Ubuntu):
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Ryan Harper (raharper) wrote :

Thanks, looks like python3.7 subprocess.Popen.communicate helpfully converts str to bytes, however that hid the bug when I tested this path on s390x disco.

The fix will be to encode the string data we passed to util.subp().

Changed in curtin:
assignee: nobody → Ryan Harper (raharper)
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

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

Changed in curtin:
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package curtin - 18.2-26-gd8e45d79-0ubuntu1

---------------
curtin (18.2-26-gd8e45d79-0ubuntu1) eoan; urgency=medium

  * New upstream snapshot.
    - vmtest: reenable UEFI 4k tests, which got dropped when fixing
      subclassing.
    - vmtests: Add test_kernel_img_conf stub for PsuedoVMBaseClass
    - curthooks: chzdev_import must encode data if provided (LP: #1825007)
    - vmtest: test for kernel-img conf on ubuntu only

 -- Ryan Harper <email address hidden> Tue, 23 Apr 2019 09:32:56 -0500

Changed in curtin (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Dan Watkins (oddbloke) wrote : Fixed in curtin version 19.1.

This bug is believed to be fixed in curtin in version 19.1. 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
Steve Langasek (vorlon)
Changed in curtin (Ubuntu Disco):
status: Confirmed → Won't Fix
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.