Merge lp:~yuningdodo/ubuntu/trusty/usb-creator/usb-creator.lp1361474+lp1300361-recreate-udisks-client into lp:ubuntu/trusty-updates/usb-creator

Proposed by Yu Ning
Status: Merged
Merge reported by: Brian Murray
Merged at revision: not available
Proposed branch: lp:~yuningdodo/ubuntu/trusty/usb-creator/usb-creator.lp1361474+lp1300361-recreate-udisks-client
Merge into: lp:ubuntu/trusty-updates/usb-creator
Diff against target: 55 lines (+25/-2)
2 files modified
bin/usb-creator-helper (+13/-2)
debian/changelog (+12/-0)
To merge this branch: bzr merge lp:~yuningdodo/ubuntu/trusty/usb-creator/usb-creator.lp1361474+lp1300361-recreate-udisks-client
Reviewer Review Type Date Requested Status
Brian Murray Approve
Timo Jyrinki Approve
Martin Pitt Pending
Review via email: mp+232852@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

(a backport of 0.2.62/utopic and two lines from 0.2.60/utopic)

87. By Yu Ning

HELPER: use parted instead of udisks2 to create the new partition table
since udisks2 uses wipefs to erase the old partition table, however
partition table erasing is not supported in wipefs yet in trusty, that
would cause a timed out error.

Revision history for this message
Yu Ning (yuningdodo) wrote :

Updated, instead of using udisks2 to format the old partition table now we use parted directly as a workaround for (LP: #1361474)

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the work, the first part of the second blob doesn't seem to be in trunk, is that normal? Shouldn't be applied to the vivid version first then backported? Do we have a bug about that?

Revision history for this message
Yu Ning (yuningdodo) wrote :

Hi Sebastien, thanks very much for the review, the two related bugs are bug #1361474 and #1300361.

Actually rev86 is the original proposed patch, however with this single patch the erasing operation will still fail due to bug #1059872 in util-linux. In such a case I ever attempted to backport a patch to util-linux [1], however I think it will be very hard for it to be accepted into util-linux, so I committed rev87 to workaround the issue without util-linux being fixed.

rev87 is useless for utopic or vivid since util-linux was already fixed in them.

Will it be better if I revert rev87 and wait for util-linux being fixed in trusty?

[1]: https://code.launchpad.net/~yuningdodo/ubuntu/trusty/util-linux/util-linux.backport-wipefs-partition-table-erasing-support/+merge/237898

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

I'm not familiar with USB Creator code as such, but #87 surely looks a simpler workaround than getting the util-linux.backport-wipefs-partition-table-erasing-support SRU:d.

Let's see if we can get Martin to comment on this SRU.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

I've built a package from Yu's branch for testing in a PPA for Ubuntu 14.04:

sudo apt-add-repository ppa:timo-jyrinki/ppa
sudo apt update
sudo apt install usb-creator-common usb-creator-gtk

I'll test it out regarding the bugs and report back soon.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

It works ~good to me. I was able to empty an USB both without partition table at all (/dev/zero written to the device) and with an empty partition table.

I also tested successfully the "normal" case of writing USB stick and booting from it, ie the case of partition table and one vfat partition. Seemed to work.

I did get occasionally "gi._glib.GError: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error setting partition flags on /dev/sdc1: Command-line `sfdisk --change-id "/dev/sdc" 1 0x0c' exited with non-zero exit status 1: /dev/sdc: Input/output error", but when I did I also got it with the current usb-creator version so it did not seem to be a regression. And like it says it actually sounds possibly something wrong with the SD card I'm using via USB reader.

review: Approve
Revision history for this message
Yu Ning (yuningdodo) wrote :

Timo, thanks very much for the approval, the issue you mentioned is never reproduced in my side, and I also think it should be a different issue.

Revision history for this message
Brian Murray (brian-murray) wrote :

I'll manually merge and upload this, thanks for working on it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/usb-creator-helper'
2--- bin/usb-creator-helper 2014-08-19 07:46:20 +0000
3+++ bin/usb-creator-helper 2014-10-09 08:46:06 +0000
4@@ -46,6 +46,8 @@
5 if obj.get_partition_table():
6 return obj
7 partition = obj.get_partition()
8+ if not partition:
9+ return obj
10 parent = partition.get_cached_property('Table').get_string()
11 return udisks.get_object(parent)
12
13@@ -235,11 +237,20 @@
14 block.call_format_sync('vfat', GLib.Variant('a{sv}', {'label': GLib.Variant('s', '')}), None)
15 else:
16 # Create a new partition table and a FAT partition.
17- # Is this correct call to create partition table ?!
18- block.call_format_sync('dos', GLib.Variant('a{sv}', {}), None)
19+ parent_block = parent_dev.get_block()
20+ parent_file = parent_block.get_cached_property('Device').get_bytestring().decode('utf-8')
21+ popen(['parted', '--script', '--', parent_file, 'mktable', 'msdos'])
22+ # XXX: unless we re-create the udisks client it will not
23+ # return the device we created just now.
24+ udisks = UDisks.Client.new_sync(None)
25+ dev = udisks.get_object(device)
26+ block = dev.get_block()
27 size = block.get_cached_property('Size').get_uint64()
28 table = dev.get_partition_table()
29 partition = table.call_create_partition_sync(0, size, '0x0c', '', no_options, None)
30+ # XXX: unless we re-create the udisks client it will not
31+ # return the partition just now
32+ udisks = UDisks.Client.new_sync(None)
33 obj = udisks.get_object(partition)
34 block = obj.get_block()
35 block.call_format_sync('vfat', GLib.Variant('a{sv}', {'label': GLib.Variant('s', '')}), None)
36
37=== modified file 'debian/changelog'
38--- debian/changelog 2014-08-19 07:46:20 +0000
39+++ debian/changelog 2014-10-09 08:46:06 +0000
40@@ -1,3 +1,15 @@
41+usb-creator (0.2.56.3) trusty-proposed; urgency=medium
42+
43+ * HELPER: use parent object only if there is a parent.
44+ * HELPER: re-create the udisks client otherwise it will not return the newly
45+ created device or partition. (LP: #1361474, #1300361)
46+ * HELPER: use parted instead of udisks2 to create the new partition table
47+ since udisks2 uses wipefs to erase the old partition table, however
48+ partition table erasing is not supported in wipefs yet in trusty, that
49+ would cause a timed out error.
50+
51+ -- Yu Ning <ning.yu@canonical.com> Mon, 01 Sep 2014 13:04:25 +0800
52+
53 usb-creator (0.2.56.2) trusty-proposed; urgency=medium
54
55 * Drop invalid empty "erase" type. We don't need to erase the device (you

Subscribers

People subscribed via source and target branches

to all changes: