Bug 647311 - Can't set hostname
Can't set hostname
Status: CLOSED DUPLICATE of bug 648725
Product: Fedora
Classification: Fedora
Component: NetworkManager (Show other bugs)
13
x86_64 Linux
low Severity medium
: ---
: ---
Assigned To: Dan Williams
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-10-27 16:56 EDT by Clodoaldo Pinto Neto
Modified: 2011-02-25 18:24 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-02-25 18:24:55 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Clodoaldo Pinto Neto 2010-10-27 16:56:28 EDT
Although the hostname is set:

$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=d3.dkt

It is not set:

$ hostname
localhost.localdomain

$ cat /etc/hosts
127.0.0.1	localhost.localdomain	localhost
::1		localhost.localdomain	localhost6	localhost6.localdomain6	localhost
10.1.1.111	d3.dkt	d3
Comment 1 Jiri Popelka 2010-10-28 16:06:42 EDT
Do you use NetworkManager or network service ?
Comment 2 Clodoaldo Pinto Neto 2010-10-28 17:04:36 EDT
Not sure this answers it:

$ chkconfig --list | grep etwork
NetworkManager 	0:off	1:off	2:on	3:on	4:on	5:on	6:off
network        	0:off	1:off	2:off	3:off	4:off	5:off	6:off

Didn't touch these.
Comment 3 Jiri Popelka 2010-10-31 06:58:53 EDT
For me setting HOSTNAME in /etc/sysconfig/network works with NetworkManager.
Comment 4 Clodoaldo Pinto Neto 2011-02-17 10:58:44 EST
Another machine showed the same symptoms and I posted a thread at a forum:

http://forums.fedoraforum.org/showthread.php?t=258973

The proposed solution worked in both that case and also in this one.
Comment 5 Clodoaldo Pinto Neto 2011-02-17 11:00:25 EST
The SELinux message in that other machine:

SELinux is preventing /usr/sbin/NetworkManager from unlink access on the file /etc/hosts.

Additional Information:
Source Context                system_u:system_r:NetworkManager_t:s0
Target Context                unconfined_u:object_r:etc_t:s0
Target Objects                /etc/hosts [ file ]
Source                        NetworkManager
Source Path                   /usr/sbin/NetworkManager
Port                          <Unknown>
Host                          localhost.localdomain
Source RPM Packages           NetworkManager-0.8.1-10.git20100831.fc13
Target RPM Packages           setup-2.8.20-1.fc13
Policy RPM                    selinux-policy-3.7.19-80.fc13
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     cl.dkt
Platform                      Linux cl.dkt 2.6.34.7-66.fc13.x86_64 #1 SMP Wed
                              Dec 15 07:04:30 UTC 2010 x86_64 x86_64
Alert Count                   24
First Seen                    Mon 14 Feb 2011 07:01:43 PM BRST
Last Seen                     Tue 15 Feb 2011 12:03:32 PM BRST
Local ID                      6d5273e2-0cb1-439a-b6c4-131a768295f4

Raw Audit Messages
type=AVC msg=audit(1297778612.157:28615): avc:  denied  { unlink } for  pid=1603 comm="NetworkManager" name="hosts" dev=dm-1 ino=1968520 scontext=system_u:system_r:NetworkManager_t:s0 tcontext=unconfined_u:object_r:etc_t:s0 tclass=file


type=SYSCALL msg=audit(1297778612.157:28615): arch=x86_64 syscall=rename success=no exit=EACCES a0=1d85e00 a1=48b7b9 a2=1d5a180 a3=1 items=0 ppid=1 pid=1603 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=NetworkManager exe=/usr/sbin/NetworkManager subj=system_u:system_r:NetworkManager_t:s0 key=(null)

Hash: NetworkManager,NetworkManager_t,etc_t,file,unlink

audit2allow

#============= NetworkManager_t ==============
allow NetworkManager_t etc_t:file unlink;

audit2allow -R

#============= NetworkManager_t ==============
allow NetworkManager_t etc_t:file unlink;
Comment 6 Dan Williams 2011-02-25 18:24:55 EST
NM no longer touches /etc/hosts.

*** This bug has been marked as a duplicate of bug 648725 ***

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