How do I enable XRandR in Xvfb or disable it in firefox when running firefox headless?
Firefox now has a headless mode which doesn't require an X server (like Xvfb) at all. If you're reading this, you may want to investigate this as an alternative, as it's much simpler to work with.