In later versions of Ubuntu running the command “x11vnc” no longer works. The suggestions in the error message also do not work. It boils down to the user’s login session now running on display :1, not :0. Thanks to this post I found the fix to be simple: Specify :1 as the display.
x11vnc -display :1
Resolved the issue. X11vnc is working again!
Thank you for this simple solution. I was going bonkers because none of the other answers on the internet work.
got the same error in my case
Thanks! This solution fixed my issue with RHEL8 in January 2024.