Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1096830

Summary: setregdomain fail when localtime is not a link and /etc/sysconfig/regdomain does not exist or COUNTRY is undefined
Product: Red Hat Enterprise Linux 7 Reporter: Karel Volný <kvolny>
Component: crdaAssignee: John W. Linville <linville>
Status: CLOSED ERRATA QA Contact: Ken Benoit <kbenoit>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: bblaskov, emcnabb, kvolny
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 03:43:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Karel Volný 2014-05-12 13:51:30 UTC
Filed from caserun https://tcms.engineering.redhat.com/run/118979/#caserun_5066159

Version-Release number of selected component (if applicable):
crda-1.1.3_2013.11.27-5.el7.x86_64

Steps to Reproduce: 
run /CoreOS/crda/Regression/bz1071983-regulatory-domain-no-longer-get-set


Actual results: 
:: [   PASS   ] :: Copying /usr/share/zoneinfo/Asia/Shanghai to /etc/localtime (Expected 0, got 0)
:: [   PASS   ] :: Running 'logger 'bz1071983-marker-copy'' (Expected 0, got 0)
:: [ 13:46:08 ] :: [ INFO    ] :: rlRun: command = 'setregdomain'; exitcode = 0; expected = 0
:: [   PASS   ] :: Trying 'setregdomain' (Expected 0, got 0)
:: [   PASS   ] :: File '/var/tmp/tmp.mHy25RLHAs' should not contain 'unable' 
May  7 01:46:08 intel-sugarbay-do-01 logger: bz1071983-marker-copy
:: [   FAIL   ] :: File 'copy.log' should contain 'Calling CRDA for country: CN' 
:: [   PASS   ] :: File 'copy.log' should not contain 'world' 
:: [   FAIL   ] :: ChiNa should be set (Assert: US should equal CN)

Expected results:
all pass


Additional information:
while this scenario is not standard, Fedora/RHEL tools set the zone as symlink, it still seems to be used in the wild, for whatever reasons ... if we do not want to support having a copy (hardlink?) of the zone file, let's say it explicitly - filing this bug as I haven't found any such clear statement

and marking as blocking bug #1096818 as this triggers one of the cases described in that bug, fixing this would mean that the second case wouldn't be triggered

Comment 1 John W. Linville 2014-07-28 15:15:34 UTC
Setting devel_ack back to '?' as I did not understand the original description...  Are you saying you just copied the timezone file over to /etc/localtime?  How do you expect me to derive the original timezone info from that?

Comment 2 John W. Linville 2014-07-28 17:14:35 UTC
If someone wants to do this, they will just need to create a file called  "/etc/sysconfig/regdomain" with a "COUNTRY=" line in it.

Comment 3 RHEL Program Management 2014-07-28 17:25:50 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.

Comment 4 Karel Volný 2014-11-05 11:11:50 UTC
(In reply to John W. Linville from comment #1)
> Are you saying you just copied the timezone file over to /etc/localtime?

yes

> How do you expect me to derive the original timezone info from that?

I don't know :-)

so I read this as an official statement that it is not supported this way; I'll modify the test to expect failure in this scenario

but in that case, please let me reopen and make it docs bug

I'd suggest extending the man page, something like this:


NAME
       setregdomain - set regulatory domain based on country or timezone information

SYNOPSIS
       setregdomain

DESCRIPTION
       setregdomain sets the regulatory domain for your system; it takes no arguments and is normally called via system script (eg, udev) rather than manually by an adminstrator.
       The regulatory domain is set as ISO / IEC 3166 alpha2 country code value to 'COUNTRY' variable defined in /etc/sysconfig/regdomain. If that is unavailable, setregdomain falls back to determining country information from system time zone. For this to work, /etc/localtime has to be a symlink to a tzfile under /usr/share/zoneinfo/ associated to a country via zone.tab file.

FILES
       /etc/sysconfig/regdomain
       /etc/localtime

SEE ALSO
       iw(1)

Comment 5 Karel Volný 2014-11-05 11:32:36 UTC
and while at it, the error message

"Timezone information not set!  Unable to set regulatory domain."

is misleading in this case, the zone is set but cannot be used, I'd suggest

"Could not determine time zone!  Unable to set regulatory domain."

and there should be nonzero exit code

Comment 6 Karel Volný 2014-11-05 15:35:12 UTC
now I've noticed a typo ...

adminstrator => administrator

Comment 7 John W. Linville 2014-11-19 16:25:29 UTC
What (if any) objections do you have to the following man page text?

segregdomain(1)                  User Commands                 segregdomain(1)



NAME
       setregdomain - set regulatory domain based on country code

SYNOPSIS
       setregdomain

DESCRIPTION
       setregdomain  sets  the  regulatory domain for your system; it takes no
       arguments and is normally called via system script  (eg,  udev)  rather
       than manually by an administrator.

       The  regulatory  domain  is  represented  by an ISO / IEC 3166-1 alpha2
       country code.  By  default,  setregdomain  attempts  to  determine  the
       appropriate  country code by examining the target of the /etc/localtime
       symbolic link.  That information is used to look-up the matching  coun‐
       try code in the /usr/share/zoneinfo/zone.tab file. 

       The  country  code  lookup  may  fail.   This could be due to faulty or
       incomplete information in the /usr/share/zoneinfo/zone.tab file, or the
       use  of an actual file rather than a symlink for /etc/localtime , among 
       other possibilities.  In those cases the  system  administrator  should
       define  a  COUNTRY environment variable in the /etc/sysconfig/regdomain
       file.  This value will be used as the country code and the country code
       look-up will be skipped.

FILES
       /etc/sysconfig/regdomain /etc/localtime /usr/share/zoneinfo/zone.tab

SEE ALSO 
       iw(1)



CRDA                              2014-11-19                   segregdomain(1)

Comment 8 Branislav Blaškovič 2015-01-06 08:58:01 UTC
John, the text looks sane for me but I am missing description of exit codes.

Comment 9 Karel Volný 2015-01-06 09:05:54 UTC
(In reply to John W. Linville from comment #7)
> What (if any) objections do you have to the following man page text?

looks good to me (better than #c4, FTR), thanks

I've asked colleagues for independent review (as I already know the sources ...), so there's some more feedback ^ (#c8)

Comment 10 John W. Linville 2015-04-21 19:04:18 UTC
*** Bug 1166718 has been marked as a duplicate of this bug. ***

Comment 12 Ken Benoit 2015-06-15 17:43:29 UTC
Verified that the new manpage test matches that provided in comment 7. Tested using RHEL-7.2-20150612.n.1.

Comment 14 errata-xmlrpc 2015-11-19 03:43: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.

https://rhn.redhat.com/errata/RHBA-2015-2186.html