Skip to content

teuthology/orchestra/remote.py: write remote file without sudo#1465

Merged
tchaikov merged 1 commit intoceph:masterfrom
tchaikov:remote-sudo-tar
May 7, 2020
Merged

teuthology/orchestra/remote.py: write remote file without sudo#1465
tchaikov merged 1 commit intoceph:masterfrom
tchaikov:remote-sudo-tar

Conversation

@tchaikov
Copy link
Contributor

@tchaikov tchaikov commented May 7, 2020

the remote file is created using "ubuntu" user. in ubuntu xenial,
superuser is able to write to that file using tar, it seems that "tar"
starts another process when writing to the dest file specified by "-f",
and that process does not have the privilege for writing that file.

so when we are trying to archive a directory on ubuntu/focal test node,
we have following error:

tar (child): /tmp/tmp.vkl0kAtc06: Cannot open: Permission denied
tar (child): Error is not recoverable: exiting now
tar: /tmp/tmp.vkl0kAtc06: Cannot write: Broken pipe
tar: Child returned status 2
tar: Error is not recoverable: exiting now

and this is reproduciable with tar 1.30:

$ touch /tmp/helloworld
$ mkdir /tmp/foobar
$ sudo tar czf /tmp/helloworld -C /tmp/foobar -- .
tar (child): /tmp/helloworld: Cannot open: Permission denied
tar (child): Error is not recoverable: exiting now
tar: /tmp/helloworld: Cannot write: Broken pipe
tar: Child returned status 2
tar: Error is not recoverable: exiting now

but we can workaround this by writing the temp file using "ubuntu" user, like

sudo tar czf - -C /tmp/foobar -- . > /tmp/helloworld

Signed-off-by: Kefu Chai kchai@redhat.com

the remote file is created using "ubuntu" user. in ubuntu xenial,
superuser is able to write to that file using tar, it seems that "tar"
starts another process when writing to the dest file specified by "-f",
and that process does not have the privilege for writing that file.

so when we are trying to archive a directory on ubuntu/focal test node,
we have following error:
```
tar (child): /tmp/tmp.vkl0kAtc06: Cannot open: Permission denied
tar (child): Error is not recoverable: exiting now
tar: /tmp/tmp.vkl0kAtc06: Cannot write: Broken pipe
tar: Child returned status 2
tar: Error is not recoverable: exiting now
```

and this is reproduciable with tar 1.30:
```
$ touch /tmp/helloworld
$ mkdir /tmp/foobar
$ sudo tar czf /tmp/helloworld -C /tmp/foobar -- .
tar (child): /tmp/helloworld: Cannot open: Permission denied
tar (child): Error is not recoverable: exiting now
tar: /tmp/helloworld: Cannot write: Broken pipe
tar: Child returned status 2
tar: Error is not recoverable: exiting now
```

but we can workaround this by writing the temp file using "ubuntu" user, like
```
sudo tar czf - -C /tmp/foobar -- . > /tmp/helloworld
```

Signed-off-by: Kefu Chai <kchai@redhat.com>
@tchaikov
Copy link
Contributor Author

tchaikov commented May 7, 2020

this change should address the failures like

Command failed on smithi154 with status 2: 'sudo tar cz -f /tmp/tmp.PUZDktKgOH -C /var/lib/ceph/mon/ceph-a -- .'

see http://pulpito.ceph.com/kchai-2020-05-07_01:56:16-rados-wip-kefu-testing-2020-05-05-1333-distro-basic-smithi/

@tchaikov tchaikov requested review from jdurgin and yuriw May 7, 2020 05:04
@tchaikov
Copy link
Contributor Author

tchaikov commented May 7, 2020

i think these failures is a regression introduced by ceph/ceph#34894

@tchaikov tchaikov merged commit 28c1ab5 into ceph:master May 7, 2020
@tchaikov tchaikov deleted the remote-sudo-tar branch May 7, 2020 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants