[GH-ISSUE #5336] firejail --private fails if the root user home directory is not /root #2960

Open
opened 2026-05-05 09:37:25 -06:00 by gitea-mirror · 10 comments
Owner

Originally created by @birdie-github on GitHub (Aug 23, 2022).
Original GitHub issue: https://github.com/netblue30/firejail/issues/5336

Using firejail-0.9.66-3.fc36.x86_64.

According to /etc/passwd my root user home directory is elsewhere, precisely in /home/root.

firejail --private fails in this case:

Mounting a new /root directory
Error mounting /root directory: fs_home.c:371 fs_private: No such file or directory
Error: proc 274926 cannot sync with peer: unexpected EOF
Peer 274927 unexpectedly exited with status 1

The location of the root directory must be read programmatically instead of being assumed to be /root, e.g. using

https://stackoverflow.com/a/26696759

Originally created by @birdie-github on GitHub (Aug 23, 2022). Original GitHub issue: https://github.com/netblue30/firejail/issues/5336 Using firejail-0.9.66-3.fc36.x86_64. According to `/etc/passwd` my root user home directory is elsewhere, precisely in `/home/root`. `firejail --private` fails in this case: ``` Mounting a new /root directory Error mounting /root directory: fs_home.c:371 fs_private: No such file or directory Error: proc 274926 cannot sync with peer: unexpected EOF Peer 274927 unexpectedly exited with status 1 ``` The location of the root directory must be read programmatically instead of being assumed to be `/root`, e.g. using https://stackoverflow.com/a/26696759
gitea-mirror added the
bug
label 2026-05-05 09:37:25 -06:00
Author
Owner

@birdie-github commented on GitHub (Aug 24, 2022):

0.9.70 is affected as well. The root home directory must not be hard coded.

<!-- gh-comment-id:1225769233 --> @birdie-github commented on GitHub (Aug 24, 2022): 0.9.70 is affected as well. The root home directory must not be hard coded.
Author
Owner

@rusty-snake commented on GitHub (Aug 28, 2022):

FWIW: Firejail assumes a lot paths to be at the standard location and shows unexpected results if a system differs much from FHS and XDG standards. In some case this can not be avoided.

Anyway labeling as bug.

<!-- gh-comment-id:1229506966 --> @rusty-snake commented on GitHub (Aug 28, 2022): FWIW: Firejail assumes a lot paths to be at the standard location and shows unexpected results if a system differs much from FHS and XDG standards. In some case this can not be avoided. Anyway labeling as bug.
Author
Owner

@birdie-github commented on GitHub (Aug 28, 2022):

FWIW: Firejail assumes a lot paths to be at the standard location and shows unexpected results if a system differs much from FHS and XDG standards. In some case this can not be avoided.

Anyway labeling as bug.

/root is not defined in the FHS or POSIX standards: https://unix.stackexchange.com/questions/714726/is-root-a-hard-requirement-for-a-modern-linux-system-what-about-posix-unix

<!-- gh-comment-id:1229508070 --> @birdie-github commented on GitHub (Aug 28, 2022): > FWIW: Firejail assumes a lot paths to be at the standard location and shows unexpected results if a system differs much from FHS and XDG standards. In some case this can not be avoided. > > Anyway labeling as bug. `/root` is _not_ defined in the FHS or POSIX standards: https://unix.stackexchange.com/questions/714726/is-root-a-hard-requirement-for-a-modern-linux-system-what-about-posix-unix
Author
Owner

@rusty-snake commented on GitHub (Aug 28, 2022):

It is defined in the FHS. Read the answer on your link/question. You are correct that it isn't a hard requirement but it is the suggested/standard path of it. And that's what I said, firejail assumes standard/suggested paths in a lot places.

<!-- gh-comment-id:1229510475 --> @rusty-snake commented on GitHub (Aug 28, 2022): It _is_ defined in the FHS. Read the answer on your link/question. You are correct that it isn't a hard requirement but it is the suggested/standard path of it. And that's what I said, firejail assumes standard/suggested paths in a lot places.
Author
Owner

@birdie-github commented on GitHub (Feb 13, 2023):

I guess no one will fix this issue, are there any firejail alternatives?

<!-- gh-comment-id:1427816564 --> @birdie-github commented on GitHub (Feb 13, 2023): I guess no one will fix this issue, are there any firejail alternatives?
Author
Owner

@rusty-snake commented on GitHub (Feb 13, 2023):

Depends on your usage and required features. Maybe https://github.com/igo95862/bubblejail.

<!-- gh-comment-id:1428258028 --> @rusty-snake commented on GitHub (Feb 13, 2023): Depends on your usage and required features. Maybe https://github.com/igo95862/bubblejail.
Author
Owner

@ghost commented on GitHub (Feb 13, 2023):

According to /etc/passwd my root user home directory is elsewhere, precisely in /home/root.

Have you run in any other trouble, besides firejail --private issues, with such a setup? Can you re-assign root's home to /root or isn't that an option? I realize this is probably not a very useful response, but did your OS configure root like this? What OS are we talking about here?

<!-- gh-comment-id:1428398737 --> @ghost commented on GitHub (Feb 13, 2023): > According to /etc/passwd my root user home directory is elsewhere, precisely in /home/root. Have you run in any other trouble, besides firejail --private issues, with such a setup? Can you re-assign root's home to /root or isn't that an option? I realize this is probably not a very useful response, but did your OS configure root like this? What OS are we talking about here?
Author
Owner

@birdie-github commented on GitHub (Feb 13, 2023):

I could have posted a patch to find out the real root home directory but I feel like the main developer(s) behind the project totally oppose this idea, so ok, never mind.

As for the location of my root home directory: my / filesystem is non-essential and I don't care about it, that's why I moved /root to a different location (/home/root). I did it by choice and everything works just fine.

I'm closing this feature request/bug report and uninstalling the application. Sorry for the noise.

<!-- gh-comment-id:1428407115 --> @birdie-github commented on GitHub (Feb 13, 2023): I could have posted a patch to find out the real root home directory but I feel like the main developer(s) behind the project totally oppose this idea, so ok, never mind. As for the location of my root home directory: my `/` filesystem is non-essential and I don't care about it, that's why I moved /root to a different location (/home/root). I did it by choice and everything works just fine. I'm closing this feature request/bug report and uninstalling the application. Sorry for the noise.
Author
Owner

@rusty-snake commented on GitHub (Feb 13, 2023):

Still a bug, reopening.

<!-- gh-comment-id:1428503229 --> @rusty-snake commented on GitHub (Feb 13, 2023): Still a bug, reopening.
Author
Owner

@rusty-snake commented on GitHub (Feb 13, 2023):

The problem seems to be more that /root does not exists rather than $HOME for uid0 isn't /root.

a67bb37b0d/src/firejail/fs_home.c (L366-L409)

	if (arg_debug)
		printf("Mounting a new /root directory\n");
	if (mount("tmpfs", "/root", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOEXEC | MS_STRICTATIME,  "mode=700,gid=0") < 0)
+               if (errno != ENOENT)
!		    errExit("mounting /root directory");
	selinux_relabel_path("/root", "/root");
	fs_logger("tmpfs /root");
<!-- gh-comment-id:1428515397 --> @rusty-snake commented on GitHub (Feb 13, 2023): The problem seems to be more that `/root` does not exists rather than `$HOME` for uid0 isn't `/root`. https://github.com/netblue30/firejail/blob/a67bb37b0ddac080008cd5cf494aaaf8531f45c0/src/firejail/fs_home.c#L366-L409 ```diff if (arg_debug) printf("Mounting a new /root directory\n"); if (mount("tmpfs", "/root", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOEXEC | MS_STRICTATIME, "mode=700,gid=0") < 0) + if (errno != ENOENT) ! errExit("mounting /root directory"); selinux_relabel_path("/root", "/root"); fs_logger("tmpfs /root"); ```
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#2960
No description provided.