Bug 914992 - Problems setting hostname via hostnamectl after fresh install of F18
Summary: Problems setting hostname via hostnamectl after fresh install of F18
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-23 22:34 UTC by Tim Wegener
Modified: 2018-09-19 18:43 UTC (History)
11 users (show)

Fixed In Version: systemd-201-2.fc18.6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-05-16 02:56:25 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tim Wegener 2013-02-23 22:34:46 UTC
After a fresh install of F18, I am unable to set the hostname via hostnamectl:

[root@unknown001f3c05ec2b ~]# hostnamectl status
Failed to issue method call: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.


(There is a long pause before that message is displayed.)


[root@unknown001f3c05ec2b ~]# hostnamectl set-hostname abc
Failed to issue method call: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

(Again, there is a long pause before that message is displayed.)

(Happens every time.)


[root@unknown001f3c05ec2b ~]# pwd
/root


From /var/log/messages:

Feb 24 08:56:30 unknown001f3c05ec2b setroubleshoot: SELinux is preventing /usr/lib/systemd/systemd-hostnamed from remove_name access on the directory .machine-infoUcBAfj. For complete SELinux messages. run sealert -l be7696c6-89fe-4f77-b91e-4365996ea0d8
Feb 24 08:56:40 unknown001f3c05ec2b NetworkManager[762]: <warn> nl_recvmsgs() error: (-33) Dump inconsistency detected, interrupted


Info from sealert:

You need to change the label on .machine-infoUcBAfj
# semanage fcontext -a -t FILE_TYPE '.machine-infoUcBAfj'
where FILE_TYPE is one of the following: . 
Then execute: 
restorecon -v '.machine-infoUcBAfj'


I can't act on that because it hasn't supplied a value for FILE_TYPE.


systemd-197-1.fc18.1.x86_64
nss-myhostname-0.3-3.fc18.x86_64
selinux-policy-3.11.1-79.fc18.noarch
selinux-policy-targeted-3.11.1-79.fc18.noarch
kernel-3.7.8-202.fc18.x86_64

Comment 1 Tim Wegener 2013-02-23 22:36:45 UTC
BTW, hostnamectl worked fine on another machine after installing F18 there.

In both cases I installed from the LXDE LiveCD spin.

