# Persistent sysctl configuration

**URL:** <https://forums.suse.com/t/persistent-sysctl-configuration/1391>\
**Category:** RancherOS\
**Created:** [January 5, 2016, 10:35pm UTC](https://forums.suse.com/t/persistent-sysctl-configuration/1391 "2016-01-05T22:35:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![robbertkl](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/robbertkl/32/721_2.png) [@robbertkl](https://forums.suse.com/u/robbertkl)\
**Post date:** [January 5, 2016, 10:35pm UTC](https://forums.suse.com/t/persistent-sysctl-configuration/1391/1 "2016-01-05T22:35:54Z")

</div>

Hi,

Is it possible to make sysctl adjustments and have them persist on reboots? I’ve tried the usual way of adding them to `/etc/sysctl.conf` or `/etc/sysctl.d/xxxx.conf`. Even though my changes to these files _are_ indeed persistent, these files don’t seem te be applied on boot time; my changes won’t appear in `sysctl -a`.

Thanks!  
Robbert

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [January 8, 2016, 6:49pm UTC](https://forums.suse.com/t/persistent-sysctl-configuration/1391/2 "2016-01-08T18:49:15Z")

</div>

What console are you using?

[http://docs.rancher.com/os/configuration/custom-console/#console-persistence](http://docs.rancher.com/os/configuration/custom-console/#console-persistence)

---

<div class="post-metadata">

**Author:** ![robbertkl](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/robbertkl/32/721_2.png) [@robbertkl](https://forums.suse.com/u/robbertkl)\
**Post date:** [January 9, 2016, 5:03pm UTC](https://forums.suse.com/t/persistent-sysctl-configuration/1391/3 "2016-01-09T17:03:13Z")

</div>

I’m using `debian-console`, but as I said, the sysctl configuration files _are_ persisting. However, they are not applied on boot.

---

<div class="post-metadata">

**Author:** ![sjiveson](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/sjiveson/32/966_2.png) [@sjiveson](https://forums.suse.com/u/sjiveson)\
**Post date:** [January 22, 2016, 2:42pm UTC](https://forums.suse.com/t/persistent-sysctl-configuration/1391/4 "2016-01-22T14:42:19Z")

</div>

I write the **/etc/sysctl.conf** (644 perms) file and relevant settings via cloud-config on installation.

I also write the **/opt/rancher/bin/start.sh** (744 perms) script in at the same time, with this content:

```
#!/bin/sh
sysctl -p
exit

```

Works a treat.

---

<div class="post-metadata">

**Author:** ![Shuliyey](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/shuliyey/32/495_2.png) [@Shuliyey](https://forums.suse.com/u/Shuliyey)\
**Post date:** [May 3, 2016, 5:05am UTC](https://forums.suse.com/t/persistent-sysctl-configuration/1391/5 "2016-05-03T05:05:19Z")

</div>

> [@sjiveson](#):
>
> same

thanks so much for this 🙂, the cloud.config can be changed later at location **/var/lib/rancher/cloud-config.yml**

---

<div class="post-metadata">

**Author:** ![sjiveson](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/sjiveson/32/966_2.png) [@sjiveson](https://forums.suse.com/u/sjiveson)\
**Post date:** [May 3, 2016, 9:33am UTC](https://forums.suse.com/t/persistent-sysctl-configuration/1391/6 "2016-05-03T09:33:59Z")

</div>

You’re welcome.

I’ve noticed in v1.0.1 at least it’s now this file: **/var/lib/rancher/conf/cloud-config.d/user\_config.yml**.

---

<div class="post-metadata">

**Author:** ![robbertkl](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/robbertkl/32/721_2.png) [@robbertkl](https://forums.suse.com/u/robbertkl)\
**Post date:** [May 4, 2016, 12:04am UTC](https://forums.suse.com/t/persistent-sysctl-configuration/1391/7 "2016-05-04T00:04:46Z")

</div>

Writing `/etc/sysctl.conf` from the cloud-config works fine (and is a good central place to put it), but that’s not really the problem; the contents of this file are already persistent.

The problem is that, unlike other Linux systems, they are not applied on boot. Applying them yourself with `sysctl -p` from `start.sh` is a great workaround (thanks @sjiveson), however, in my opinion this is something RancherOS should do automatically.

Even more, the suggested solution does not really work for me, because the sysctls are applied a bit late in the boot process. On other Linux systems where `sysctl.conf` is applied automatically, this is done in a very early stage, before any other init scripts are run. On RancherOS, it runs before “user docker”, which is great, but pretty much after everything else. A sysctl that disables IPv6 auto configuration, for example, will be applied _after_ auto configuration is already done, making it useless here.

I guess there’s currently no way to do this; I’ll make sure to submit an issue to GitHub repo.

---

<div class="post-metadata">

**Author:** ![ibuildthecloud](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/ibuildthecloud/32/8_2.png) [@ibuildthecloud](https://forums.suse.com/u/ibuildthecloud)\
**Post date:** [May 4, 2016, 3:33am UTC](https://forums.suse.com/t/persistent-sysctl-configuration/1391/8 "2016-05-04T03:33:38Z")

</div>

I agree this should be natively supported in RancherOS. We can add this to the cloud config something like:

```auto
#cloud-config
rancher:
  sysctl:
    net.ipv4.conf.default.rp_filter: 1

```

---

<div class="post-metadata">

**Author:** ![robbertkl](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/robbertkl/32/721_2.png) [@robbertkl](https://forums.suse.com/u/robbertkl)\
**Post date:** [May 4, 2016, 8:09am UTC](https://forums.suse.com/t/persistent-sysctl-configuration/1391/9 "2016-05-04T08:09:50Z")

</div>

See [https://github.com/rancher/os/issues/908](https://github.com/rancher/os/issues/908). Values as object properties is even nicer, I’ll add it.
