20

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?

3 Answers 3

22

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.

7

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.

2
  • 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 Nov 28, 2011 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, 2013 at 9:53
1

/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
  • 6
    but @gilles sysctl.conf is for /proc not /sys Nov 28, 2011 at 0:27
  • 1
    @xenoterracide Not for /proc but for sysctl values, which are exposed in /proc/sys. Nov 28, 2011 at 0:33
  • 8
    either way it's still not /sys which is what this is about. Nov 29, 2011 at 3:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .