mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #6121] dnsmasq: libvirtd cannot activate virtual network: PATH environment variable not set #3192
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#3192
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @marek22k on GitHub (Dec 10, 2023).
Original GitHub issue: https://github.com/netblue30/firejail/issues/6121
Description
I cannot activate the virtual network when firejail is activated.
Steps to reproduce the behavior
sudo virsh net-start defaultExpected behavior
The network starts.
Actual behavior
The network does not start.
Behavior without a profile
Since dnsmasq is called by libvirt, it is difficult to do this manually. However, running it after
firecfg --cleanworks.Additional context
Already reported several times, but apparently not yet resolved:
Workaround:
Environment
firejail --version).Checklist
/usr/bin/vlc) "fixes" it).https://github.com/netblue30/firejail/issues/1139)browser-allow-drm yes/browser-disable-u2f noinfirejail.configto allow DRM/U2F in browsers.Log
Output of
LC_ALL=C firejail /path/to/programOutput of
LC_ALL=C firejail --debug /path/to/programhttps://gist.github.com/marek22k/53c067d5a7e23121984dd8b6b74ebb5a
@ghost commented on GitHub (Dec 10, 2023):
The upcoming Firejail release will have override support for firecfg.config:
b02a7a337c/src/man/firecfg.1.in (L142-L187)If you use firejail-git ftom the AUR you can have that functionality now. Dropping a file like the below will disable dnsmasq sandboxing persistently:
@ShellCode33 commented on GitHub (Dec 10, 2023):
@glitsj16 ideally I'd like to keep using the dnsmasq profile. While this can be a temporary workaround, it does not solve the underlying issue
@ghost commented on GitHub (Dec 11, 2023):
@ShellCode33 Agreed, the underlying issue is still not very clear (to me).
I've zero experience with libvirt/dnsmasq. Going over the referenced issue threads, I did notice https://github.com/netblue30/firejail/issues/5089#issuecomment-1094276371 mentions
caps.keep chown,dac_override,net_admin,net_bind_service,net_raw,setgid,setuidmight be needed (besides whitelist /var/lib/libvirt/dnsmasq and whitelist /var/run). OP's response seems to suggest that fixes things, but the resulting commitsce6f792efdandf3de2e37fddon't touch caps.keep.Have you tried using dnsmasq.profile with
caps.keep chown,dac_override,net_admin,net_bind_service,net_raw,setgid,setuidyet?@ghost commented on GitHub (Dec 11, 2023):
Follow-up
I've installed libvirt/dnsmasq on my Arch Linux box to get a better understanding of this issue. With the below it works here, without the firecfg workaround:
Caveats:
wheelgroup, hence I didn't add myself to thelibvirtgroup as mentioned in the Arch wiki page for libvirt;sudo virsh net-start defaulthangs on the command-line, but this doesn't seem to affect the now firejailed dnsmasq instances called by libvirt (probably another manifestation of #4440).@marek22k @ShellCode33 Can you try again with the above
dnsmasq.localand report back here please? Hopefully we're closer to fixing this properly...@ShellCode33 commented on GitHub (Dec 11, 2023):
Thanks for taking the time to look at it @glitsj16 !
I still have the same PATH-related error:
You said that for you virsh was just hanging, that sounds odd. Make sure the libvirtd service is running
Here's my
/etc/firejail/dnsmasq.local:(I'm deliberately trying to be very permissive to narrow it down after, but that still doesn't work)
@marek22k commented on GitHub (Dec 11, 2023):
@ghost commented on GitHub (Dec 11, 2023):
@ShellCode33
I did start libvirtd.service and virtlogd.service via systemd. Nothing special here. If you don't start those you'll indeed see errors:
@ShellCode33 @marek22k
Did you re-enable the dnsmasq symlink in /usr/local/bin (via firecfg or manually)? To make absolutely sure I created a wrapper script:
Mind the
--name=${_app}-6121part. It's another assisting param to double-check if sandboxing dnsmasq is or isn't working. After issueing the virsh command you can run:You should see the same if you added
name dnsmasq-6121(or anything you choose really) to dnsmasq.local.Did any of you both added his user to the
libvirtgroup? Anypolkitstuff we're missing eyes on in this context? Check these docs for details:https://wiki.archlinux.org/title/Libvirt#Using_libvirt_group
https://wiki.archlinux.org/title/Libvirt#Using_polkit
https://wiki.archlinux.org/title/Polkit#Bypass_password_prompt
https://wiki.archlinux.org/title/Polkit#Globally
https://wiki.archlinux.org/title/Polkit#For_specific_actions
@ShellCode33 commented on GitHub (Dec 11, 2023):
Yes it is currently enabled
Yes my user is part of this group, but I guess it doesn't matter considering we are running virsh using sudo, therefore polkit shouldn't be at play here
I tried to put your script in place of the
/usr/local/bin/dnsmasqsymlink, now virsh runs fine without error (at least it confirms this is not a PATH issue).But now I have an apparmor denial 🥲
So I tried to disable this particular AppArmor profile, and now I observe the same behavior as you: virsh hangs.
While it's still hanging, I can see it's running within firejail:
EDIT: even if I CTRL+C virsh, dnsmasq is still running, but it's a bit annoying because all virsh commands hang, even
sudo virsh net-listEDIT2: my
dnsmasq.localeis completely empty and it's still working. I'm starting to wonder if this is a bug inlibvirtwhich does not resolve the symlink properlyEDIT3:
CTRL+C doesn't work, the libvirtd daemon will error after some time.
And when it's automatically restarted by systemd, the following errors/warning are emitted:
systemd logs
@rieje commented on GitHub (Oct 29, 2024):
FWIW I'm having the same issue on Arch. I don't use AppArmor.
@Utini2000 commented on GitHub (Nov 7, 2024):
Same issue here on Arch. Disabled dnsmasq profile in firejail. Otherwise it won't function.
@tl87 commented on GitHub (Feb 3, 2025):
I'm experiencing the same issue on Fedora 41 and I want to tag along on this issue thread.