SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've searched high and low, but failed to find a definitive answer to this.....
I'm running 64 -current on a laptop, and using network manager for convenience when I'm on the move. When I boot the machine, I can see a message scroll through setting the default (00!) frequencies for the wifi card.
I can set the correct (GB) region for my location using the following line in rc.local:
Code:
iw reg set GB
This works, whether the wifi card is "on" or "off" when I log in.
However, I now see TWO messages during boot - the first setting a default region, then my script re-setting it to GB!
I have so far been unable to locate where the "default" setting is coming from. It doesn't seem to be in any of the scripts in /etc/rc.d
Ideally, I would like to find where this default is being set, and change it to GB. But WHERE is it???
I know its trivial, and I've worked around it. But its annoying me that I can't find where the initial setting is coming from!
Andrzej: I think you are right - it is the kernel setting the initial parameters (see below)!
Allend: Wow! That is heavy going! It tells me what is going on - much of which I had already surmised - but so far, I haven't managed to find out how to over-ride the default. Its probably in there somewhere, but its like trying to find a needle in a haystack!
From dmesg:
Code:
[ 8.228710] ath: phy0: ASPM enabled: 0x42
[ 8.257544] ath: EEPROM regdomain: 0x65
[ 8.257546] ath: EEPROM indicates we should expect a direct regpair map
[ 8.257549] ath: Country alpha2 being used: 00
[ 8.257551] ath: Regpair used: 0x65
So that's where the "00" is coming from! Then further down:
The stuff at 31" seems to be my rc.local kicking in, followed at 34" by wlan0 being set up. The stuff at 40" appears to be rc.firewall (censored by me!). But then, at 52", something seems to reset it all to "00" again, before rc.local (presumably!) kicks it back to GB again!
I've had a look through the kernel config, and can't see anyway of setting the base regulatory domain there. But again, I've been staring at it so long, I'm going screen-blind!
Does any of this give any clues as to what is going on?
It could be set by default in the module parameters. Have a look at /sys/module/$MODULE/parameters/ and see what you find in there. (Replace $MODULE with your wireless module, since I don't see it mentioned here)
bassmadrigal: The module is ath9k. There are three directories under /sys/module for the ath9k: ath9k, ath9k_common and ath9k_hw. Only the base ath9k has an entry for parameters, and there's nothing in there that looks remotely like a regional setting! Good try, though! ;-)
Anyways, other than for ideological reasons, you shouldn't be bothered with all the region changes you see, if in the end you get the region you want. The point is that, the kernel has the very wanted ability to change the region and that's just what you observe.
On the other side, I could understand you, because I sometimes do spend enormous amount of time trying to silence otherwise completely unimportant message. quiet kernel parameter is your friend
I think there's a better way than a command in rc.local; that is to set the regulatory domain when the responsible module (cfg80211) is loaded. I do mine via a file in /etc/modprobe.d/8812au.conf (where 8812au is the name of my wifi module - I guess its the ath module for you). You can see from that file that cfg80211 is made a dependency of the 8812au i.e. cfg80211 is loaded before8812au; also when cfg80211 is loaded, it is set up with the regulatory domain that I want.
Without that, the domain chosen is read from firmware in the wifi device. As a result, mine used to default to VE (Venezuela) and although wifi still worked, it's nice to know that it's now set correctly.
A while back there was a thread about this that might be of interest. After a lot of troubleshooting I came up with a really simple solution that had nothing to do with kernel modules or rc.local.
I added a script: /etc/NetworkManager/dispatcher.d/pre-up.d/99set-reg-domain.sh
It contains the following:
Code:
#!/bin/sh
set -e
status=`cat /sys/class/net/wlan0/operstate`
if [[ $status == 'up' ]]
then
iw reg set US
fi
I haven't had any spamming about regulatory domain in my logs since I did this because the reg. domain is being set right before the NIC is brought up given an IP address.
I am sure there is a more elegant way to script this so it works on all Slackware machines by pulling the country code from whichever timezone the machine is located in, but meh, it works as is.
This might also be helpful for those who want to make the kernel set the right reg domain (during source compile) for their usage on Atheros chipsets: https://forums.gentoo.org/viewtopic-t-980448.html
I'm sorry to hijack the thread, @mralk3 how did you mange to have the strikethrough text, like with "is brought up"?
I just cannot find this option in the editor.
Well this is quite interesting! It appears that there is no "official" way to set the reg. domain - or if there is, its well hidden - so we are left with kludges that appear to work, but are less than pleasing aesthetically!
Mralk3: That item on the Gentoo forums is interesting, and is probably the closest thing to doing it early in the boot process as we will get. BUT, it means remembering to edit the kernel files every time you compile a new kernel!
I like Chris' script to force the reg domain when the module is loaded. That was the kind of thing I was hoping to find! I had already tried creating a file in /etc/default following a thread on another forum:
I was tempted to put it in /lib/modprobe.d, but the README in /etc/modprobe.d indicates that files in there will over-ride anything in /lib/modprobe.d. I also like the idea of keeping "my" files separate from system files, where possible! There was no ath9k.conf file in /lib/modprobe.d, so I shouldn't be over-riding anything done by the system.
As you can see, there is still an initial set to "00" - presumably triggered by the internal firmware as discussed earlier - but it is immediately over-ridden when the module loads. And it all happens at the same time, and only once!
So I think we have a working solution. Maybe this is something that should be added to the Slackbook? I won't mark this thread as "solved" for another day or so to allow for further discussion / ideas.
The reason it shows up twice might be that there are two different stages:
1. "World regulatory domain updated:"
2. "Regulatory domain changed to country: GB"
One is "update", the other is "change".
My guess is it's just fine.
When it comes to the ultimate solution, I think we won't have one until the tool you're using for managing the WiFi can handle it.
For example, I think that NetworkManager should have this option. The point is, you shouldn't need to edit files or do other hacks just to change the regulatory domain.
Andrzej: Yes, agreed. Maybe Mralk3's link to the kernel mod would prevent the apparent double initialisation. I could do that, as I "roll my own" kernels, but how many others do? And its a pain (and easy to forget!) having to do that every time you compile a new kernel.
I absolutely agree with you about the "absolute solution". This is something that every network manager ought to take in its stride. Frankly, I can't understand why it can't be automated, based on location settings during install, and maybe updated when connected to a network. This way the "default" would be your home country, where you presumably installed the system, but then if you traveled abroad, it would update when it connected to a network (which would presumably provide location information).
The biggest problem I have found is a lack of a standard way of doing this - at least, finding any *documented* standard way. I really think this is something that should be more generally known.
This way the "default" would be your home country, where you presumably installed the system, but then if you traveled abroad, it would update when it connected to a network (which would presumably provide location information).
There was an attempt to do that as mentioned in the link provided by @mralk3. They wanted to use GeoClue, but haven't completed. I think that would be really awesome
On the other side, I guess that Linux is not lagging by other OSes. I guess other OSes also don't provide an easy/automated way of handling this particular problem. But I might be wrong.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.