# umount: /tmp: target is busy - payload files?

**URL:** <https://forum.ansible.com/t/umount-tmp-target-is-busy-payload-files/30569>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [June 13, 2019, 7:21pm UTC](https://forum.ansible.com/t/umount-tmp-target-is-busy-payload-files/30569 "2019-06-13T19:21:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Georg\_Grossmann](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Georg\_Grossmann](https://forum.ansible.com/u/Georg_Grossmann)\
**Post date:** [June 13, 2019, 7:21pm UTC](https://forum.ansible.com/t/umount-tmp-target-is-busy-payload-files/30569/1 "2019-06-13T19:21:53Z")

</div>

Hi!

I am using a playbook `from github created by Reiner Nippes to setup a nextcloud server. I changed quite some things to be able to run it on OpenSuse Tumbleweed.

Before running the playbook, /etc/fstab looks like the following:  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 / btrfs defaults 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /.snapshots btrfs subvol=/@/.snapshots 0 0  
UUID=9d812efe-44e4-4594-affe-37299672ad9e swap swap defaults 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /var btrfs subvol=/@/var 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /usr/local btrfs subvol=/@/usr/local 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /srv btrfs subvol=/@/srv 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /root btrfs subvol=/@/root 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /opt btrfs subvol=/@/opt 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /home btrfs subvol=/@/home 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /boot/grub2/x86\_64-efi btrfs subvol=/@/boot/grub2/x86\_64-efi 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /boot/grub2/i386-pc btrfs subvol=/@/boot/grub2/i386-pc 0 0  
UUID=7388-F693 /boot/efi vfat defaults 0 0

In the playbook there is a task to mount /tmp as tmpfs:

- name: mount tmp fs  
mount:  
src: “tmpfs”  
path: “{{ item }}”  
fstype: tmpfs  
opts: “defaults,noatime,nosuid,nodev,noexec,mode=1777”  
passno: “0”  
state: mounted  
with\_items:
- /tmp
- /var/tmp

The first time I run the playbook, I get this error:  
failed: [nextcloud] (item=/tmp) =\> {“ansible\_loop\_var”: “item”, “changed”: false, “item”: “/tmp”, “msg”: "Error mounting /tmp: umount: /tmp: target is busy.

and the file /etc/fstab has a new entry afterwards:  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 / btrfs defaults 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /.snapshots btrfs subvol=/@/.snapshots 0 0  
UUID=9d812efe-44e4-4594-affe-37299672ad9e swap swap defaults 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /var btrfs subvol=/@/var 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /usr/local btrfs subvol=/@/usr/local 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /srv btrfs subvol=/@/srv 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /root btrfs subvol=/@/root 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /opt btrfs subvol=/@/opt 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /home btrfs subvol=/@/home 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /boot/grub2/x86\_64-efi btrfs subvol=/@/boot/grub2/x86\_64-efi 0 0  
UUID=a34c85bd-79d2-4145-8772-04be970fe413 /boot/grub2/i386-pc btrfs subvol=/@/boot/grub2/i386-pc 0 0  
UUID=7388-F693 /boot/efi vfat defaults 0 0  
tmpfs /tmp tmpfs defaults,noatime,nosuid,nodev,noexec,mode=1777 0 0

When I run the playbook a second time, I don’t get the error anymore and all is fine.

I executed “watch -n 1 ls -l /tmp/” to perodically check if ansible is writing anything to /tmp, and yes, it is!

There are some temporary files which appear and disapear during the execution. I already added the following two lines to my ansible.cfg file:  
local\_tmp = /tmp2  
remote\_tmp = /tmp2

Unfortunately, there are still these “payload” files appearing in /tmp.

1. Where do they come from? What do they contain and how can I change the directory for these files?

I guess these payload files are the reason why the mount module fails in the first place.

1. Am I doing something wrong?

2. Is a workaround possible?

3. Has it something to do with the BTRFS filesystem? On Ubuntu this mount task is working…

4. Why is it trying to umount at all? I want it to mount /tmp

I have also made a desktop capture of this behavior: [https://drive.google.com/open?id=1Ta2-x4wUgoz1Ig3jabooHwVJV4l-SyQ1](https://drive.google.com/open?id=1Ta2-x4wUgoz1Ig3jabooHwVJV4l-SyQ1)

Thanks a lot for your help!

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [June 14, 2019, 6:24pm UTC](https://forum.ansible.com/t/umount-tmp-target-is-busy-payload-files/30569/2 "2019-06-14T18:24:25Z")

</div>

> Hi!
> 
> I am using a playbook `from github created by Reiner Nippes to setup a  
> nextcloud server. I changed quite some things to be able to run it on  
> OpenSuse Tumbleweed.

\<snip /\>

> In the playbook there is a task to mount /tmp as tmpfs:
> 
> - name: mount tmp fs  
> &nbsp;&nbsp;&nbsp;mount:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;src: "tmpfs"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;path: "{{ item }}"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fstype: tmpfs  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;opts: "defaults,noatime,nosuid,nodev,noexec,mode=1777"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;passno: "0"  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;state: mounted  
> &nbsp;&nbsp;&nbsp;with\_items:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- /tmp  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- /var/tmp

/var/tmp is defined as a persistent tmp, and changing this to tmpfs might break other software that depends on /var/tmp being persistent.

And changing them on a running system is not recommended since other software might be using the tmp.  
The best approach is to use state: present and reboot.

> I executed "watch -n 1 ls -l /tmp/" to perodically check if ansible is  
> writing anything to /tmp, and yes, it is!  
> There are some temporary files which appear and disapear during the  
> execution. I already added the following two lines to my ansible.cfg file:  
> local\_tmp = /tmp2  
> remote\_tmp = /tmp2

Default they are pointing to ~/.ansible/tmp

> Unfortunately, there are still these "payload" files appearing in /tmp.  
> 1. Where do they come from? What do they contain and how can I change the  
> directory for these files?  
> I guess these payload files are the reason why the mount module fails in  
> the first place.

A grep in the source it seams that some module and plugins have /tmp hard coded and maybe the code you are running is creating files in tmp.

> 2. Am I doing something wrong?

Sort of, use present and reboot.

> 3. Is a workaround possible?

See 2.

> 4. Has it something to do with the BTRFS filesystem? On Ubuntu this mount  
> task is working...

No.

---

<div class="post-metadata">

**Author:** ![Georg\_Grossmann](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Georg\_Grossmann](https://forum.ansible.com/u/Georg_Grossmann)\
**Post date:** [June 16, 2019, 5:56pm UTC](https://forum.ansible.com/t/umount-tmp-target-is-busy-payload-files/30569/3 "2019-06-16T17:56:43Z")

</div>

Ok, I just googled a bit and I think I will only mount /tmp as tmpfs. I will not change the mount for /var/tmp.

So now I am using:

- name: mount tmp fs  
mount:  
src: “tmpfs”  
path: “{{ item }}”  
fstype: tmpfs  
opts: “defaults,noatime,nosuid,nodev,noexec,mode=1777”

passno: “0”  
state: present  
with\_items:

- /tmp

Thanks a lot, you are awesome!