Comment 2 Tim Wegener 2013-02-23 22:54:04 UTC
(In reply to comment #0)
...
> [root@unknown001f3c05ec2b ~]# hostnamectl set-hostname abc
> Failed to issue method call: Did not receive a reply. Possible causes
> include: the remote application did not send a reply, the message bus
> security policy blocked the reply, the reply timeout expired, or the network
> connection was broken.
> 
> (Again, there is a long pause before that message is displayed.)


Note that despite that message it does create /etc/machine-info
with the contents 'PRETTY_HOSTNAME=abc'.

[root@unknown001f3c05ec2b ~]# ls -Z /etc/machine-info 
-rw-r--r--. root root system_u:object_r:etc_t:s0       /etc/machine-info


Similarly, with the '--static' option:

[root@unknown001f3c05ec2b ~]# hostnamectl set-hostname --static abc
Failed to issue method call: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

...but it does update /etc/hostname with contents 'abc'.

Comment 3 Lennart Poettering 2013-03-07 14:41:21 UTC
this should be fixed in systemd git, where we explicitly relabel the files we create from hostnamed.

Comment 4 Fedora Update System 2013-04-10 20:10:09 UTC
systemd-201-2.fc18.1 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/systemd-201-2.fc18.1

Comment 5 Fedora Update System 2013-04-11 23:23:14 UTC
Package systemd-201-2.fc18.2:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-201-2.fc18.2'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-5452/systemd-201-2.fc18.2
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2013-04-15 23:57:53 UTC
Package systemd-201-2.fc18.4:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-201-2.fc18.4'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-5452/systemd-201-2.fc18.3
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2013-04-18 02:35:05 UTC
Package systemd-201-2.fc18.5:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-201-2.fc18.5'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-5452/systemd-201-2.fc18.5
then log in and leave karma (feedback).

Comment 8 Fedora Update System 2013-05-07 13:37:32 UTC
systemd-201-2.fc18.6 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/FEDORA-2013-5452/systemd-201-2.fc18.6

Comment 9 Fedora Update System 2013-05-09 10:00:27 UTC
Package systemd-201-2.fc18.6:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-201-2.fc18.6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-5452/systemd-201-2.fc18.6
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2013-05-16 02:56:25 UTC
systemd-201-2.fc18.6 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 smanne 2018-09-19 18:43:53 UTC
Folks,

these answers are not helpful and there are multiple other bugs opened for the same issue.

Below is the fix that worked for me.

from the below output of systemctl status command, I noticed that /tmp was not mounted with proper acls.

sudo-sh[root@myhost]# hostnamectl set-hostname --static $dnsname
Could not set property: Connection timed out
sudo-sh[root@myhost]# hostnamectl set-hostname poc-rhel-cassandra-b1
Could not set property: Failed to activate service 'org.freedesktop.hostname1': timed out



sudo-sh[root@myhost]# systemctl status systemd-hostnamed
● systemd-hostnamed.service - Hostname Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-hostnamed.service; static; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:systemd-hostnamed.service(8)
           man:hostname(5)
           man:machine-info(5)
           http://www.freedesktop.org/wiki/Software/systemd/hostnamed

Sep 19 13:52:53 myhost systemd[1]: Dependency failed for Hostname Service.
Sep 19 13:52:53 myhost systemd[1]: Job systemd-hostnamed.service/start failed with result 'dependency'.
Sep 19 13:54:02 myhost systemd[1]: Dependency failed for Hostname Service.
Sep 19 13:54:02 myhost systemd[1]: Job systemd-hostnamed.service/start failed with result 'dependency'.
Sep 19 13:55:18 myhost systemd[1]: Dependency failed for Hostname Service.
Sep 19 13:55:18 myhost systemd[1]: Job systemd-hostnamed.service/start failed with result 'dependency'.

sudo-sh[root@myhost]# systemctl restart systemd-hostnamed
A dependency job for systemd-hostnamed.service failed. See 'journalctl -xe' for details.
sudo-sh[root@myhost]# journalctl -xe
-- Unit user-0.slice has finished shutting down.
Sep 19 13:56:01 myhost systemd[1]: Stopping User Slice of root.
-- Subject: Unit user-0.slice has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has begun shutting down.
Sep 19 13:56:03  sudo-sh[12198]: ec2-user : HOST=myhost : TTY=pts/0 ; PWD=/home/ec2-user ; USER=root ; SUDO-SH-COMMAND=systemctl
Sep 19 13:56:29  sudo-sh[12199]: ec2-user : HOST=myhost : TTY=pts/0 ; PWD=/home/ec2-user ; USER=root ; SUDO-SH-COMMAND=systemctl
Sep 19 13:56:29  polkitd[624]: Registered Authentication Agent for unix-process:12199:22680 (system bus name :1.39 [/usr/bin/pkttyagent --
Sep 19 13:56:29  systemd[1]: Mounting /var/tmp...
-- Subject: Unit var-tmp.mount has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit var-tmp.mount has begun starting up.
Sep 19 13:56:29  mount[12205]: mount:  /tmp is not a block device
Sep 19 13:56:29  systemd[1]: var-tmp.mount mount process exited, code=exited status=32
Sep 19 13:56:29  systemd[1]: Failed to mount /var/tmp.
-- Subject: Unit var-tmp.mount has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit var-tmp.mount has failed.
--
-- The result is failed.
Sep 19 13:56:29  systemd[1]: Dependency failed for Hostname Service.
-- Subject: Unit systemd-hostnamed.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-hostnamed.service has failed.
--
-- The result is dependency.
Sep 19 13:56:29  systemd[1]: Job systemd-hostnamed.service/start failed with result 'dependency'.
Sep 19 13:56:29  systemd[1]: Unit var-tmp.mount entered failed state.
Sep 19 13:56:29  polkitd[624]: Unregistered Authentication Agent for unix-process:12199:22680 (system bus name :1.39, object path /org/fre
Sep 19 13:56:36  sudo-sh[12207]: ec2-user : HOST=myhost : TTY=pts/0 ; PWD=/home/ec2-user ; USER=root ; SUDO-SH-COMMAND=journalctl



to resolve this issue, I edited /etc/fstab and changed the /tmp acls.

Before
#/tmp /var/tmp auto rw,nodev,nofail,nosuid,relatime 0 0

After
/tmp /var/tmp auto bind 0 0


make sure to make a copy of your original fstab file before editing, then restart the server.

Now hostname service started fine.

sudo-sh[root@myhost]# systemctl status systemd-hostnamed
● systemd-hostnamed.service - Hostname Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-hostnamed.service; static; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:systemd-hostnamed.service(8)
           man:hostname(5)
           man:machine-info(5)
           http://www.freedesktop.org/wiki/Software/systemd/hostnamed

Sep 19 14:16:45  systemd[1]: Starting Hostname Service...
Sep 19 14:16:45  systemd[1]: Started Hostname Service.

Also hostnamectl set-hostname command worked as expected.

sudo-sh[root@myhost]# dnsname=`ifconfig eth0|grep netmask|awk '{print $2}'|while read addr; do host $addr|awk '{print $NF}'|sed 's/.$//'; done`
sudo-sh[root@myhost]# hostnamectl set-hostname --static $dnsname
sudo-sh[root@myhost]# hostnamectl status|grep Static
   Static hostname: poc-rhel-cassandra-b1


Note You need to log in before you can comment on or make changes to this bug.