Can't change hostname in WSL #15939

Open
opened 2026-01-31 04:52:48 +00:00 by claunia · 0 comments
Owner

Originally created by @baseely on GitHub (Nov 20, 2021).

Windows Terminal version

1.11.2921.0

Windows build number

10.0.19043.0

Other Software

No response

Steps to reproduce

I'm using Ubuntu 20.04 in WSL:
cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Try to change the hostname using the below command:
hostnamectl set-hostname <test-host-name>

Expected Behavior

Change the hostname to the new one test-host-name

Actual Behavior

It gives this error message instead:
System has not been booted with systemd as init system (PID 1). Can't operate. Failed to create bus connection: Host is down

Originally created by @baseely on GitHub (Nov 20, 2021). ### Windows Terminal version 1.11.2921.0 ### Windows build number 10.0.19043.0 ### Other Software _No response_ ### Steps to reproduce I'm using Ubuntu 20.04 in WSL: `cat /etc/os-release` NAME="Ubuntu" VERSION="20.04.1 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.1 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal Try to change the hostname using the below command: `hostnamectl set-hostname <test-host-name>` ### Expected Behavior Change the hostname to the new one `test-host-name` ### Actual Behavior It gives this error message instead: `System has not been booted with systemd as init system (PID 1). Can't operate. Failed to create bus connection: Host is down`
claunia added the Product-WSLNeeds-TriageNeeds-Tag-Fix labels 2026-01-31 04:52:48 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15939