Bug 814427 - Unexpected /sbin/securetty failure with read-only root file system
Unexpected /sbin/securetty failure with read-only root file system
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: initscripts (Show other bugs)
x86_64 Linux
low Severity low
: rc
: ---
Assigned To: Lukáš Nykrýn
Depends On:
  Show dependency treegraph
Reported: 2012-04-19 16:38 EDT by Rick Mohr
Modified: 2016-11-25 08:05 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Securetty always tries to open file /etc/securetty read/write mode Consequence: On readonly root filesystem this leads to failure even if the tty already exists, thus file won't be changed Fix: Check if the file really needs to be edited, if not, just exit correctly. Result: Securetty should now work correctly with readonly root.
Story Points: ---
Clone Of:
Last Closed: 2013-11-21 17:09:51 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
lightly tested patch (1.65 KB, patch)
2012-04-19 17:05 EDT, Bill Nottingham
no flags Details | Diff
better patch (2.93 KB, patch)
2012-04-19 17:09 EDT, Bill Nottingham
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1679 normal SHIPPED_LIVE initscripts bug fix and enhancement update 2013-11-20 16:52:39 EST

  None (edit)
Description Rick Mohr 2012-04-19 16:38:59 EDT
Description of problem:

During startup, a host with a read-only NFS root file system triggers /etc/init/serial.conf which attempts to run "/sbin/securetty ttyS0".  Even though "ttyS0" already exists in the /etc/securetty file, the command fails with the following error:

securetty: Couldn't open /etc/securetty: Permission denied

The permissions are correct, and the root user can successfully run "cat /etc/securetty".

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


How reproducible:

Steps to Reproduce:
1. Boot system with read-only root file system
2. Run "/sbin/securetty $DEV" where $DEV is a device name that already exists in /etc/securetty.
Actual results:

Command failure (rc=1)

Expected results:

Command should succeed. Because the device already exists in /etc/securetty, the file does not need to be modified.

Additional info:

Looking at the source code, it appears that /sbin/securetty attempts to open /etc/securetty in read-write mode before even checking if the file needs to be modified.  If the root file system is mounted read-only, the results in a failure.  A better approach would be to check if the file needs to be modified, and if not, exit with rc=0.
Comment 2 Bill Nottingham 2012-04-19 17:05:17 EDT
Created attachment 578786 [details]
lightly tested patch

Here's a lightly tested patch to do just that.
Comment 3 Bill Nottingham 2012-04-19 17:09:45 EDT
Created attachment 578789 [details]
better patch

And a better one that removes the now-obsolete check in rewrite_securetty.
Comment 5 RHEL Product and Program Management 2012-07-10 04:35:54 EDT
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Comment 6 RHEL Product and Program Management 2012-07-10 19:25:59 EDT
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.
Comment 14 David Mansfield 2013-09-10 16:08:59 EDT
this never made 6.4 as far as I can tell. I have the exact same problem.
Comment 15 Lukáš Nykrýn 2013-09-11 02:26:47 EDT
No, this will be fixed in 6.5.
Comment 17 errata-xmlrpc 2013-11-21 17:09:51 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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