mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-04 08:13:38 +00:00
storage: Make partition resizing work with parted 3.3
On Raspberry Pi 3B+ image, it was observed that resizing partition fails during initial setup. Due to this, Apache, SSH and Plinth become unavailable. This is due newer version of parted 3.3 (Debian testing/unstable) which does not work with ---pretend-input-tty option as previously expected of parted 3.2 (Debian buster). Fix the problem by sending answers to promoted questions via stdin instead of via command line. This solution works on both versions of parted, i.e., 3.2 and 3.3. Tests: - On a freshly built Raspberry Pi 3B+ unstable image the problem is reproducible. Running expand partition fails repeatedly. - Downgrade version of parted to 3.2 observe that the expanding operation runs fine. Upgrade to version parted 3.3 again. - Apply the patch on the action script. Re-run expanding partition and observe that the problem is resolved. The version of parted is 3.3. - Downgrade the version of parted to 3.2. Downsize the partition, re-run expanding partition. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
0a48175249
commit
57c8bea9a5
@ -96,14 +96,15 @@ def _resize_partition(device, requested_partition, free_space):
|
||||
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24215
|
||||
fallback_command = [
|
||||
'parted', '--align=optimal', device, '---pretend-input-tty', 'unit',
|
||||
'B', 'resizepart', requested_partition['number'], 'yes',
|
||||
str(free_space['end'])
|
||||
'B', 'resizepart', requested_partition['number']
|
||||
]
|
||||
try:
|
||||
subprocess.run(command, check=True)
|
||||
except subprocess.CalledProcessError:
|
||||
try:
|
||||
subprocess.run(fallback_command, check=True)
|
||||
input_text = 'yes\n' + str(free_space['end'])
|
||||
subprocess.run(fallback_command, check=True,
|
||||
input=input_text.encode())
|
||||
except subprocess.CalledProcessError as exception:
|
||||
print('Error expanding partition:', exception, file=sys.stderr)
|
||||
sys.exit(5)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user