From f211906a5afcfad553070748a779c3166d2b3b4b Mon Sep 17 00:00:00 2001 From: Daemon Coder <11915375+codefiles@users.noreply.github.com> Date: Thu, 4 May 2023 10:04:35 -0400 Subject: Remove obsolete enabling of NTP in ISO (#1729) * Remove obsolete enabling of NTP in ISO * Fixed flake8 linting * Remove `activate_ntp()` * Update comment --------- Co-authored-by: Anton Hvornum --- archinstall/lib/global_menu.py | 12 +----------- archinstall/lib/installer.py | 28 ++++++---------------------- archinstall/scripts/guided.py | 3 --- archinstall/scripts/swiss.py | 6 ------ examples/interactive_installation.py | 3 --- 5 files changed, 7 insertions(+), 45 deletions(-) diff --git a/archinstall/lib/global_menu.py b/archinstall/lib/global_menu.py index bc9164ee..0ec057f3 100644 --- a/archinstall/lib/global_menu.py +++ b/archinstall/lib/global_menu.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import Any, List, Optional, Union, Dict, TYPE_CHECKING from . import disk -from .general import SysCommand, secret +from .general import secret from .menu import Selector, AbstractMenu from .models import NetworkConfiguration from .models.bootloader import Bootloader @@ -18,7 +18,6 @@ from .user_interaction import ask_for_audio_selection from .user_interaction import ask_for_bootloader from .user_interaction import ask_for_swap from .user_interaction import ask_hostname -from .user_interaction import ask_ntp from .user_interaction import ask_to_configure_network from .user_interaction import get_password, ask_for_a_timezone from .user_interaction import select_additional_repositories @@ -164,7 +163,6 @@ class GlobalMenu(AbstractMenu): self._menu_options['ntp'] = \ Selector( _('Automatic time sync (NTP)'), - lambda preset: self._select_ntp(preset), default=True) self._menu_options['__separator__'] = \ Selector('') @@ -323,14 +321,6 @@ class GlobalMenu(AbstractMenu): password = get_password(prompt=prompt) return password - def _select_ntp(self, preset :bool = True) -> bool: - ntp = ask_ntp(preset) - - value = str(ntp).lower() - SysCommand(f'timedatectl set-ntp {value}') - - return ntp - def _select_disk_config( self, preset: Optional[disk.DiskLayoutConfiguration] = None diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index c51019fd..726ff3d0 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -162,10 +162,14 @@ class Installer: def _verify_service_stop(self): """ Certain services might be running that affects the system during installation. - Currently, only one such service is "reflector.service" which updates /etc/pacman.d/mirrorlist + One such service is "reflector.service" which updates /etc/pacman.d/mirrorlist We need to wait for it before we continue since we opted in to use a custom mirror/region. """ - log('Waiting for automatic mirror selection (reflector) to complete...', level=logging.INFO) + log('Waiting for time sync (systemd-timesyncd.service) to complete.', level=logging.INFO) + while SysCommand('timedatectl show --property=NTPSynchronized --value').decode().rstrip() != 'yes': + time.sleep(1) + + log('Waiting for automatic mirror selection (reflector) to complete.', level=logging.INFO) while service_state('reflector') not in ('dead', 'failed', 'exited'): time.sleep(1) @@ -282,26 +286,6 @@ class Installer: self._disk_encryption.encryption_password ) - def activate_ntp(self): - """ - If NTP is activated, confirm activiation in the ISO and at least one time-sync finishes - """ - SysCommand('timedatectl set-ntp true') - - logged = False - while service_state('dbus-org.freedesktop.timesync1.service') not in ['running']: - if not logged: - log(f"Waiting for dbus-org.freedesktop.timesync1.service to enter running state", level=logging.INFO) - logged = True - time.sleep(1) - - logged = False - while 'Server: n/a' in SysCommand('timedatectl timesync-status --no-pager --property=Server --value'): - if not logged: - log(f"Waiting for timedatectl timesync-status to report a timesync against a server", level=logging.INFO) - logged = True - time.sleep(1) - def sync_log_to_install_medium(self) -> bool: # Copy over the install log (if there is one) to the install medium if # at least the base has been strapped in, otherwise we won't have a filesystem/structure to copy to. diff --git a/archinstall/scripts/guided.py b/archinstall/scripts/guided.py index 6419c1dc..9906e0a9 100644 --- a/archinstall/scripts/guided.py +++ b/archinstall/scripts/guided.py @@ -149,9 +149,6 @@ def perform_installation(mountpoint: Path): # generate encryption key files for the mounted luks devices installation.generate_key_files() - if archinstall.arguments.get('ntp', False): - installation.activate_ntp() - # Set mirrors used by pacstrap (outside of installation) if archinstall.arguments.get('mirror-region', None): use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium diff --git a/archinstall/scripts/swiss.py b/archinstall/scripts/swiss.py index 2712807a..3bf847b1 100644 --- a/archinstall/scripts/swiss.py +++ b/archinstall/scripts/swiss.py @@ -74,9 +74,6 @@ class SetupMenu(GlobalMenu): self.enable('abort') def exit_callback(self): - if self._data_store.get('ntp', False): - archinstall.SysCommand('timedatectl set-ntp true') - if self._data_store.get('mode', None): archinstall.arguments['mode'] = self._data_store['mode'] log(f"Archinstall will execute under {archinstall.arguments['mode']} mode") @@ -203,9 +200,6 @@ def perform_installation(mountpoint: Path, exec_mode: ExecutionMode): # generate encryption key files for the mounted luks devices installation.generate_key_files() - if archinstall.arguments.get('ntp', False): - installation.activate_ntp() - # Set mirrors used by pacstrap (outside of installation) if archinstall.arguments.get('mirror-region', None): use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium diff --git a/examples/interactive_installation.py b/examples/interactive_installation.py index 8b4e393f..a27ec0f9 100644 --- a/examples/interactive_installation.py +++ b/examples/interactive_installation.py @@ -112,9 +112,6 @@ def perform_installation(mountpoint: Path): # generate encryption key files for the mounted luks devices installation.generate_key_files() - if archinstall.arguments.get('ntp', False): - installation.activate_ntp() - # Set mirrors used by pacstrap (outside of installation) if archinstall.arguments.get('mirror-region', None): use_mirrors(archinstall.arguments['mirror-region']) # Set the mirrors for the live medium -- cgit v1.2.3-70-g09d2