[GH-ISSUE #3801] --get outputs empty file when using --chroot #2403

Closed
opened 2026-05-05 09:04:54 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @mateuszlewko on GitHub (Dec 9, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3801

Getting file with --get returns empty file when using firejail with --chroot option.

Reproduce

  1. sudo firejail --noprofile --chroot=path_to_some_root_directory --name=main1)
  2. In the main1 jail: echo "abcd" > /root/file.txt.
  3. Outside of jail (on host): sudo firejail --get=main1 /root/file.txt.
  4. Print the file content: sudo cat file.text. Output is empty, expected: abcd.

Environment

  • Linux distribution and version: Arch linux.
  • firejail version 0.9.64

Additional context
--get works as expected when not using chroot.

Checklist

  • A short search for duplicates was performed.
debug output
firejail --debug --get=main1 /root/file.txt
Switching to pid 53682, the first child process inside the sandbox
file1 /root/file.txt
file2 (null)
copy /root/file.txt to file.txt
Drop privileges: pid 53860, uid 0, gid 0, nogroups 0
No supplementary groups
Drop privileges: pid 53861, uid 0, gid 0, nogroups 0
No supplementary groups
Originally created by @mateuszlewko on GitHub (Dec 9, 2020). Original GitHub issue: https://github.com/netblue30/firejail/issues/3801 Getting file with --get returns empty file when using firejail with --chroot option. **Reproduce** 1. `sudo firejail --noprofile --chroot=path_to_some_root_directory --name=main1)` 2. In the `main1` jail: `echo "abcd" > /root/file.txt`. 3. Outside of jail (on host): `sudo firejail --get=main1 /root/file.txt`. 4. Print the file content: `sudo cat file.text`. Output is empty, expected: `abcd`. **Environment** - Linux distribution and version: Arch linux. - `firejail version 0.9.64` **Additional context** `--get` works as expected when not using chroot. **Checklist** - [x] A short search for duplicates was performed. <details><summary> debug output </summary> ``` firejail --debug --get=main1 /root/file.txt Switching to pid 53682, the first child process inside the sandbox file1 /root/file.txt file2 (null) copy /root/file.txt to file.txt Drop privileges: pid 53860, uid 0, gid 0, nogroups 0 No supplementary groups Drop privileges: pid 53861, uid 0, gid 0, nogroups 0 No supplementary groups ``` </details>
Author
Owner

@mateuszlewko commented on GitHub (Dec 9, 2020):

It turns out that --put also doesn't work with --chroot. This time it simply throws an error.

sudo firejail --put=main1 file.txt /root/some-file.txt
[sudo] password for <user>:
Switching to pid 63251, the first child process inside the sandbox
Warning: cannot open source file /run/firejail/tmpget-T1Bb0j, file not copied
<!-- gh-comment-id:741862154 --> @mateuszlewko commented on GitHub (Dec 9, 2020): It turns out that `--put` also doesn't work with `--chroot`. This time it simply throws an error. ``` sudo firejail --put=main1 file.txt /root/some-file.txt [sudo] password for <user>: Switching to pid 63251, the first child process inside the sandbox Warning: cannot open source file /run/firejail/tmpget-T1Bb0j, file not copied ```
Author
Owner

@mateuszlewko commented on GitHub (Dec 10, 2020):

Is that the expected behaviour or is something wrong on my side or is it a bug in firejail?

<!-- gh-comment-id:742819514 --> @mateuszlewko commented on GitHub (Dec 10, 2020): Is that the expected behaviour or is something wrong on my side or is it a bug in firejail?
Author
Owner

@rusty-snake commented on GitHub (Dec 11, 2020):

It should be supported IMHO, but maybe it's a technical limitation that IDK. Note, there was #3752 maybe this has fixes it on master?

<!-- gh-comment-id:743083530 --> @rusty-snake commented on GitHub (Dec 11, 2020): It should be supported IMHO, but maybe it's a technical limitation that IDK. Note, there was #3752 maybe this has fixes it on master?
Author
Owner

@mateuszlewko commented on GitHub (Dec 11, 2020):

Getting file is working on firejail version 0.9.65, however, --put still doesn't work.

<!-- gh-comment-id:743207662 --> @mateuszlewko commented on GitHub (Dec 11, 2020): Getting file is working on firejail version 0.9.65, however, `--put` still doesn't work.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#2403
No description provided.