Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Kernel & Hardware
  • Search

Settings in sysctl.d not being applied at boot

Kernel not recognizing your hardware? Problems with power management or PCMCIA? What hardware is compatible with Gentoo? See here. (Only for kernels supported by Gentoo.)
Post Reply
Advanced search
9 posts • Page 1 of 1
Author
Message
mani001
Guru
Guru
Posts: 491
Joined: Sat Dec 04, 2004 12:41 pm
Location: Oleiros

Settings in sysctl.d not being applied at boot

  • Quote

Post by mani001 » Mon Jun 20, 2022 7:05 am

Hi,

I have a file 10-inotify.conf in /etc/sysctl.d/ to try and set the filesystem's max_user_watches:

Code: Select all

root@aguarrioquad sysctl.d $bat -p 10-inotify.conf 
fs.inotify.max_user_watches = 524288
but it seems this is not read at boot

Code: Select all

root@aguarrioquad sysctl.d $bat -p /proc/sys/fs/inotify/max_user_watches 
16384
However, if I restart the sysctl systemd service

Code: Select all

systemctl restart systemd-sysctl.service
then it is read

Code: Select all

root@aguarrioquad sysctl.d $bat -p /proc/sys/fs/inotify/max_user_watches 
524288
However, it seems that systemd-sysctl.service is a service that is enabled by default
root@aguarrioquad sysctl.d $systemctl enable systemd-sysctl.service
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.

Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
.wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
instance name specified.

This only happens to me in one of my machines, so it's kind of weird...

Any clue?
Top
toralf
Developer
Developer
User avatar
Posts: 3944
Joined: Sun Feb 01, 2004 2:58 pm
Location: Hamburg
Contact:
Contact toralf
Website

  • Quote

Post by toralf » Mon Jun 20, 2022 3:55 pm

Does this

Code: Select all

$> rc-update | grep sysctl
               sysctl | boot     
looks similar at your system ?
Top
mani001
Guru
Guru
Posts: 491
Joined: Sat Dec 04, 2004 12:41 pm
Location: Oleiros

  • Quote

Post by mani001 » Mon Jun 20, 2022 4:09 pm

I don't have rc-update in my system. I guess it's because I use systemd and rc-update is an OpenRC thing (right?). An analogous thing might be:

Code: Select all

root@aguarrioquad ~ $systemctl list-unit-files | grep sysctl
systemd-sysctl.service                                    static          -
Top
Etal
Veteran
Veteran
User avatar
Posts: 1932
Joined: Fri Jul 15, 2005 3:01 pm

  • Quote

Post by Etal » Mon Jun 20, 2022 5:57 pm

Are you sure it's not being overridden elsewhere? Your number looks suspiciously low and square.

Code: Select all

$ grep -r max_user_watches /etc/sysctl.*
What does it show when you get the status?

Code: Select all

$ systemctl status systemd-sysctl
● systemd-sysctl.service - Apply Kernel Variables
     Loaded: loaded (/lib/systemd/system/systemd-sysctl.service; static)
     Active: active (exited) since Fri 2022-06-17 21:56:40 EDT; 2 days ago
       Docs: man:systemd-sysctl.service(8)
             man:sysctl.d(5)
    Process: 321 ExecStart=/lib/systemd/systemd-sysctl (code=exited, status=0/SUCCESS)
   Main PID: 321 (code=exited, status=0/SUCCESS)
        CPU: 3ms

Jun 17 21:56:40 xxx systemd[1]: Finished Apply Kernel Variables.
Top
mani001
Guru
Guru
Posts: 491
Joined: Sat Dec 04, 2004 12:41 pm
Location: Oleiros

  • Quote

Post by mani001 » Mon Jun 20, 2022 6:33 pm

Are you sure it's not being overridden elsewhere?
I had also though of that...but, unfortunately, that's not it

Code: Select all

root@aguarrioquad ~ $grep -r max_user_watches /etc/sysctl.*
/etc/sysctl.d/10-inotify.conf:fs.inotify.max_user_watches = 524288
I even though whether it might be something taking precedence (it shouldn't) in the system's sysctl directory

Code: Select all

root@aguarrioquad ~ $grep -r max_user_watches /usr/lib/sysctl.d/*
root@aguarrioquad ~ $
but no.

About the suspicious number, I agree...no idea, probably some old default value hardcoded somewhere (by the way, 16384 is 2 to the 14 => a 14 bits field...not that it helps, but whatever :D )

systemd reports everything is fine

Code: Select all

root@aguarrioquad ~ $systemctl status systemd-sysctl 
● systemd-sysctl.service - Apply Kernel Variables
     Loaded: loaded (/lib/systemd/system/systemd-sysctl.service; static)
     Active: active (exited) since Mon 2022-06-20 20:29:20 CEST; 2min 1s ago
       Docs: man:systemd-sysctl.service(8)
             man:sysctl.d(5)
    Process: 136 ExecStart=/lib/systemd/systemd-sysctl (code=exited, status=0/SUCCESS)
   Main PID: 136 (code=exited, status=0/SUCCESS)
        CPU: 7ms
Top
Etal
Veteran
Veteran
User avatar
Posts: 1932
Joined: Fri Jul 15, 2005 3:01 pm

  • Quote

Post by Etal » Tue Jun 21, 2022 1:03 am

Does restarting it apply the value?

Code: Select all

systemctl restart systemd-sysctl
Do you see the config/value printed if you run this?

Code: Select all

/lib/systemd/systemd-sysctl --cat-config
Top
mani001
Guru
Guru
Posts: 491
Joined: Sat Dec 04, 2004 12:41 pm
Location: Oleiros

  • Quote

Post by mani001 » Tue Jun 21, 2022 5:08 pm

Does restarting it apply the value?

Code: Select all

systemctl restart systemd-sysctl	
Yes
Do you see the config/value printed if you run this?

Code: Select all

/lib/systemd/systemd-sysctl --cat-config
Yes

Code: Select all

root@aguarrioquad ~ $/lib/systemd/systemd-sysctl --cat-config
# /lib/sysctl.d/00protected-links.conf
fs.protected_symlinks = 1
fs.protected_hardlinks = 1

# /etc/sysctl.d/10-inotify.conf
fs.inotify.max_user_watches = 524288

# /usr/lib/sysctl.d/50-coredump.conf
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

# See sysctl.d(5) for the description of the files in this directory.
...
Top
Etal
Veteran
Veteran
User avatar
Posts: 1932
Joined: Fri Jul 15, 2005 3:01 pm

  • Quote

Post by Etal » Wed Jun 22, 2022 5:10 pm

Hmm, so it sounds like systemd-sysctl picks up the values and applies them, you can verify by setting some other tunable in 10-inotify.conf and see if it gets picked up. But then something else must be overriding it afterwards…

Some obscure service? Something in tmpfiles.d? A user log in script calling sudo?
Top
mani001
Guru
Guru
Posts: 491
Joined: Sat Dec 04, 2004 12:41 pm
Location: Oleiros

  • Quote

Post by mani001 » Fri Jun 24, 2022 8:25 pm

Hmm, so it sounds like systemd-sysctl picks up the values and applies them, you can verify by setting some other tunable in 10-inotify.conf and see if it gets picked up. But then something else must be overriding it afterwards…
You are probably right, I just added

Code: Select all

fs.inotify.max_user_instances = 129
to the same sysctl.d file, and it gets properly set at boot 8O
Top
Post Reply

9 posts • Page 1 of 1

Return to “Kernel & Hardware”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic