# The destination directory (/sys/module/nvme\_core/parameters) is not writable by the current user

**URL:** <https://forum.ansible.com/t/the-destination-directory-sys-module-nvme-core-parameters-is-not-writable-by-the-current-user/30895>\
**Category:** Ansible Project\
**Created:** [July 29, 2019, 8:29pm UTC](https://forum.ansible.com/t/the-destination-directory-sys-module-nvme-core-parameters-is-not-writable-by-the-current-user/30895 "2019-07-29T20:29:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CaptainBrewing](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@CaptainBrewing](https://forum.ansible.com/u/CaptainBrewing)\
**Post date:** [July 29, 2019, 8:29pm UTC](https://forum.ansible.com/t/the-destination-directory-sys-module-nvme-core-parameters-is-not-writable-by-the-current-user/30895/1 "2019-07-29T20:29:22Z")

</div>

Hello,

I am using an Ansible Role to copy a template file. It is not allowing me saying… “The destination directory (/sys/module/nvme\_core/parameters) is not writable by the current user”

**Here is the execution of the play**

[root@ip-172-29-100-198 roles]# **ansible-playbook -u root --ask-pass storage\_timeout.yml**  
SSH password:

PLAY [172.29.100.194] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [storage\_timeout\_aws : template] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: OSError: [Errno 2] No such file or directory: ‘/sys/module/nvme\_core/parameters/.ansible\_tmpxo2cR0io\_timeout’  
fatal: [172.29.100.194]: FAILED! =\> {“changed”: false, “checksum”: “e431bd404db55f2205c3ae4074e3f6de2fb2eb71”, “msg”: “The destination directory (/sys/module/nvme\_core/parameters) is not writable by the current user. Error was: [Errno 2] No such file or directory: ‘/sys/module/nvme\_core/parameters/.ansible\_tmpxo2cR0io\_timeout’”}

**Here is the template. Very simple**

[root@ip-172-29-100-198 roles]# **cat storage\_timeout\_aws/templates/io\_timeout**  
255

- The current value is 30

**Here is the Task**

[root@ip-172-29-100-198 roles]# **cat storage\_timeout\_aws/tasks/main.yml**

---

<div class="post-metadata">

**Author:** ![CaptainBrewing](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@CaptainBrewing](https://forum.ansible.com/u/CaptainBrewing)\
**Post date:** [July 29, 2019, 9:30pm UTC](https://forum.ansible.com/t/the-destination-directory-sys-module-nvme-core-parameters-is-not-writable-by-the-current-user/30895/2 "2019-07-29T21:30:13Z")

</div>

Figured it out. I needed to use the template option “unsafe\_writes: yes”

---

<div class="post-metadata">

**Author:** ![Sebastian\_Meyer](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@Sebastian\_Meyer](https://forum.ansible.com/u/Sebastian_Meyer)\
**Post date:** [July 29, 2019, 9:30pm UTC](https://forum.ansible.com/t/the-destination-directory-sys-module-nvme-core-parameters-is-not-writable-by-the-current-user/30895/3 "2019-07-29T21:30:41Z")

</div>

Hi Joe,

> I am using an Ansible Role to copy a template file. It is not allowing me  
> saying...... "The destination directory (/sys/module/nvme\_core/parameters)  
> is not writable by the current user"

> I am not sure how to proceed at this point. I have close to 100 servers  
> with this issue and it is causing some intermittent outages (apparently  
> this is a known issue with AWS NVME) Thanks for your thoughts in advance

so the problem is, /sys is a virtual file system. You (afaik) can't  
remove files from it.

What Ansible does is creating a temporary file with the desired content  
and moving it to the destination. And moving implies first removing the  
original file. The following won't work either:

echo 40 \> /tmp/io\_timeout  
mv /tmp/io\_timeout /sys/module/nvme\_core/parameters/io\_timeout

The correct solution would be setting the nvme.io\_timeout kernel  
parameter in /etc/default/grub, regenerating grub config and rebooting.

The easy solution would be something like:

&nbsp;&nbsp;&nbsp;&nbsp;- name: Get nvme.io\_timeout value  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command: /bin/cat /sys/module/nvme\_core/parameters/io\_timeout  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;register: nvme\_current\_timeout  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;changed\_when: false

&nbsp;&nbsp;&nbsp;&nbsp;- name: Set nvme.io\_timeout value  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;shell: "echo {{ nvme\_target\_timeout }} \>  
/sys/module/nvme\_core/parameters/io\_timeout"  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when: nvme\_current\_timeout.stdout|int != nvme\_target\_timeout|int

Regards,  
Sebastian

---

<div class="post-metadata">

**Author:** ![CaptainBrewing](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@CaptainBrewing](https://forum.ansible.com/u/CaptainBrewing)\
**Post date:** [July 29, 2019, 9:58pm UTC](https://forum.ansible.com/t/the-destination-directory-sys-module-nvme-core-parameters-is-not-writable-by-the-current-user/30895/4 "2019-07-29T21:58:52Z")

</div>

Thanks for that feedback. I am in the process of making a module for grub as well. The problem is that I won’t be allowed to reboot that many servers without wailing and nashing of teeth 🙂 I am going to add the temporary solution (io\_timeout) and then do the grub entry and allow the reboots to happen organically over time.
