You are not logged in.
I recently changed from initscripts to systemd, and from netcfg to netctl. Wireless works, but not at boot. This is because I have to turn off power saving to my card. So I first had to issue the command "/usr/sbin/iwconfig wlan0 power off". After that I start the wireless with netctl and it works excellent.
I am thinking of a ExecUpPre, just like ExecUpPre, option in the netctl profile, but this is not an option. What is the best way to automate this at boot?
Thanks!
Last edited by anadyr (2013-05-26 04:56:41)
Offline
You can do it via modprobe generally: https://wiki.archlinux.org/index.php/Ke … probe.d.2F
Offline
Is there a kernel module to turn off power save of the card? I can't find any.
What I want is to run "/usr/sbin/iwconfig wlan0 power off" before I connect to a wireless network. I don't really understand systemd yet. I found the initscripts quite intuitive, and I had my wlan0 option in a daemon. What I am after is something like a rc.local variant in systemd...
Offline
If you want to disable powersaving during boot, the way to do it is as I wrote. The module to address is the one of your wireless card (which iwconfig addresses too).
There are ways to do it analogue to rc.local (many examples in the systemd wiki here), but why create a custom hack when the normal boot infrastructure gives you the means.
edit: If you want to turn it off only when connecting (to save power when not connected), you don't have an option in the netctl profile itself but you can execute a command a command in the profile service file with "ExecStart=" exampe: https://bbs.archlinux.org/viewtopic.php … 7#p1260127
Last edited by Strike0 (2013-04-21 21:26:53)
Offline
Thanks! I copied the netctl@.service file from /usr/lib/systemd/system/ to /etc/systemd/system/, and then added my command to this file. Now it works at boot again. Never been able to do this via modprobe though.
Last edited by anadyr (2013-05-02 05:34:13)
Offline
I decided to open this thread again because it does not work yet. After each boot I still manually have to issue the commands 1) "/usr/sbin/iwconfig wlan0 power off" and 2) netctl start wireless-profile. What I want seems to be pretty simple: I want systemd to issue the command "/usr/sbin/iwconfig wlan0 power off" before netctl starts my profile.
I tried to add "ExecStart=/usr/sbin/iwconfig wlan0 power off" in various places in netctl@.service and rfkill-unblock@.service. It appeared to working a few times but not structurally.
Any other ideas? I am now reading about making a systemd/service to do this, but this seems to be quite cumbersome for only 1 command...
Offline
Maybe the problem is that you have to put the interface down first before changing power settings (I'm writing this since you mention using rfkill).
Have a look first, that you did not enable multiple netctl services in your trials. Then post the profile service file you are using please. Also give us info about which wireless card (and which module) you are using.
Note that "iwconfig" gets deprecated over time. Depending on the module used, it might already be better to use
iw dev wlan0 set power_save on
going forward anyway.
Offline
Thanks for helping me so far. No results yet. Here are some details that perhaps are relevant. I have no other netctl profiles.
1) lspci gives the following info; it uses the rt2500pci module. The laptop is more than 7 years old.
Network controller: Ralink corp. RT2500 Wireless 802.11bg (rev 01)
2) In the time of rc.d daemons I had a daemon with three commands, in the following order. After this the net-profiles daemon started without a problem:
/sbin/ip link set wlan0 up
/usr/sbin/iwconfig wlan0 power off
rfkill unblock 0
This means that the interface must be up when changing the power setting. Now systemd takes care of setting the interface wlan and setting rfkill.
3) my netctl profile does not include any strange things I guess
Description='Sorryvoordehobo'
Interface=wlan0
Connection=wireless
Security=wpa-configsection
IP=dhcp
TimeoutCarrier=60
TimeoutDHCP=90
WPAConfigSection=(
'ssid="Sorry voor de hobo"'
'key_mgmt=WPA-PSK'
'proto=WPA'
'pairwise=CCMP'
'group=CCMP'
'psk=password-in-hexadecimals'
)
4) The service file is generated somehow, I don't know. It is called netctl@Sorryvoordehobo.service
.include /usr/lib/systemd/system/netctl@.service
[Unit]
Description=Sorryvoordehobo
BindsTo=sys-subsystem-net-devices-wlan0.device
After=sys-subsystem-net-devices-wlan0.device
Last edited by anadyr (2013-05-15 06:47:23)
Offline
Ok, now: Trying it via modprobe on the rt2500pci was a wrong path, because your module does not support it.
I was wondering why it worked for your .service file when you added the command there, but not "structurally" (your word). Can it be that you modified the service /usr/lib/systemd/.. directly and it got overwritten by an upgrade ?
Anyhow, two ways to try alternatively:
1) Create that service to run your old script, e.g. in /etc/systemd/system/wlan0power.service and enable it:
[Unit]
Description=Turn off wifi powersave for wlan0
Requires=basic.target
After=basic.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/yourscript.sh
[Install]
WantedBy=multi-user.target
2. Use Udev for something similar by creating e.g. /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="rt2500pci", KERNEL=="wlan0", RUN="/sbin/iwconfig wlan0 power off"
Have a go at one at a time.
Offline
Thanks for your suggestions. I try it tomorrow; no time now.
I have also been thinking about why it works sometimes but not structurally. The only thing that I can think of is that systemd, unlike initscripts, does not start programs, services, or daemons in a fixed order. Maybe my power-save command demands a particular order of commands to execute?
Offline
I am getting there...
1) I added the service as you suggested. I made some changes to the file too, about sequence
[Unit]
Description=Turn off wifi powersave for wlan0
Requires=basic.target netctl.service
After=basic.target
Before=netctl.service[Service]
Type=oneshot
ExecStart=/usr/sbin/iw dev wlan0 set power_save off
ExecStart=/usr/bin/sleep 1[Install]
WantedBy=multi-user.target
2) changed netctl.service as well:
[Unit]
Description=(Re)store the netctl profile state
Requires=wlan0power.service
After=wlan0power.service
Before=network.target[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/bin/netctl restore
ExecStop=/usr/bin/netctl store
KillMode=none[Install]
WantedBy=multi-user.target
I restarted a few times and it seems to work. One last question: I tried to find the order of services that systemd starts, in order to verify whether wlan0power.service indeed starts before netctl.service. However, I cannot find the order of started services. systemd -all gives all services, but in this list wlan0power.device is below netctl.service. Which suggests that this list is not order from first to last... Moreover, when I change After= and Before= in both service files, then wlan0power.device is still far below netctl.service... Strange...
Offline
I'm still learning with systemd too, but that is increasingly fun. Try
systemd-analyze plot > plot.svg
which gives a bootchart (the wiki has more of this). The paralisation and how to control it with both stability and speed in the boot processis indeed interesting, but your question is too unspecific (e.g. you don't write how you altered the constraints). Better observe that again and quote more specific.
By the way, I just remembered the following:
ExecStartPre=, ExecStartPost=
Additional commands that are executed before or after the command in ExecStart=, respectively. Syntax is the same as
for ExecStart=, except that multiple command lines are allowed and the commands are executed one after the other,
serially.If any of those commands (not prefixed with '-') fail, the rest are not executed and the unit is considered failed.
I guess I forgot about that when replying the other day. That would be the alternative to merge it into your own profilenetctl.service (at least if you only require the "iw power off" and not more commands).
edit: see above
Last edited by Strike0 (2013-05-16 18:04:49)
Offline
Anyhow, two ways to try alternatively:
2. Use Udev for something similar by creating e.g. /etc/udev/rules.d/70-persistent-net.rulesSUBSYSTEM=="net", ACTION=="add", DRIVERS=="rt2500pci", KERNEL=="wlan0", RUN="/sbin/iwconfig wlan0 power off"
Have a go at one at a time.
Solution 2 is worked for me. Thanks.
Last edited by ccpaging (2013-05-25 02:03:07)
Offline
I changed my wlan0power.service, and this is what I use now. It works flawlessly
[Unit]
Description=Turn off wifi powersave for wlan0
Requires=basic.target
BindsTo=sys-subsystem-net-devices-wlan0.device
After=basic.target sys-subsystem-net-devices-wlan0.device[Service]
Type=oneshot
ExecStart=/usr/sbin/iw dev wlan0 set power_save off[Install]
WantedBy=multi-user.target
Offline
Just for reference, this could have probably been done with:
systemctl enable rfkill-unblock@<INDEXTYPE>.service
Where <INDEXTYPE> is an index or type, as described in `man rfkill`.
That said, it does about the same thing as your custom .service file, without the need for `rfkill`. So keep your file, by all means.
Last edited by veox (2013-05-26 10:14:10)
Offline
This may be of help: I use the following udev rule to set power saving on for my wifi card:
ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan*" RUN+="/usr/sbin/iw dev %k set power_save on"
/usr/bin/drinking
Offline
Just for reference, this could have probably been done with rfkill-unblock
No, because turning off radio with rfkill is a different operation from turning off the power saving option.
Offline