Bug 12066 - Modification of sysctl not taken after reboot
Summary: Modification of sysctl not taken after reboot
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: Mageia 4
Assignee: Colin Guthrie
QA Contact:
URL:
Whiteboard:
Keywords: Triaged
Depends on:
Blocks:
 
Reported: 2013-12-21 00:44 CET by Michel Morisot
Modified: 2022-04-20 17:34 CEST (History)
7 users (show)

See Also:
Source RPM: initscripts
CVE:
Status comment:


Attachments

Description Michel Morisot 2013-12-21 00:44:26 CET
Description of problem:

***************************
Les modifications insérées dans le fichier sysctl, ne sont pas prises en compte après un reboot du PC
****************************
The modifications inserted in the file sysctl, are not taken into account after a reboot of the PC
*****************************


*****************************
Par contre, lorsque la modification est faite en mode console , pas de problème, la modification est bien prise en compte.

sysctl vm.swappiness=15

Vérifier par la commande: cat /proc/sys/vm/swappiness  donne bien 15
*****************************
On the other hand, when the modification is made in mode comforts, not problem, the modification is well taken into account.

sysctl vm.swappiness=15

To check by the order: cat /proc/sys/vm/swappiness gives 15 well
*****************************

sysctl -a
resum: 
........
vm.swappiness = 60 
vm.user_reserve_kbytes = 131072 
vm.vfs_cache_pressure = 100 
............


cat /etc/sysctl.conf
net.ipv4.icmp_ignore_bogus_error_responses=1
net.ipv4.icmp_echo_ignore_broadcasts=0
net.ipv4.icmp_echo_ignore_all=0
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.all.log_martians=1
vm.swappiness=15


systemctl | grep -i sysctl
systemd-sysctl.service loaded active exited Apply Kernel Variables







Reproducible: 

Steps to Reproduce:
Michel Morisot 2013-12-21 01:01:32 CET

CC: (none) => info

Sylvain ZUCCA 2013-12-21 09:38:01 CET

CC: (none) => sylvainsjc

Comment 1 Michel Morisot 2013-12-21 15:45:07 CET
Je pense avoir trouvé la solution en lisant ceci: http://www.linuxed.net/post/2012/10/19/Configurer-sysctl-avec-systemd 

le fichier sysctl.conf est à placer dans le répertoire /etc/sysctl.d 

Et ça fonctionne. La modification est fonctionnelle après un reboot

sortie: cat /proc/sys/vm/swappiness 15 

Qu'en pensez-vous de la solution ? 

Mon idée "et si je mettais un lien pointant vers sysctl.conf dans ce répertoire (etc/sysctl.d) ? " n'était pas si éloignée que cela de la solution. 

Petite réflexion, N'aurait-il pas d'autres fichiers qui devraient se trouver dans ce répertoire /etc/sysctl.d au lieu de /etc ?
**********************************************************

I think of having found the solution by reading this: http://www.linuxed.net/post/2012/10/19/Configurer-sysctl-avec-systemd 

the file sysctl.conf is to be placed in the directory /etc/sysctl.d 

And that functions. The modification is functional after a reboot 

left: cat /proc/sys/vm/swappiness 15 

what do you think about it of the solution? 

My idea âand if I did put a link pointing towards sysctl.conf in this directory (etc/sysctl.d)? â only that was not so distant from the solution. 

small reflection, wouldn't it have other files which should be in this /etc/sysctl.d directory instead of /etc?
Michel Morisot 2013-12-22 15:42:43 CET

Target Milestone: --- => Mageia 4

Comment 2 Florian Hubold 2013-12-23 14:55:15 CET
@Michel: Please post only in english, thanks :)


Confirming, none of the settings in /etc/sysctl.conf are currently effective so that file is currently useless. Seems either the installer or some draktool still writes to it:

$ cat /etc/sysctl.conf
net.ipv4.icmp_ignore_bogus_error_responses=1
net.ipv4.icmp_echo_ignore_broadcasts=0
net.ipv4.icmp_echo_ignore_all=0
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.all.log_martians=1

$ LC_ALL=C rpm -qf /etc/sysctl.conf 
file /etc/sysctl.conf is not owned by any package

The following seem to be taken into account by systemd-sysctl service and should be used instead:

