Bug #8274

liveusb-creator's gdisk scripts returns error in Jessie

Added by anonym 2014-11-18 17:10:58 . Updated 2015-03-05 09:41:52 .

Status:
Resolved
Priority:
High
Assignee:
intrigeri
Category:
Installation
Target version:
Start date:
2014-12-18
Due date:
2015-03-05
% Done:

100%

Feature Branch:
Type of work:
Code
Blueprint:

Starter:
Affected tool:
Installer
Deliverable for:

Description

The installation halts and we get this output:

ERROR:liveusb.creator:There was a problem executing the following command: `['/sbin/gdisk', '/dev/sda']`.
A more detailed error log has been written to '/tmp/liveusb-creator.log'.
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/liveusb/gui.py", line 203, in run
    self.live.create_hybrid_mbr()
  File "/usr/lib/python2.7/dist-packages/liveusb/creator.py", line 270, in create_hybrid_mbr
    'Y',   # proceed, possibly destroying data
  File "/usr/lib/python2.7/dist-packages/liveusb/creator.py", line 258, in _gdisk_script
    self.popen(cmd, shell=False, stdin=stdin)
  File "/usr/lib/python2.7/dist-packages/liveusb/creator.py", line 346, in popen
    % {'command': cmd, 'filename': filename})
LiveUSBError: There was a problem executing the following command: `['/sbin/gdisk', '/dev/sda']`.


However, the output (in /tmp/liveusb-creator.log) and resulting partitioning from that gdisk script is still identical to what we get in Wheezy, it’s just the return code that has changed to 1.


Subtasks

Bug #8454: Test gdisk minimal fix for Jessie Resolved

100


Related issues

Blocks Tails - Feature #7563: Update the automated test suite for Jessie ISO images Resolved 2014-11-26 2016-01-15

History

#1 Updated by anonym 2014-11-18 17:12:40

The following quick’n’dirty fix results in a bootable Jessie-based Tails USB installation:

--- /usr/lib/python2.7/dist-packages/liveusb/creator.py.orig    2014-11-18 16:27:31.056000000 +0000
+++ /usr/lib/python2.7/dist-packages/liveusb/creator.py 2014-11-18 16:36:58.204000000 +0000
@@ -250,12 +250,12 @@
                + [ self.drive['parent'] ])
         self.popen(cmd, shell=False)

-    def _gdisk_script(self, gdisk_cmds):
+    def _gdisk_script(self, gdisk_cmds, passive=False):
         cmd = [ '/sbin/gdisk', self.drive['device'] ]
         stdin = tempfile.TemporaryFile(mode='w')
         stdin.write('\n'.join(gdisk_cmds) + '\n')
         stdin.seek(0)
-        self.popen(cmd, shell=False, stdin=stdin)
+        self.popen(cmd, passive=passive, shell=False, stdin=stdin)

     def create_hybrid_mbr(self):
         # only relevant with OS that don't know how to access partitions on GPT
@@ -268,14 +268,14 @@
                              'N',   # no protective partition
                              'w',   # write table to disk and exit
                              'Y',   # proceed, possibly destroying data
-                           ])
+                           ], passive = True)

     def remove_hybrid_mbr(self):
         self._gdisk_script([ 'x',   # extra functionality
                              'n',   # create a new protective MBR
                              'w',   # write table to disk and exit
                              'Y',   # proceed, possibly destroying data
-                           ])
+                           ], passive = True)

     def is_device_big_enough(self):
         if self.system_partition_size * 1024**2 <= self.drive['size']:

#2 Updated by anonym 2014-11-19 17:49:38

  • blocks Feature #7563: Update the automated test suite for Jessie ISO images added

#3 Updated by intrigeri 2014-11-25 20:44:00

Looks like a bug in gdisk, possibly the same as http://sourceforge.net/p/gptfdisk/mailman/message/32068566/. Would be good to have this fixed in Jessie. Next step is to check with upstream if it’s a known issue (and possibly to try reverting the commit pointed at by the message linked above).

#4 Updated by anonym 2014-12-02 16:56:44

I think you are right. Upstream commit a920398 says: ‘Fixed bug that caused spurious “1” exit condition in gdisk.’ Curiously, that commit is from March 29, and there has been no release since (in facts, it’s master’s HEAD). Hmm.

Also, the commit is non-atomic, but the following extract of it hopefully fixes this issue (haven’t tested):

--- a/gdisk.cc
+++ b/gdisk.cc
@@ -15,6 +15,7 @@ int main(int argc, char* argv[]) {
    GPTDataTextUI theGPT;
    string device = "";
    UnicodeString uString;
+   int isError = 0;

 #ifndef EFI
    cout << "GPT fdisk (gdisk) version " << GPTFDISK_VERSION << "\n\n";
@@ -49,16 +50,20 @@ int main(int argc, char* argv[]) {
             device = (string) argv[1];
          } else { // 3 arguments, but none is "-l"
             cerr << "Usage: " << argv[0] << " [-l] device_file\n";
+            isError = 1;
          } // if/elseif/else
          if (device != "") {
             theGPT.JustLooking();
             if (theGPT.LoadPartitions(device))
                theGPT.DisplayGPTData();
+            else
+               isError = 1;
          } // if
          break;
       default:
          cerr << "Usage: " << argv[0] << " [-l] device_file\n";
+         isError = 1;
          break;
    } // switch
-   return 1 ;
+   return (isError);
 } // main

#5 Updated by intrigeri 2014-12-18 11:31:30

  • Priority changed from Normal to High

#6 Updated by BitingBird 2015-01-04 19:00:30

  • Affected tool set to Installer

#7 Updated by Anonymous 2015-02-26 10:49:22

  • blocks Feature #8556: Make Tails Installer work fine outside of Tails added

#8 Updated by intrigeri 2015-03-01 21:42:06

  • Target version changed from Tails_2.0 to Tails_1.3.2

This needs to be fixed in Jessie soon, otherwise we’ll have to workaround it in nasty ways in our Installer.

#9 Updated by intrigeri 2015-03-01 21:45:40

  • Assignee set to intrigeri

#10 Updated by intrigeri 2015-03-05 09:41:05

  • Target version changed from Tails_1.3.2 to Tails_2.0

#11 Updated by intrigeri 2015-03-05 09:41:52

  • Status changed from Confirmed to Resolved

I’ve uploaded the proposed fix to our feature-jessie suite, which fixes this bug.

#12 Updated by intrigeri 2015-03-05 09:42:19

  • blocked by deleted (Feature #8556: Make Tails Installer work fine outside of Tails)