hostnamectl: command not found
20,317
Solution 1
hostnamectl
is provided by systemd-services
package in Ubuntu 14.04. You need to install that package to get the command line utility
sudo apt-get install systemd-services
Solution 2
To find out which package a file is you can use apt- file:
sudo apt-get install apt-file
apt-file update
After using it it is as simple as :
ricardo@zeus:~$ apt-file search hostnamectl
cdist: /usr/lib/python3/dist-packages/cdist/conf/type/__hostname/explorer/has_hostnamectl
systemd: /usr/bin/hostnamectl
systemd: /usr/share/bash-completion/completions/hostnamectl
systemd: /usr/share/man/man1/hostnamectl.1.gz
systemd: /usr/share/zsh/vendor-completions/_hostnamectl
Once apt -file package tells you that the file is found , you just have to install it:
sudo apt-get install systemd
Related videos on Youtube
Author by
Samir Sabri
I am a software architect, and I like to work on simulation projects, I have worked long time on developing educational applications.
Updated on September 18, 2022Comments
-
Samir Sabri almost 2 years
I am using Ubuntu 14.04.3 LTS, when I try to run command
hostnamectl
I get error:bash: hostnamectl: command not found
Which library shall I install to use
hostnamectl
?-
Zanna almost 8 yearson my system it appears to be provided by
systemd
. I'm not sure whether it's available to you without that (in 14.04 which doesn't usesystemd
) -
Anwar almost 8 years@SamirSabri You got
hostnamectl
in 14.04 by installingsystemd
? -
Samir Sabri almost 8 yearsno, but
sudo apt-get install systemd-services
installed it successfully -
Anwar almost 8 years@SamirSabri If that is the case, shouldn't you accept the answer that said you to do so? The accepted answer suggested you to install
systemd
but you installedsystemd-services
!! -
Samir Sabri almost 8 yearsYea, you are right
-
-
Samir Sabri almost 8 yearsI tried that, I got similar result, but when I run
/usr/bin/hostnamectl
I get:bash: /usr/bin/hostnamectl: No such file or directory
-
Samir Sabri almost 8 yearsif I try to run
ls /usr/bin
I can't seehostnamectl
, however,apt-file search hostnamectl
will showsystemd: /usr/bin/hostnamectl
can you please exaplain? -
Neoniet almost 8 yearsOnce apt -file package tells you that the file is found , you just have to install it: sudo apt- get install systemd
-
Samir Sabri almost 8 yearshave you tried it? I got this error:
# sudo hostnamectl set-hostname new_host_name Failed to get D-Bus connection: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
-
Anwar almost 8 years@SamirSabri Yes. I used that in 16.04. The error seems like you have problem in dbus. You can ask a new question regarding this error.