I want to make "echo 1 > /sys/kernel/mm/ksm/run" persistent between boots. I know that I can edit /etc/sysctl.conf to make /proc filesystem changes persist, but this doesn't seem to work for /sys. How would I make this change survive reboots?


Most distros have some sort of an rc.local script that you could use. Check your distro as names and path may vary. Normally expect to look under /etc.

  • 1
    This is what I ended up doing, though @camh 's answer allowed me to google for this. sysfs.conf obviously doesn't exist on arch – xenoterracide Nov 28 '11 at 0:29
  • sysfsutils is packaged in AUR, but it seems that the sysfs.conf functionality is a debian patch that has not been upstreamed. – clacke Oct 17 '13 at 9:53

Debian has the package sysfsutils which has an init.d script that can apply settings to /sys based on the configuration in /etc/sysfs.conf.

The init script has an @debian.org author, so I suspect that this is debian-specific and may not have made it to other non-Debian distributions. However, all the logic is contained in the init script, so you could quite easily grab that package, extract the script and use it on your system.


/etc/sysctl.conf is read by one of your init scripts. This is somewhat distribution-dependent; on Debian, it's /etc/init.d/procps. Debian doesn't have anything like this for settings under /sys in its default installation (there's the sysfsutils package if you want it though). If your distribution doesn't either, write an init script of your own.

(Note that /etc/sysctl.conf doesn't make /proc/sys persistent: if you set something in /proc/sys, it isn't saved in /etc/sysctl.conf.)

  • 3
    but @gilles sysctl.conf is for /proc not /sys – xenoterracide Nov 28 '11 at 0:27
  • 1
    @xenoterracide Not for /proc but for sysctl values, which are exposed in /proc/sys. – Gilles 'SO- stop being evil' Nov 28 '11 at 0:33
  • 4
    either way it's still not /sys which is what this is about. – xenoterracide Nov 29 '11 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.