Bug 781737

Summary: ntp-4.2.6p4-1.fc17.i686 cannot install because user ntp is not present
Product: [Fedora] Fedora Reporter: Wendell Baker <wendellcraigbaker>
Component: shadow-utilsAssignee: Peter Vrabec <pvrabec>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mlichvar, pertusus, pvrabec, tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-11 08:39:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Wendell Baker 2012-01-14 18:39:23 UTC
Description of problem:

ntp service will not start because the ntp user and group do not exist.

from /var/log/messages
Jan 12 11:11:32 spillage ntpd[30491]: Cannot find user `ntp'
Jan 12 11:11:32 spillage systemd[1]: ntpd.service: main process exited, code=exited, status=255
Jan 12 11:11:32 spillage systemd[1]: Unit ntpd.service entered failed state.


Version-Release number of selected component (if applicable):

ntp-4.2.6p4-1.fc17.i686

How reproducible:

yes.

Steps to Reproduce:
1. install rawhide
2. systemctl start ntpd.service
3.
  
Actual results:

Jan 14 09:26:21 spillage ntpd[1074]: ntpd 4.2.6p4 Thu Oct  6 15:35:00 UTC 2011 (1)
Jan 14 09:26:21 spillage dhclient[982]: bound to 192.168.0.81 -- renewal in 820 seconds.
Jan 14 09:26:21 spillage ntpd[1074]: proto: precision = 7.543 usec
Jan 14 09:26:21 spillage ntpd[1074]: 0.0.0.0 c01d 0d kern kernel time sync enabled
Jan 14 09:26:21 spillage ntpd[1074]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Jan 14 09:26:21 spillage ntpd[1074]: Listen and drop on 1 v6wildcard :: UDP 123
Jan 14 09:26:21 spillage ntpd[1074]: Listen normally on 2 lo 127.0.0.1 UDP 123
Jan 14 09:26:21 spillage ntpd[1074]: Listen normally on 3 em1 192.168.0.81 UDP 123
Jan 14 09:26:21 spillage ntpd[1074]: Listen normally on 4 em1 fe80::20b:5dff:fe54:ced4 UDP 123
Jan 14 09:26:21 spillage ntpd[1074]: Listen normally on 5 lo ::1 UDP 123
Jan 14 09:26:21 spillage ntpd[1074]: peers refreshed
Jan 14 09:26:21 spillage ntpd[1074]: Listening on routing socket on fd #22 for interface updates
Jan 14 09:26:21 spillage ntpd[1074]: 0.0.0.0 c016 06 restart
Jan 14 09:26:21 spillage ntpd[1074]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM
Jan 14 09:26:21 spillage ntpd[1074]: 0.0.0.0 c011 01 freq_not_set
Jan 14 09:26:21 spillage ntpd[1074]: Cannot find user `ntp'


Expected results:

ntp starts as per usual

Additional info:


See also https://bugzilla.redhat.com/show_bug.cgi?id=771449

Because useradd cannot lock /etc/passwd, users cannot be created.


Reinstalling exhibits the problem.

[root@spillage network-scripts]# yum reinstall -y ntp
Loaded plugins: langpacks, presto, refresh-packagekit
Setting up Reinstall Process
Resolving Dependencies
--> Running transaction check
---> Package ntp.i686 0:4.2.6p4-1.fc17 will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package       Arch           Version                   Repository         Size
================================================================================
Reinstalling:
 ntp           i686           4.2.6p4-1.fc17            rawhide           583 k

Transaction Summary
================================================================================
Reinstall  1 Package

Total download size: 583 k
Installed size: 1.8 M
Downloading Packages:
http://mirror.pnl.gov/fedora/linux/development/rawhide/i386/os/Packages/ntp-4.2.6p4-1.fc17.i686.rpm: [Errno 14] curl#52 - "<Unknown>"
Trying other mirror.
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ntp-4.2.6p4-1.fc17.i686                                      1/1 
warning: group ntp does not exist - using root
warning: user ntp does not exist - using root
warning: group ntp does not exist - using root
warning: user ntp does not exist - using root
warning: group ntp does not exist - using root
  Verifying  : ntp-4.2.6p4-1.fc17.i686                                      1/1 

Installed:
  ntp.i686 0:4.2.6p4-1.fc17                                                     

Complete!





Creating the ntp user manually is a workaround

