policycoreutils: fixfiles: failure to create /.autorelabel is fatal
diff mbox

Message ID 20180512124309.26362-1-alan.christopher.jenkins@gmail.com
State Not Applicable
Headers show

Commit Message

Alan Jenkins May 12, 2018, 12:43 p.m. UTC
Fix the following ambiguous output (from booting with init=/bin/sh):

    # /usr/sbin/fixfiles onboot
    /usr/sbin/fixfiles: line 313: /.autorelabel: Read-only file system
    /usr/sbin/fixfiles: line 317: /.autorelabel: Read-only file system
    System will relabel on next boot

System will not relabel on next boot if we couldn't create ./autorelabel

(In case anyone reading this description is still confused: To run
`fixfiles onboot` after booting with init=/bin/sh, you must first run
`mount / -oremount,rw`).
---
 policycoreutils/scripts/fixfiles | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stephen Smalley May 15, 2018, 5:52 p.m. UTC | #1
On 05/12/2018 08:43 AM, Alan Jenkins wrote:
> Fix the following ambiguous output (from booting with init=/bin/sh):
> 
>     # /usr/sbin/fixfiles onboot
>     /usr/sbin/fixfiles: line 313: /.autorelabel: Read-only file system
>     /usr/sbin/fixfiles: line 317: /.autorelabel: Read-only file system
>     System will relabel on next boot
> 
> System will not relabel on next boot if we couldn't create ./autorelabel
> 
> (In case anyone reading this description is still confused: To run
> `fixfiles onboot` after booting with init=/bin/sh, you must first run
> `mount / -oremount,rw`).

Thanks, applied.

> ---
>  policycoreutils/scripts/fixfiles | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/policycoreutils/scripts/fixfiles b/policycoreutils/scripts/fixfiles
> index 0eeeea46..69bd8488 100755
> --- a/policycoreutils/scripts/fixfiles
> +++ b/policycoreutils/scripts/fixfiles
> @@ -309,7 +309,7 @@ case "$1" in
>  	    usage
>  	    exit 1
>  	fi
> -	> /.autorelabel
> +	> /.autorelabel || exit $?
>  	[ -z "$FORCEFLAG" ] || echo -n "$FORCEFLAG " >> /.autorelabel
>  	[ -z "$BOOTTIME" ] || echo -N $BOOTTIME >> /.autorelabel
>  	# Force full relabel if / does not have a label on it
>

Patch
diff mbox

diff --git a/policycoreutils/scripts/fixfiles b/policycoreutils/scripts/fixfiles
index 0eeeea46..69bd8488 100755
--- a/policycoreutils/scripts/fixfiles
+++ b/policycoreutils/scripts/fixfiles
@@ -309,7 +309,7 @@  case "$1" in
 	    usage
 	    exit 1
 	fi
-	> /.autorelabel
+	> /.autorelabel || exit $?
 	[ -z "$FORCEFLAG" ] || echo -n "$FORCEFLAG " >> /.autorelabel
 	[ -z "$BOOTTIME" ] || echo -N $BOOTTIME >> /.autorelabel
 	# Force full relabel if / does not have a label on it