From f83c763ab718d7286111bc12536aea4e80159392 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Tue, 9 Feb 2021 19:42:22 -0500 Subject: [PATCH] upgrades: Only check free space bytes before dist upgrade Remove the percentage check, which was incorrectly checking used percent, not free percent. Closes: #2046. Tests: - Fill up disk space so that 4.5G is free. Dist upgrade does not start due to not enough free space. - Fill up disk space so that 5.5G is free. Dist upgrade can be started. Signed-off-by: James Valleroy Reviewed-by: Sunil Mohan Adapa --- actions/upgrades | 7 +++---- plinth/modules/upgrades/__init__.py | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/actions/upgrades b/actions/upgrades index b52e01499..87f20888b 100755 --- a/actions/upgrades +++ b/actions/upgrades @@ -366,10 +366,9 @@ def _check_dist_upgrade(test_upgrade=False): if check_dist == 'testing' and not test_upgrade: return (False, 'test-not-set') - output = subprocess.check_output(['df', '--output=avail,pcent', '/']) - output = output.decode().split('\n')[1].split() - free_space, free_percent = int(output[0]), int(output[1][:-1]) - if free_space < 5000000 or free_percent < 10: + output = subprocess.check_output(['df', '--output=avail', '/']) + free_space = int(output.decode().split('\n')[1]) + if free_space < 5000000: return (False, 'not-enough-free-space') logging.info('Upgrading from %s to %s...', dist, codename) diff --git a/plinth/modules/upgrades/__init__.py b/plinth/modules/upgrades/__init__.py index 5bd6c62f5..e6ca2d2aa 100644 --- a/plinth/modules/upgrades/__init__.py +++ b/plinth/modules/upgrades/__init__.py @@ -209,11 +209,10 @@ def check_dist_upgrade(_): logger.warning('Skip dist upgrade: Not enough free space in /.') title = ugettext_noop('Could not start distribution update') message = ugettext_noop( - # xgettext:no-python-format 'There is not enough free space in the root partition to ' - 'start the distribution update. Please ensure at least 5 GB, ' - 'and at least 10% of the total space, is free. Distribution ' - 'update will be retried after 24 hours, if enabled.') + 'start the distribution update. Please ensure at least 5 GB ' + 'is free. Distribution update will be retried after 24 hours,' + ' if enabled.') Notification.update_or_create( id='upgrades-dist-upgrade-free-space', app_id='upgrades', severity='warning', title=title, message=message, actions=[{