Bug 712254

Summary: The load selinux policy message are garbled characters in LANG=ja_JP.UTF-8 system.
Product: Red Hat Enterprise Linux 6 Reporter: Haruo Tomita <haruo.tomita>
Component: dracutAssignee: Harald Hoyer <harald>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: atodorov, pknirsch, rwilliam
Target Milestone: beta   
Target Release: 6.2   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
When turning on selinux from inside the initramfs, the selinux commands used the locale specified for the system. But because the terminal is not yet ready for the locale in the initramfs, the resulting output of the selinux commands was garbled for locales, which differ in fonts to the default linux console. The new dracut initramfs now turns of localization for the selinux commands, which results in readable english messages. The initramfs is not localized anyway.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 16:48:04 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:
Attachments:
Description Flags
garbled screen
none
These are bogl packages used to test. none

Description Haruo Tomita 2011-06-10 00:29:13 UTC
Created attachment 504003 [details]
garbled screen

Description of problem:
Using Japanese ja_JP.UTF-8 environment, 
the characters in load selinux policy message are garbled.

Version-Release number of selected component (if applicable):
dracut-004-53.el6

How reproducible:
always

Steps to Reproduce:
for example
1. Using Japanese ja_JP.UTF-8
2. SELinux is disabled
3. boot
  
Actual results:
Please see attached file(dracut-004-53.el6-selinux-loadpolycy-garbled.JPG)

Expected results:
Do not garble.

Additional info:
I think the languages other than Japanese to be garbled. 
For instance, it is Chinese.

Comment 1 Haruo Tomita 2011-06-10 00:37:57 UTC
Japanese cannot be displayed with the console in RHEL6.0/6.1. 
I think that it is because bogl packages became unsupported in RHEL6.
I have two plans for this issue.

Comment 2 Haruo Tomita 2011-06-10 00:39:37 UTC
Plan A :

This simple patch mainly adds force LANG=C to selinux load policy.

--- modules.d/99base/selinux-loadpolicy.sh.orig 2011-06-08 15:47:57.698559649 +0900
+++ modules.d/99base/selinux-loadpolicy.sh      2011-06-08 15:48:25.456746330 +0900
@@ -1,6 +1,11 @@
 #!/bin/sh
 # FIXME: load selinux policy.  this should really be done after we switchroot

+# We can't Japanese on normal console at boot time, so force LANG=C.
+if [ "$LANG" = "ja_JP.UTF-8" ]; then
+    LANG=C
+fi
+
 rd_load_policy()
 {
     # If SELinux is disabled exit now

Comment 4 Haruo Tomita 2011-06-10 00:50:37 UTC
Plan B: support bogl packages.

Uusing the source of bogl of FC15 Rawhide, Japanese was able to be displayed with RHEL6.1.

Comment 5 Haruo Tomita 2011-06-10 00:56:18 UTC
Created attachment 504004 [details]
These are bogl packages used to test.

Using bterm, the garble of dmesg is solved.

Comment 6 Harald Hoyer 2011-06-17 10:43:54 UTC
I am tending to use LANG=C, because all the rest is not translated anyway.

Comment 7 RHEL Program Management 2011-06-17 11:00:24 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux maintenance release. Product Management has 
requested further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed 
products. This request is not yet committed for inclusion in an Update release.

Comment 8 Haruo Tomita 2011-06-19 22:14:55 UTC
(In reply to comment #6)
> I am tending to use LANG=C, because all the rest is not translated anyway.

I think that LANG=C is good in the default setting.
I think that a Japanese check of the patch is unnecessary.

Comment 9 Harald Hoyer 2011-08-10 13:34:00 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
When turning on selinux from inside the initramfs, the selinux commands used the locale specified for the system. But because the terminal is not yet ready for the locale in the initramfs, the resulting output of the selinux commands was garbled for locales, which differ in fonts to the default linux console. The new dracut initramfs now turns of localization for the selinux commands, which results in readable english messages. The initramfs is not localized anyway.

Comment 11 Alexander Todorov 2011-10-13 15:03:07 UTC
# grep load_policy selinux-loadpolicy.sh 
rd_load_policy()
    if [ -x "$NEWROOT/usr/sbin/load_policy" -o -x "$NEWROOT/sbin/load_policy" ]; then
        # load_policy does mount /proc and /selinux in 
        # libselinux,selinux_init_load_policy()
        if [ -x "$NEWROOT/sbin/load_policy" ]; then
            out=$(LANG=C chroot "$NEWROOT" /sbin/load_policy -i 2>&1)
	    out=$(LANG=C chroot "$NEWROOT" /usr/sbin/load_policy -i 2>&1)
	die "Machine in enforcing mode and cannot execute load_policy. To disable selinux, add selinux=0 to the kernel command line."
rd_load_policy

# rpm -qf selinux-loadpolicy.sh 
dracut-004-247.el6.noarch


The actual command execution is prefixed with LANG=C. Moving to VERIFIED.

Comment 12 errata-xmlrpc 2011-12-06 16:48:04 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.

http://rhn.redhat.com/errata/RHBA-2011-1521.html