Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

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.

share|improve this answer
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.

share|improve this answer

/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.)

share|improve this answer
1  
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 Nov 28 '11 at 0:33
    
either way it's still not /sys which is what this is about. –  xenoterracide Nov 29 '11 at 3:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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