Skip to content

File Ownership Issue in 'send collectd configuration to device' #3143

@k-butz

Description

@k-butz

Describe the bug
I am experiencing an unexpected behaviour when updating a certain configuration file (/etc/collectd/collectd.conf) via thin-edge from Cumulocity. The same operation succeeds only every second try, the others in between failing with:

config-manager failed downloading a file: Error while performing a file operation: Could not move file from "/tmp/collectd.conf.tmp" to "/tmp/collectd.conf": Failed to change owner: "/tmp/collectd.conf". 

See reproduction steps to make the problem clear.

To Reproduce

  1. Have a Cumulocity tenant and bootstrap a thin-edge device via https://github.com/thin-edge/tedge-demo-container
  2. Go to your Device in Cumulocity and check current configuration of the tedge-configuration-plugin:
files = [
    { path = '/etc/tedge/tedge.toml', type = 'tedge.toml', user = 'tedge', group = 'tedge', mode = 0o444 },
    { path = '/etc/tedge/plugins/tedge-log-plugin.toml', type = 'tedge-log-plugin', user = 'tedge', group = 'tedge', mode = 0o644 },
    { path = '/etc/tedge/system.toml', type = 'system.toml', user = 'tedge', group = 'tedge', mode = 0o444 },
    { path = '/etc/mosquitto/conf.d/mosquitto.conf', type = 'mosquitto.conf', user = 'root', group = 'root', mode = 0o644 },
    { path = '/etc/collectd/collectd.conf', type = 'collectd.conf', user = 'root', group = 'root', mode = 0o644 },
    { path = '/etc/c8y-command-plugin/env', type = 'shell', user = 'tedge', group = 'tedge', mode = 0o644 },
]
  1. Within Configuration tab select collectd and get snapshot from Device. Click on save to repository once it's there.
  2. Stay on Configuration tab and send the collectd file (which you've just saved to repo) to the Device:
  • First try: it fails with Failed to change owner: "/tmp/collectd.conf"
  • Second try (on same device and same file): Now the operation succeeds.
  • Third try: it fails with Failed to change owner: "/tmp/collectd.conf"
  • Fourth try: succeeds
    ...and so on.

Environment (please complete the following information):

  • thin-edge.io version 1.3.0
  • Environment: reproducible in tedge-demo-container, also reproducible on a Pi5

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions