From 0d80eba2193cd65b93817bc6ebf0a9849268056c Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 2 Nov 2021 09:21:24 +0000 Subject: Changed from ntpd service to systemd-timesyncd. --- archinstall/lib/installer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 0bdddb2e..d1e36d98 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -249,8 +249,8 @@ class Installer: def activate_ntp(self): self.log('Installing and activating NTP.', level=logging.INFO) if self.pacstrap('ntp'): - if self.enable_service('ntpd'): - return True + with Boot(self) as session: + session.SysCommand(["timedatectl", "set-ntp", 'true']) def enable_service(self, *services): for service in services: -- cgit v1.2.3-54-g00ecf From d7449cc887a783febc07257e13dfda7c763a5afe Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 2 Nov 2021 09:23:02 +0000 Subject: Removed pacstrap of ntpd as it's redundant. Also enabled the systemd-timesyncd service before running a command against it. --- archinstall/lib/installer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index d1e36d98..c2c94206 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -248,9 +248,9 @@ class Installer: def activate_ntp(self): self.log('Installing and activating NTP.', level=logging.INFO) - if self.pacstrap('ntp'): - with Boot(self) as session: - session.SysCommand(["timedatectl", "set-ntp", 'true']) + self.enable_service('systemd-timesyncd'): + with Boot(self) as session: + session.SysCommand(["timedatectl", "set-ntp", 'true']) def enable_service(self, *services): for service in services: -- cgit v1.2.3-54-g00ecf From 7e85002dcbc913c117c9a341026283cce2dc0787 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 2 Nov 2021 09:29:28 +0000 Subject: Made sure there's a default config that's 'sane' --- archinstall/lib/installer.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index c2c94206..6e2b7ffe 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -249,6 +249,12 @@ class Installer: def activate_ntp(self): self.log('Installing and activating NTP.', level=logging.INFO) self.enable_service('systemd-timesyncd'): + + with open(f"{self.target}/etc/systemd/timesyncd.conf", "w") as fh: + fh.write("[Time]\n") + fh.write("NTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org\n") + fh.write("FallbackNTP=0.pool.ntp.org 1.pool.ntp.org 0.fr.pool.ntp.org\n") + with Boot(self) as session: session.SysCommand(["timedatectl", "set-ntp", 'true']) -- cgit v1.2.3-54-g00ecf From aa1afdbeb05f4bc762befebfa49464cc5c56922e Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Tue, 2 Nov 2021 09:30:38 +0000 Subject: flake8 fix, trailing semicolon --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 6e2b7ffe..7b677dc3 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -248,7 +248,7 @@ class Installer: def activate_ntp(self): self.log('Installing and activating NTP.', level=logging.INFO) - self.enable_service('systemd-timesyncd'): + self.enable_service('systemd-timesyncd') with open(f"{self.target}/etc/systemd/timesyncd.conf", "w") as fh: fh.write("[Time]\n") -- cgit v1.2.3-54-g00ecf From 93efce92a96fa7aeff813ca1e3b3b398edf50bb6 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 5 Nov 2021 17:03:07 +0100 Subject: Renamed the ntp function, as it doesn't install/enable ntp any longer. Even tho it uses the NTP protocol. --- archinstall/lib/installer.py | 6 +++++- examples/guided.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 8f32dd33..1585d535 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -256,7 +256,11 @@ class Installer: ) def activate_ntp(self): - self.log('Installing and activating NTP.', level=logging.INFO) + log(f"activate_ntp() is deprecated, use activate_time_syncronization()", fg="yellow", level=logging.INFO) + self.activate_time_syncronization() + + def activate_time_syncronization(self): + self.log('Installing and activating time synchronization.', level=logging.INFO) self.enable_service('systemd-timesyncd') with open(f"{self.target}/etc/systemd/timesyncd.conf", "w") as fh: diff --git a/examples/guided.py b/examples/guided.py index 45395add..19fff406 100644 --- a/examples/guided.py +++ b/examples/guided.py @@ -310,7 +310,7 @@ def perform_installation(mountpoint): installation.set_timezone(timezone) if archinstall.arguments.get('ntp', False): - installation.activate_ntp() + installation.activate_time_syncronization() if (root_pw := archinstall.arguments.get('!root-password', None)) and len(root_pw): installation.user_set_pw('root', root_pw) -- cgit v1.2.3-54-g00ecf From 4f4842f6bfbc8a4726d73347f2d30fd7c1127b72 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 5 Nov 2021 17:05:20 +0100 Subject: Added more information to the NTP log line. --- archinstall/lib/installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 1585d535..0fbf594d 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -260,7 +260,7 @@ class Installer: self.activate_time_syncronization() def activate_time_syncronization(self): - self.log('Installing and activating time synchronization.', level=logging.INFO) + self.log('Activating systemd-timesyncd for time synchronization using Arch Linux and ntp.org NTP servers.', level=logging.INFO) self.enable_service('systemd-timesyncd') with open(f"{self.target}/etc/systemd/timesyncd.conf", "w") as fh: -- cgit v1.2.3-54-g00ecf From 37c40b8894d4e32209983e1b682dc345d851ba00 Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 5 Nov 2021 17:17:18 +0100 Subject: Fix import systemd.Boot --- archinstall/lib/installer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 0fbf594d..648ef50c 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -13,6 +13,7 @@ from .disk.helpers import get_mount_info from .mirrors import use_mirrors from .plugins import plugins from .storage import storage +from .systemd import Boot # from .user_interaction import * from .output import log from .profiles import Profile -- cgit v1.2.3-54-g00ecf