[root@spillage network-scripts]# groupadd -g 38 ntp
[root@spillage network-scripts]# useradd -u 38 -g ntp -d /etc/ntp -s /sbin/nologin ntp
useradd: cannot open /etc/passwd
[root@spillage network-scripts]# vipw
You have modified /etc/passwd.
You may need to modify /etc/shadow for consistency.
Please use the command 'vipw -s' to do so.
[root@spillage network-scripts]# vipw -s
You have modified /etc/shadow.
You may need to modify /etc/passwd for consistency.
Please use the command 'vipw' to do so.
[root@spillage network-scripts]# grep ^ntp: /etc/passwd /etc/shadow /etc/group /etc/gshadow
/etc/passwd:ntp:x:38:38::/etc/ntp:/sbin/nologin
/etc/shadow:ntp:!!:15341::::::
/etc/group:ntp:x:38:
/etc/gshadow:ntp:!::



[root@spillage network-scripts]# yum reinstall -y ntp
Loaded plugins: langpacks, presto, refresh-packagekit
Setting up Reinstall Process
Resolving Dependencies
--> Running transaction check
---> Package ntp.i686 0:4.2.6p4-1.fc17 will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package       Arch           Version                   Repository         Size
================================================================================
Reinstalling:
 ntp           i686           4.2.6p4-1.fc17            rawhide           583 k

Transaction Summary
================================================================================
Reinstall  1 Package

Total download size: 583 k
Installed size: 1.8 M
Downloading Packages:
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ntp-4.2.6p4-1.fc17.i686                                      1/1 
  Verifying  : ntp-4.2.6p4-1.fc17.i686                                      1/1 

Installed:
  ntp.i686 0:4.2.6p4-1.fc17                                                     

Complete!


It was unstartable, now with the ntp user it is startable

[root@spillage network-scripts]# systemctl status ntpd.service
ntpd.service - Network Time Service
	  Loaded: loaded (/lib/systemd/system/ntpd.service; enabled)
	  Active: failed since Sat, 14 Jan 2012 09:26:21 -0800; 25min ago
	Main PID: 1074 (code=exited, status=255)
	  CGroup: name=systemd:/system/ntpd.service

[root@spillage network-scripts]# systemctl restart ntpd.service
[root@spillage network-scripts]# systemctl status ntpd.service
ntpd.service - Network Time Service
	  Loaded: loaded (/lib/systemd/system/ntpd.service; enabled)
	  Active: active (running) since Sat, 14 Jan 2012 09:51:56 -0800; 2s ago
	Main PID: 1680 (ntpd)
	  CGroup: name=systemd:/system/ntpd.service
		  └ 1680 /usr/sbin/ntpd -n -u ntp:ntp -g

Comment 1 Miroslav Lichvar 2012-01-17 15:55:55 UTC
The ntp user is created in the ntpdate package. If useradd fails, there is not much we can do here. Reassigning to shadow-utils.

Comment 2 Wendell Baker 2012-01-24 17:55:33 UTC
From https://bugzilla.redhat.com/show_bug.cgi?id=771449

The workaround developed (for rawhide) therein was:
bash-4.2$ sudo /sbin/restorecon -v -v -R /etc/{passwd,passwd-,group,shadow,gshadow}
/sbin/restorecon reset /etc/passwd- context system_u:object_r:etc_t:s0->system_u:object_r:passwd_file_t:s0


Yet the user ntp still wasn't created on 'yum reinstall -y ntp ntpdate'

bash-4.2$ rpm -q --scripts ntpdatepreinstall scriptlet (using /bin/sh):
/usr/sbin/groupadd -g 38 ntp  2> /dev/null || :
/usr/sbin/useradd -u 38 -g 38 -s /sbin/nologin -M -r -d /etc/ntp ntp 2>/dev/null || :


Perhaps ignoring errors and stderr away to /dev/null isn't a great idea.


For completeness, here's the full log of what I did to get to Happy.

(first installing only ntp, but then reinstalling ntp and ntpdate, then manually creating the user and group after doing the restorecon indicated in 771449)

bash-4.2$ sudo yum reinstall -y ntp | sudo tee -a /tmp/o.yum_install.out
Loaded plugins: langpacks, presto, refresh-packagekit
Setting up Reinstall Process
Resolving Dependencies
--> Running transaction check
---> Package ntp.i686 0:4.2.6p4-2.fc17 will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package       Arch           Version                   Repository         Size
================================================================================
Reinstalling:
 ntp           i686           4.2.6p4-2.fc17            rawhide           582 k

Transaction Summary
================================================================================
Reinstall  1 Package

