You are not logged in.

#1 2016-11-07 07:36:32

dun32
Member
Registered: 2012-10-31
Posts: 25

[SOLVED] kernel parameters not loading

Hy all,

Trying to get longer up time on my laptop so I set vm.laptop_mode to 5 as indicated here

# cat /etc/sysctl.d/laptop.conf 
vm.laptop_mode = 5

My problem is that, after reboot, /proc/sys/vm/laptop_mode is still 0.

systemd-sysctl is enabled and active :

 ● systemd-sysctl.service - Apply Kernel Variables
    Loaded: loaded (/usr/lib/systemd/system/systemd-sysctl.service; static; vendor preset: disabled)
    Active: active (exited) since lun. 2016-11-07 07:58:02 CET; 23min ago
      Docs: man:systemd-sysctl.service(8)
            man:sysctl.d(5)
   Process: 1944 ExecStart=/usr/lib/systemd/systemd-sysctl (code=exited, status=0/SUCCESS)
  Main PID: 1944 (code=exited, status=0/SUCCESS)
     Tasks: 0 (limit: 4915)
    CGroup: /system.slice/systemd-sysctl.service
 
 nov. 07 07:58:02 io1 systemd[1]: Starting Apply Kernel Variables...
 nov. 07 07:58:02 io1 systemd[1]: Started Apply Kernel Variables.

sysctl --system runs without error and /proc/sys/vm/laptop_mode goes to 5.

after reboot /proc/sys/vm/laptop_mode is still 0 then

/usr/lib/systemd/systemd-sysctl runs without error and /proc/sys/vm/laptop_mode goes to 5.

but, after reboot, /proc/sys/vm/laptop_mode is still 0  :-(

system info :

# uname -a
Linux io1 4.8.6-1-ARCH #1 SMP PREEMPT Mon Oct 31 18:51:30 CET 2016 x86_64 GNU/Linux

# systemctl --version
systemd 231
+PAM -AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN

and /etc is located inside / partition (same partition, same disk)

Does somebody have any idea of what's going on ?

Last edited by dun32 (2016-11-07 16:17:06)

Offline

#2 2016-11-07 13:03:38

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,406

Re: [SOLVED] kernel parameters not loading

Something else passing by and altering the value? Eg. power savings of your desktop?
What about the value if you stop at "systemd.unit=multi-user.target" or even "systemd.unit=rescue.target"

Offline

#3 2016-11-07 14:38:18

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,152

Re: [SOLVED] kernel parameters not loading

from man sysctl.d

       Many sysctl parameters only become available when certain kernel modules are loaded. Modules are usually loaded on
       demand, e.g. when certain hardware is plugged in or network brought up. This means that systemd-sysctl.service(8) which
       runs during early boot will not configure such parameters if they become available after it has run. To set such
       parameters, it is recommended to add an udev(7) rule to set those parameters when they become available. Alternatively, a
       slightly simpler and less efficient option is to add the module to modules-load.d(5), causing it to be loaded statically
       before sysctl settings are applied (see example below).

Maybe laptop_mode requires a module that hasn't been loaded yet ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#4 2016-11-07 15:00:52

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,406

Re: [SOLVED] kernel parameters not loading

https://www.kernel.org/doc/Documentatio … p-mode.txt

Laptop mode is controlled by the knob /proc/sys/vm/laptop_mode. This knob is
present for all kernels that have the laptop mode patch, regardless of any
configuration options.

Got shadowing /etc/default/laptop-mode or /etc/sysconfig/laptop-mode resp. tried editing the latter (to rule out a systemd failure)?

Offline

#5 2016-11-07 15:27:57

dun32
Member
Registered: 2012-10-31
Posts: 25

Re: [SOLVED] kernel parameters not loading

Thanks seth & Lone_wolf,

after reboot, deeper inspection in journalctl :

# journalctl -xb -u systemd-sysctl
-- No entries --

It appears that systemd-sysctl is not ran at all...

So, check in systemd services :

# grep -r -e systemd-sysctl /usr/lib/systemd/system/*
/usr/lib/systemd/system/dbus-org.freedesktop.network1.service:After=systemd-udevd.service dbus.service network-pre.target systemd-sysusers.service systemd-sysctl.service
/usr/lib/systemd/system/systemd-networkd.service:After=systemd-udevd.service dbus.service network-pre.target systemd-sysusers.service systemd-sysctl.service
/usr/lib/systemd/system/systemd-sysctl.service:Documentation=man:systemd-sysctl.service(8) man:sysctl.d(5)
/usr/lib/systemd/system/systemd-sysctl.service:ExecStart=/usr/lib/systemd/systemd-sysctl
$ ls -l /usr/lib/systemd/system/ | grep network1.service
lrwxrwxrwx 1 root root   24  7 oct.  19:38 dbus-org.freedesktop.network1.service -> systemd-networkd.service

I'm not using systemd-networkd on my laptop, I'm using NetworkManager (gdm + gnome shell)...

I'm comparing with my other laptop (NetworkManager + sddm + kde) -> systemd-sysctl runs correctly at boot with exactly the same list as above.

According to sysctl.d(5), it seems that sysctl is not run because of missing necessary module ?

I have an intel core i7 so laptop-mode uses intel-pstate module to manage frequency (instead of cpufreq) but this intel-pstate module is loaded long time before systemd starts...

I guess I'm going to try to set a special systemd service to re-run /usr/lib/systemd/systemd-sysctl when gdm is up and try to see if it works.

Last edited by dun32 (2016-11-07 15:28:29)

Offline

#6 2016-11-07 15:37:06

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,406

Re: [SOLVED] kernel parameters not loading

Nobody uses systemd-networkd :-P
Grep hits because systemd-networkd requires systemd-sysctl to be run before, but that's irrelevant.

The status in https://bbs.archlinux.org/viewtopic.php … 5#p1667545 looks exactly as it should and says systemd-sysctl ran 2016-11-07 07:58:02 CET
Re-running it will likely "work" but if some other power management daemon freaks around there, it might easily reset the value at some later time.

Offline

#7 2016-11-07 16:23:06

dun32
Member
Registered: 2012-10-31
Posts: 25

Re: [SOLVED] kernel parameters not loading

I'm sorry guys to make you loose so much time...

It's just a thing that I didn't understand how laptop-mode runs...

I powered off the laptop, unplugged power supply, boot again, /proc/sys/vm/laptop-mode = 5
then switches to 0 when I plug the power supply...

If you come nearby Toulouse (France), I'd be happy to offer you a beer !


[edit] I've also found why, sometimes, I don't have logs about sysctl : systemd-sysctl runs before journald has complete its startup.

Last edited by dun32 (2016-11-07 16:24:47)

Offline

Board footer

Powered by FluxBB