# Write\_files to NTP container

**URL:** <https://forums.suse.com/t/write-files-to-ntp-container/4257>\
**Category:** RancherOS\
**Created:** [October 11, 2016, 10:03am UTC](https://forums.suse.com/t/write-files-to-ntp-container/4257 "2016-10-11T10:03:51Z")\
**Posts on this page:** 7\
**Page:** 1

<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:** [October 11, 2016, 10:03am UTC](https://forums.suse.com/t/write-files-to-ntp-container/4257/1 "2016-10-11T10:03:51Z")

</div>

I’m using RancherOS v0.6.0 and v0.6.1 and attempting to write an alternative ntp.conf file using write\_files. It’s simply not working. Here’s what I put in my user\_config.yml file:

```auto
write_files:
  - container: ntp
    path: /etc/ntp.conf
    permissions: "0644"
    owner: root
    content: |
      server x.x.x.x iburst
      # Allow only time queries, at a limited rate, sending KoD when in excess.
      # Allow all local queries (IPv4, IPv6)
      restrict default nomodify nopeer noquery limited kod
      restrict 127.0.0.1
      restrict [::1]
      interface ignore wildcard #Don't listen on all interfaces
      interface listen ipv4 127.0.0.1
      interface listen ipv6 ::1
      # Docker/Rancher Bridge Interfaces
      interface listen ipv4 172.17.0.1
      interface listen ipv4 10.42.0.1

```

But on reboot, the file is unchanged:

```
-rw-r--r-- 21 root root 317 Aug 17 16:22 /etc/ntp.conf

```

Writing files to the default console container works just fine and I’ve tried removing that in case it was interfering - no difference.

---

<div class="post-metadata">

**Author:** ![joshwget](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/joshwget/32/704_2.png) [@joshwget](https://forums.suse.com/u/joshwget)\
**Post date:** [October 14, 2016, 5:59am UTC](https://forums.suse.com/t/write-files-to-ntp-container/4257/2 "2016-10-14T05:59:34Z")

</div>

Can you show the output of `system-docker logs ntp` and `system-docker exec ntp cat /etc/ntp.conf`?

---

<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:** [October 14, 2016, 9:15am UTC](https://forums.suse.com/t/write-files-to-ntp-container/4257/3 "2016-10-14T09:15:29Z")

</div>

Hey @joshwget, thanks for taking a look.

Here’s the start of the ntp container log:

```auto
 5 Oct 16:26:13 ntpd[1]: ntpd 4.2.8p7@1.3265-o Wed Aug 17 16:22:57 UTC 2016 (1): Starting
 5 Oct 16:26:13 ntpd[1]: Command line: ntpd --nofork -g
 5 Oct 16:26:13 ntpd[1]: proto: precision = 0.100 usec (-23)
 5 Oct 16:26:13 ntpd[1]: Listen and drop on 0 v6wildcard [::]:123
 5 Oct 16:26:13 ntpd[1]: Listen and drop on 1 v4wildcard 0.0.0.0:123
 5 Oct 16:26:13 ntpd[1]: Listen normally on 2 lo 127.0.0.1:123
 5 Oct 16:26:13 ntpd[1]: Listen normally on 3 app0 192.168.65.231:123
 5 Oct 16:26:13 ntpd[1]: Listen normally on 4 lo [::1]:123
 5 Oct 16:26:13 ntpd[1]: bind(21) AF_INET6 fe80::215:5dff:fec8:760b%5#123 flags 0x11 failed: Cannot assign requested address
 5 Oct 16:26:13 ntpd[1]: unable to create socket on app0 (5) for fe80::215:5dff:fec8:760b%5#123
 5 Oct 16:26:13 ntpd[1]: failed to init interface for address fe80::215:5dff:fec8:760b%5
 5 Oct 16:26:13 ntpd[1]: Listening on routing socket on fd #21 for interface updates
 5 Oct 16:26:17 ntpd[1]: Listen normally on 6 mgmt0 192.168.82.231:123
 5 Oct 16:26:17 ntpd[1]: bind(25) AF_INET6 fe80::215:5dff:fec8:760c%3#123 flags 0x11 failed: Cannot assign requested address
 5 Oct 16:26:17 ntpd[1]: unable to create socket on mgmt0 (7) for fe80::215:5dff:fec8:760c%3#123
 5 Oct 16:26:17 ntpd[1]: failed to init interface for address fe80::215:5dff:fec8:760c%3

```

The rest is just this sort of thing (which is why I want to change the config :-):

```auto
 7 Oct 22:08:34 ntpd[1]: failed to init interface for address fe80::215:5dff:fec8:760c%3
 7 Oct 22:08:34 ntpd[1]: failed to init interface for address fe80::215:5dff:fec8:760b%5
 8 Oct 19:47:14 ntpd[1]: bind(39) AF_INET6 fe80::215:5dff:fec8:760c%3#123 flags 0x11 failed: Cannot assign requested address
 8 Oct 19:47:14 ntpd[1]: unable to create socket on mgmt0 (2200) for fe80::215:5dff:fec8:760c%3#123
 7 Oct 22:08:36 ntpd[1]: failed to init interface for address fe80::215:5dff:fec8:760c%3
 8 Oct 19:47:14 ntpd[1]: bind(39) AF_INET6 fe80::215:5dff:fec8:760b%5#123 flags 0x11 failed: Cannot assign requested address
 8 Oct 19:47:14 ntpd[1]: unable to create socket on app0 (2201) for fe80::215:5dff:fec8:760b%5#123
 8 Oct 19:48:29 ntpd[1]: bind(39) AF_INET6 fe80::215:5dff:fec8:760c%3#123 flags 0x11 failed: Cannot assign requested address

```

The output of the cat is:

```auto
server 192.168.82.254 iburst
# Allow only time queries, at a limited rate, sending KoD when in excess.
# Allow all local queries (IPv4, IPv6)
restrict default nomodify nopeer noquery limited kod
restrict 127.0.0.1
restrict [::1]
interface ignore wildcard #Don't listen on all interfaces
interface listen ipv4 127.0.0.1
interface listen ipv6 ::1
# Docker/Rancher Bridge Interfaces
interface listen ipv4 172.17.0.1
interface listen ipv4 10.42.0.1

```

---

<div class="post-metadata">

**Author:** ![joshwget](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/joshwget/32/704_2.png) [@joshwget](https://forums.suse.com/u/joshwget)\
**Post date:** [October 17, 2016, 5:39pm UTC](https://forums.suse.com/t/write-files-to-ntp-container/4257/4 "2016-10-17T17:39:07Z")

</div>

Did you put `#cloud-config` at the top of your file? I tested your exact cloud-config (with that added to the top) and was able to see the file changed.

---

<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:** [October 18, 2016, 10:03am UTC](https://forums.suse.com/t/write-files-to-ntp-container/4257/5 "2016-10-18T10:03:53Z")

</div>

OK, so I’ve just noticed the exec command shows the correct configuration (as I posted earlier) with or without that in place. So Presumably I can ignore the /etc/ntp.conf file as seen in the console container.

I’m not seeing the desired affect but that’s another problem for me, not you. Many thanks.

---

<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:** [November 24, 2016, 4:42pm UTC](https://forums.suse.com/t/write-files-to-ntp-container/4257/6 "2016-11-24T16:42:25Z")

</div>

OK, was looking in the wrong place. Have this working now. For the benefit of others, my configuration file was wrong too, here the corrected version;

```auto
write_files:
  - container: ntp
    path: /etc/ntp.conf
    permissions: "0644"
    owner: root
    content: |
      server x.x.x.x iburst
      # Allow only time queries, at a limited rate, sending KoD when in excess.
      # Allow all local queries (IPv4, IPv6)
      restrict default nomodify nopeer noquery limited kod
      restrict 127.0.0.1
      restrict [::1]
      interface ignore wildcard #Don't listen on all interfaces
      interface listen 127.0.0.1
      interface listen ::1
      # Docker/Rancher Bridge Interfaces
      interface listen 172.17.0.1
      interface listen 10.42.0.1

```

---

<div class="post-metadata">

**Author:** ![Ledezzz3](https://avatars.discourse-cdn.com/v4/letter/l/f05b48/32.png) [@Ledezzz3](https://forums.suse.com/u/Ledezzz3)\
**Post date:** [November 25, 2020, 9:11pm UTC](https://forums.suse.com/t/write-files-to-ntp-container/4257/7 "2020-11-25T21:11:57Z")

</div>

I put same code from manual and yours and still /etc/ntp.conf is not created by the system and filled out with settings.

Perhaps, you know what else should I look for on my OS?