$ grep sysctl.d$ /usr/lib/systemd/system/systemd-sysctl.service
ConditionDirectoryNotEmpty=|/lib/sysctl.d
ConditionDirectoryNotEmpty=|/usr/lib/sysctl.d
ConditionDirectoryNotEmpty=|/usr/local/lib/sysctl.d
ConditionDirectoryNotEmpty=|/etc/sysctl.d
ConditionDirectoryNotEmpty=|/run/sysctl.d

As proposed by Michel, adding a symlink is currently probably easiest fix:
ln -s /etc/sysctl.conf /etc/sysctl.d/
as sysctl itself seems to still default to /etc/sysctl.conf to read from config file (-p)

$ sysctl --help | grep -e "-p"
        sysctl [-n] [-e] [-q] -p <file>   (default /etc/sysctl.conf)


This is with beta2 install from DVD with all updates applied.

CC: (none) => doktor5000

Comment 3 Michel Morisot 2013-12-23 15:43:26 CET
@ Michel: Please post only in English, thanks :)

Sorry my English is very bad, I prefer to put my message in it both languages. Unless you prefer that only English-speaking members warn you of bug.

Désolé mon anglais est très mauvais, je prefère pour cela mettre mon message dans les deux langues. Sauf si vous préférez que seuls les membres anglophones vous avertissent des bug.
Comment 4 Thierry Vignaud 2013-12-26 19:21:09 CET
What tool did you use in order to change settings (that were ignored)?

Component: Installer => RPM Packages
CC: (none) => thierry.vignaud
Keywords: (none) => NEEDINFO

Comment 5 Michel Morisot 2013-12-26 21:37:11 CET
sudo kate (kde)

addition of the line at the end of the file

add vm.swappiness=15

it is all
Comment 6 Michel Morisot 2013-12-26 21:37:41 CET
vm.swappiness=15 of course
Comment 7 Thierry Vignaud 2013-12-26 22:51:09 CET
/etc/sysctl.conf has been obsoleted, isn't it Colin?

Source RPM: (none) => initscripts
CC: (none) => mageia

Comment 8 Colin Guthrie 2013-12-27 00:42:58 CET
Hmm, yes, but it's supposed to be symlinked as /etc/sysctl.d/99-sysctl.conf such that it still works... Seems I never added that symlink to a package tho' - not sure how best to do it either as /etc/sysctl.conf is not owned by any package either... any bright ideas?
Comment 9 Florian Hubold 2014-02-21 00:32:47 CET
Well, simply do it in some post script?

[doktor5000@Mageia4 ~]$ rpm -qf /etc/sysctl.d/51-alt-sysrq.conf 
file /etc/sysctl.d/51-alt-sysrq.conf is not owned by any package
[doktor5000@Mageia4 ~]$ rpm -qf /etc/sysctl.d/ 
initscripts-9.41-21.mga4
systemd-units-208-10.mga4

Probably /etc/sysctl.d/51-alt-sysrq.conf should also be owned by some package?

Why not add both to initscripts?

Keywords: NEEDINFO => Triaged
Assignee: bugsquad => mageia

Comment 10 Colin Guthrie 2014-02-21 11:48:55 CET
The idea was to make it controlled by msec based on security level, so it's not really the kind of thing that should be "owned" by a package as it's dependant on various other system settings.
Comment 11 Colin Guthrie 2014-02-21 11:52:39 CET
Sorry, the above comment was in reply to the 51-alt-sysrq thing.

I forgot about the other symlink. Will try and add it in this weekend.
claire robinson 2014-04-06 13:52:08 CEST

CC: (none) => eeeemail

Comment 12 Florian Hubold 2017-08-08 21:49:31 CEST
/etc/sysctl.conf is now owned by initscripts, and /etc/sysctl.d/99-sysctl.conf now points to /etc/sysctl.conf in mga6. Can we close this one as OLD ?
Florian Hubold 2019-09-22 23:49:11 CEST

See Also: (none) => https://bugs.mageia.org/show_bug.cgi?id=25212

Comment 13 papoteur 2022-04-20 17:34:51 CEST
It seems solved.

Status: NEW => RESOLVED
Resolution: (none) => FIXED
CC: (none) => yves.brungard_mageia


Note You need to log in before you can comment on or make changes to this bug.