diff --git a/plinth/modules/names/__init__.py b/plinth/modules/names/__init__.py index 3a9883fab..5af5b947e 100644 --- a/plinth/modules/names/__init__.py +++ b/plinth/modules/names/__init__.py @@ -242,7 +242,9 @@ def get_domain_name(): def get_hostname(): """Return the hostname.""" - return socket.gethostname() + process = subprocess.run(['hostnamectl', 'hostname', '--static'], + stdout=subprocess.PIPE, check=True) + return process.stdout.decode().strip() def set_hostname(hostname):