Total download size: 582 k
Installed size: 1.8 M
Downloading Packages:
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ntp-4.2.6p4-2.fc17.i686                                      1/1 
warning: group ntp does not exist - using root
warning: user ntp does not exist - using root
warning: group ntp does not exist - using root
warning: user ntp does not exist - using root
warning: group ntp does not exist - using root
  Verifying  : ntp-4.2.6p4-2.fc17.i686                                      1/1 

Installed:
  ntp.i686 0:4.2.6p4-2.fc17                                                     

Complete!
bash-4.2$ finger ntp
finger: ntp: no such user.

(understood that this is the wrong package to query)
bash-4.2$ rpm -q --scripts ntp
postinstall scriptlet (using /bin/sh):
/bin/systemctl daemon-reload &> /dev/null || :
preuninstall scriptlet (using /bin/sh):
if [ "$1" -eq 0 ]; then
	/bin/systemctl --no-reload disable ntpd.service &> /dev/null
	/bin/systemctl stop ntpd.service &> /dev/null
fi
:
postuninstall scriptlet (using /bin/sh):
/bin/systemctl daemon-reload &> /dev/null
if [ "$1" -ge 1 ]; then
	/bin/systemctl try-restart ntpd.service &> /dev/null
fi
:
bash-4.2$ rpm -q ntp
ntp-4.2.6p4-2.fc17.i686


bash-4.2$ sudo yum reinstall -y ntp ntpdate | sudo tee -a /tmp/o.yum_install.out 
Loaded plugins: langpacks, presto, refresh-packagekit
Setting up Reinstall Process
Resolving Dependencies
--> Running transaction check
---> Package ntp.i686 0:4.2.6p4-2.fc17 will be reinstalled
---> Package ntpdate.i686 0:4.2.6p4-2.fc17 will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package          Arch          Version                  Repository        Size
================================================================================
Reinstalling:
 ntp              i686          4.2.6p4-2.fc17           rawhide          582 k
 ntpdate          i686          4.2.6p4-2.fc17           rawhide           74 k

Transaction Summary
================================================================================
Reinstall  2 Packages

Total download size: 656 k
Installed size: 1.9 M
Downloading Packages:
--------------------------------------------------------------------------------
Total                                           465 kB/s | 656 kB     00:01     
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ntpdate-4.2.6p4-2.fc17.i686                                  1/2 
  Installing : ntp-4.2.6p4-2.fc17.i686                                      2/2 
warning: group ntp does not exist - using root
warning: user ntp does not exist - using root
warning: group ntp does not exist - using root
warning: user ntp does not exist - using root
warning: group ntp does not exist - using root
  Verifying  : ntp-4.2.6p4-2.fc17.i686                                      1/2 
  Verifying  : ntpdate-4.2.6p4-2.fc17.i686                                  2/2 

Installed:
  ntp.i686 0:4.2.6p4-2.fc17            ntpdate.i686 0:4.2.6p4-2.fc17           

Complete!
bash-4.2$ finger ntp
finger: ntp: no such user.

bash-4.2$ rpm -q --scripts ntpdate
preinstall scriptlet (using /bin/sh):
/usr/sbin/groupadd -g 38 ntp  2> /dev/null || :
/usr/sbin/useradd -u 38 -g 38 -s /sbin/nologin -M -r -d /etc/ntp ntp 2>/dev/null || :
postinstall scriptlet (using /bin/sh):
/bin/systemctl daemon-reload &> /dev/null || :
preuninstall scriptlet (using /bin/sh):
if [ "$1" -eq 0 ]; then
	/bin/systemctl --no-reload disable ntpdate.service &> /dev/null
	/bin/systemctl stop ntpdate.service &> /dev/null
fi
:
bash-4.2$ sudo /sbin/restorecon -v -v -R /etc/{passwd,passwd-,group,shadow,gshadow}
/sbin/restorecon reset /etc/passwd- context system_u:object_r:etc_t:s0->system_u:object_r:passwd_file_t:s0
bash-4.2$ sudo yum reinstall -y ntp ntpdate | sudo tee -a /tmp/o.yum_install.out
Loaded plugins: langpacks, presto, refresh-packagekit
Setting up Reinstall Process
Resolving Dependencies
--> Running transaction check
---> Package ntp.i686 0:4.2.6p4-2.fc17 will be reinstalled
---> Package ntpdate.i686 0:4.2.6p4-2.fc17 will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package          Arch          Version                  Repository        Size
================================================================================
Reinstalling:
 ntp              i686          4.2.6p4-2.fc17           rawhide          582 k
 ntpdate          i686          4.2.6p4-2.fc17           rawhide           74 k

