Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2023-06-12 10:49:53 +0200
committerGitHub <noreply@github.com>2023-06-12 10:49:53 +0200
commitf9ce7679fed5f28b165841fbae6f27581d1ca4b6 (patch)
treeccfbea8f97aef90637c4227e2bcb45c91ae4d48b /archinstall
parent195d779d851106f1f8be2de76cfa73e5d130b441 (diff)
Added a service-started wait timer for keyring.timer (#1858)
* Added a service-started wait timer for keyring.timer, and then we check the service state for keyring.service. This is because the .service can be 'dead' right from the start without the timer ever have started. This ensures that we wait for the timer to kick in before we monitor for the .service execution * Removed pacman-init.service wait timer, as we can rely on keyring.timer instead: https://github.com/archlinux/archinstall/issues/1846#issuecomment-1586872920
Diffstat (limited to 'archinstall')
-rw-r--r--archinstall/lib/installer.py26
1 files changed, 21 insertions, 5 deletions
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 6eac85fc..e3dd3f04 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -147,12 +147,17 @@ class Installer:
while self._service_state('reflector') not in ('dead', 'failed', 'exited'):
time.sleep(1)
- info('Waiting pacman-init.service to complete.')
- while self._service_state('pacman-init') not in ('dead', 'failed', 'exited'):
+ # info('Waiting for pacman-init.service to complete.')
+ # while self._service_state('pacman-init') not in ('dead', 'failed', 'exited'):
+ # time.sleep(1)
+
+ info('Waiting for Arch Linux keyring sync (archlinux-keyring-wkd-sync) to complete.')
+ # Wait for the timer to kick in
+ while self._service_started('archlinux-keyring-wkd-sync.timer') is None:
time.sleep(1)
- info('Waiting Arch Linux keyring sync (archlinux-keyring-wkd-sync) to complete.')
- while self._service_state('archlinux-keyring-wkd-sync') not in ('dead', 'failed', 'exited'):
+ # Wait for the service to enter a finished state
+ while self._service_state('archlinux-keyring-wkd-sync.service') not in ('dead', 'failed', 'exited'):
time.sleep(1)
def _verify_boot_part(self):
@@ -1206,8 +1211,19 @@ class Installer:
return True
+ def _service_started(self, service_name: str) -> str | None:
+ if os.path.splitext(service_name)[1] not in ('.service', '.target', '.timer'):
+ service_name += '.service' # Just to be safe
+
+ last_execution_time = b''.join(SysCommand(f"systemctl show --property=ActiveEnterTimestamp --no-pager {service_name}", environment_vars={'SYSTEMD_COLORS': '0'}))
+ last_execution_time = last_execution_time.lstrip(b'ActiveEnterTimestamp=').strip()
+ if not last_execution_time:
+ return None
+
+ return last_execution_time.decode('UTF-8')
+
def _service_state(self, service_name: str) -> str:
- if os.path.splitext(service_name)[1] != '.service':
+ if os.path.splitext(service_name)[1] not in ('.service', '.target', '.timer'):
service_name += '.service' # Just to be safe
state = b''.join(SysCommand(f'systemctl show --no-pager -p SubState --value {service_name}', environment_vars={'SYSTEMD_COLORS': '0'}))