-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hostnamectl command not working #2380
Comments
Hostnamectl goes through hostnamed, which is one of the components of systemd, ergo it will fail to work. You should be able to change it by hand with /etc/hostname |
I had no luck changing I ended up running the following in a startup script run as root:
|
You can remove the line at the top of the hosts file to stop automatic generation |
that might work for the legacy version, but since the Ubuntu store version, the
I have verified that at least in build 16251 the |
I wasn't using hostnamectl to change the hostname, I was just using it for the information about the system that it displays. Are you saying that since its part of systemd it will not work? If so why is that? |
@mw7301 there is no systemd running in WSL |
Which specifically are you looking for? |
I was just filing a bug report since it doesn't work |
Agreed, this is a duplicate. |
@heldchen can you tell what exactly you did? I tried your commands on /etc/rc.loal and crontab to sh script but nothing worked for me. |
I have a /etc/init.d/wsl-init script that is triggered upon first login by some bash profile script. requires the user to have sudo rights so is not that great. the code (among other stuff) that is executed is:
|
This might not work on each distribution. AlmaLinux from Windows Store does not provide it by default. The image is distributed with |
Issue Title
1.1 hostnamectl command not working
Windows version/build number
2.1 Microsoft Windows [Version 10.0.16251.0]
Steps required to reproduce
3.1 issue command hostnamectl at the command line
Terminal output
4.1 Failed to get D-Bus connection: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
Expected behavior
5.1 Example
dev@u16dev:~$ hostnamectl
Static hostname: u16dev
Icon name: computer-vm
Chassis: vm
Machine ID: e61618a42c664b82a08d5055a6057ad9
Boot ID: eb7b7e88909e47eb87c8f1c1f78517ac
Virtualization: vmware
Operating System: Ubuntu 16.04.2 LTS
Kernel: Linux 4.9.0-040900-generic
Architecture: x86-64
End Report
The text was updated successfully, but these errors were encountered: