# Build\_plugin gives "permission denied: 'top\_level.txt'" when not executed as root

**URL:** <https://community.dynatrace.com/t/build-plugin-gives-permission-denied-top-level-txt-when-not-executed-as-root/33676>\
**Category:** Extensions\
**Tags:** python, extensions\
**Created:** [January 4, 2022, 3:26pm UTC](https://community.dynatrace.com/t/build-plugin-gives-permission-denied-top-level-txt-when-not-executed-as-root/33676 "2022-01-04T15:26:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bert\_VanderHeyd](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/bert_vanderheyd/32/162_2.png) [@Bert\_VanderHeyd](https://community.dynatrace.com/u/Bert_VanderHeyd)\
**Post date:** [January 4, 2022, 3:26pm UTC](https://community.dynatrace.com/t/build-plugin-gives-permission-denied-top-level-txt-when-not-executed-as-root/33676/1 "2022-01-04T15:26:22Z")

</div>

Hey Community,

I guess this is more a python thingy but I only have this recently when moving to the latest sdk and Python3.8.

Problem is that building a plugin fails with message:&nbsp;Error occured: [Errno 13] Permission denied: ‘top\_level.txt’

(I will include the entire log with verbose)

I have checked the entire system for top\_level.txt files and the permissions on them and they are all ok. I guess that the build process has this file open at the moment it wants to do something with it.  
Running it with root (sudo) seems to work, but then all downloaded modules have the wrong privileges which is even more anoying.

I know this is a very specific one, but I hope to find some help or some tricks.

Thanks.

---

<div class="post-metadata">

**Author:** ![Bert\_VanderHeyd](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/bert_vanderheyd/32/162_2.png) [@Bert\_VanderHeyd](https://community.dynatrace.com/u/Bert_VanderHeyd)\
**Post date:** [January 4, 2022, 3:30pm UTC](https://community.dynatrace.com/t/build-plugin-gives-permission-denied-top-level-txt-when-not-executed-as-root/33676/2 "2022-01-04T15:30:07Z")

</div>

See attached log.  
[console.out.txt](https://community.dynatrace.com/uploads/short-url/diVGkXJphcqEZhQSgeJeo2WAFC3.txt) (219 KB)

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [January 4, 2022, 9:41pm UTC](https://community.dynatrace.com/t/build-plugin-gives-permission-denied-top-level-txt-when-not-executed-as-root/33676/3 "2022-01-04T21:41:33Z")

</div>

Hi&nbsp;[@Bert\_VanderHeyd](https://community.dynatrace.com/user/11940)&nbsp;,

it looks like an issue with python virtual environment. How do you have it installed? Maybe you could try it with the default system-wide python.

Julius

---

<div class="post-metadata">

**Author:** ![Bert\_VanderHeyd](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/bert_vanderheyd/32/162_2.png) [@Bert\_VanderHeyd](https://community.dynatrace.com/u/Bert_VanderHeyd)\
**Post date:** [January 5, 2022, 8:06am UTC](https://community.dynatrace.com/t/build-plugin-gives-permission-denied-top-level-txt-when-not-executed-as-root/33676/4 "2022-01-05T08:06:25Z")

</div>

I am using venv to be able to switch to 3.8. When I build with 3.6 (system wide python) I get exactly the same error.

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [January 5, 2022, 8:53pm UTC](https://community.dynatrace.com/t/build-plugin-gives-permission-denied-top-level-txt-when-not-executed-as-root/33676/5 "2022-01-05T20:53:37Z")

</div>

I’d try run strace on the plugin\_sdk build\_plugin and see where and why it fails:

```markup
strace -f -o /tmp/build_plugin.txt plugin_sdk build_plugin

```

Can you share the output here?

---

<div class="post-metadata">

**Author:** ![Bert\_VanderHeyd](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/bert_vanderheyd/32/162_2.png) [@Bert\_VanderHeyd](https://community.dynatrace.com/u/Bert_VanderHeyd)\
**Post date:** [January 6, 2022, 10:25am UTC](https://community.dynatrace.com/t/build-plugin-gives-permission-denied-top-level-txt-when-not-executed-as-root/33676/6 "2022-01-06T10:25:46Z")

</div>

Here you go.

Looks like it has to do with the removal of a temp directory.  
rmdir(“/tmp/tmppc7q0iw\_”)  
[build\_plugin.txt](https://community.dynatrace.com/uploads/short-url/d0Hw2sniPbZWmTTr8zrVtSysdH5.txt) (1.29 MB)

---

<div class="post-metadata">

**Author:** ![Bert\_VanderHeyd](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/bert_vanderheyd/32/162_2.png) [@Bert\_VanderHeyd](https://community.dynatrace.com/u/Bert_VanderHeyd)\
**Post date:** [February 11, 2022, 2:34pm UTC](https://community.dynatrace.com/t/build-plugin-gives-permission-denied-top-level-txt-when-not-executed-as-root/33676/7 "2022-02-11T14:34:49Z")

</div>

The reason was very simple… I was running the build from within the directory containing the sources. Just moving one dir up did the trick.

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [June 11, 2022, 7:48pm UTC](https://community.dynatrace.com/t/build-plugin-gives-permission-denied-top-level-txt-when-not-executed-as-root/33676/8 "2022-06-11T19:48:28Z")

</div>

Had a very similar issue with the file “METADATA” instead of “top\_level.txt”.

In my case, it was that in the directory /opt/dynatrace/remotepluginmodule/plugin\_deployment  
the directory for the extension was owned by root.

Deleting that directory and building again had no issue.