Transaction Summary
================================================================================
Reinstall  2 Packages

Total download size: 656 k
Installed size: 1.9 M
Downloading Packages:
--------------------------------------------------------------------------------
Total                                           643 kB/s | 656 kB     00:01     
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ntpdate-4.2.6p4-2.fc17.i686                                  1/2 
  Installing : ntp-4.2.6p4-2.fc17.i686                                      2/2 
warning: group ntp does not exist - using root
warning: user ntp does not exist - using root
warning: group ntp does not exist - using root
warning: user ntp does not exist - using root
warning: group ntp does not exist - using root
  Verifying  : ntp-4.2.6p4-2.fc17.i686                                      1/2 
  Verifying  : ntpdate-4.2.6p4-2.fc17.i686                                  2/2 

Installed:
  ntp.i686 0:4.2.6p4-2.fc17            ntpdate.i686 0:4.2.6p4-2.fc17           

Complete!
bash-4.2$ rpm -q --scripts ntpdate
preinstall scriptlet (using /bin/sh):
/usr/sbin/groupadd -g 38 ntp  2> /dev/null || :
/usr/sbin/useradd -u 38 -g 38 -s /sbin/nologin -M -r -d /etc/ntp ntp 2>/dev/null || :
postinstall scriptlet (using /bin/sh):
/bin/systemctl daemon-reload &> /dev/null || :
preuninstall scriptlet (using /bin/sh):
if [ "$1" -eq 0 ]; then
	/bin/systemctl --no-reload disable ntpdate.service &> /dev/null
	/bin/systemctl stop ntpdate.service &> /dev/null
fi
:
bash-4.2$ sudo /usr/sbin/groupadd -g 38 ntp
bash-4.2$ sudo /usr/sbin/useradd -u 38 -g 38 -s /sbin/nologin -M -r -d /etc/ntp ntp
bash-4.2$ sudo yum reinstall -y ntp ntpdate | sudo tee -a /tmp/o.yum_install.out
Loaded plugins: langpacks, presto, refresh-packagekit
Setting up Reinstall Process
Resolving Dependencies
--> Running transaction check
---> Package ntp.i686 0:4.2.6p4-2.fc17 will be reinstalled
---> Package ntpdate.i686 0:4.2.6p4-2.fc17 will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package          Arch          Version                  Repository        Size
================================================================================
Reinstalling:
 ntp              i686          4.2.6p4-2.fc17           rawhide          582 k
 ntpdate          i686          4.2.6p4-2.fc17           rawhide           74 k

Transaction Summary
================================================================================
Reinstall  2 Packages

Total download size: 656 k
Installed size: 1.9 M
Downloading Packages:
--------------------------------------------------------------------------------
Total                                           628 kB/s | 656 kB     00:01     
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ntpdate-4.2.6p4-2.fc17.i686                                  1/2 
  Installing : ntp-4.2.6p4-2.fc17.i686                                      2/2 
  Verifying  : ntp-4.2.6p4-2.fc17.i686                                      1/2 
  Verifying  : ntpdate-4.2.6p4-2.fc17.i686                                  2/2 

Installed:
  ntp.i686 0:4.2.6p4-2.fc17            ntpdate.i686 0:4.2.6p4-2.fc17           

Complete!

bash-4.2$ systemctl status ntpd.service
ntpd.service - Network Time Service
	  Loaded: loaded (/lib/systemd/system/ntpd.service; enabled)
	  Active: failed since Sat, 14 Jan 2012 10:30:30 -0800; 1 weeks and 2 days ago
	Main PID: 8705 (code=exited, status=255)
	  CGroup: name=systemd:/system/ntpd.service

bash-4.2$ sudo systemctl enable ntpd.service
bash-4.2$ sudo systemctl start ntpd.service
bash-4.2$ systemctl status ntpd.service
ntpd.service - Network Time Service
	  Loaded: loaded (/lib/systemd/system/ntpd.service; enabled)
	  Active: active (running) since Tue, 24 Jan 2012 09:52:33 -0800; 3s ago
	Main PID: 8682 (ntpd)
	  CGroup: name=systemd:/system/ntpd.service
		  └ 8682 /usr/sbin/ntpd -n -u ntp:ntp -g


Happy.

Comment 3 Tomas Mraz 2013-01-11 08:39:38 UTC

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