Bug 740669 - "service iptables save" command fails returning exit value 1
Summary: "service iptables save" command fails returning exit value 1
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: policycoreutils
Version: 6.2
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Daniel Walsh
QA Contact: Milos Malik
: 741371 741555 (view as bug list)
Depends On:
Blocks: 739953
TreeView+ depends on / blocked
Reported: 2011-09-22 21:34 UTC by Jan Pokorný [poki]
Modified: 2013-02-25 13:39 UTC (History)
5 users (show)

Fixed In Version: policycoreutils-2.0.83-19.16.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2011-12-06 15:31:19 UTC

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1637 normal SHIPPED_LIVE policycoreutils bug fix and enhancement update 2011-12-06 00:50:40 UTC

Description Jan Pokorný [poki] 2011-09-22 21:34:14 UTC
Version-Release number of selected component (if applicable):
iptables-1.4.7-4.el6.x86_64 @ RHEL 6.2 beta

Steps to Reproduce:
# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[FAILED]
# echo $?

Enforcing SELinux (selinux-policy-3.7.19-113.el6.noarch).

Comment 2 RHEL Product and Program Management 2011-09-22 22:08:05 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support

Comment 3 Jan Pokorný [poki] 2011-09-23 13:08:08 UTC
I have found out that the failure is caused by restorecon command in the block

> if [ $ret -eq 0 ]; then
>     mv -f $TMP_FILE $IPTABLES_DATA \
>         && chmod 600 $IPTABLES_DATA \
>         && restorecon $IPTABLES_DATA \
>         || ret=1
> fi

of save function.

If I do hard exit at this place echoing the necessary variables, run
"service iptables save" and run these 3 commands checking exit codes,
restorecon one will exit with 1.  Subsequently repeated restorecon
will succeed returning 0.

Therefore this bug may belong rather to policycoreutils[*].
I could not find any similar bug for this package.

# rpm -qf $(which restorecon)

Comment 4 Daniel Walsh 2011-09-23 15:33:34 UTC
This is a bug in restorecon.  restorecon should only exit with non zero is something failed.  Changing the label on a file is not a failure.

Comment 5 Daniel Walsh 2011-09-23 15:50:58 UTC
Fixed in policycoreutils-2.0.83-19.16.el6

Comment 6 Daniel Walsh 2011-09-26 18:02:20 UTC
*** Bug 741371 has been marked as a duplicate of this bug. ***

Comment 7 Petr Sklenar ⛄ 2011-09-27 10:21:52 UTC
*** Bug 741555 has been marked as a duplicate of this bug. ***

Comment 12 errata-xmlrpc 2011-12-06 15:31:19 UTC
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.