Reputation: 13
I am trying to run pyqt
file with sudo
but the GUI doesn't run when running as root. It gives me this error:
X Error: BadAccess (attempt to access private resource denied) 10
Extension: 130 (MIT-SHM)
Minor opcode: 1 (X_ShmAttach)
Resource id: 0x142
X Error: BadShmSeg (invalid shared segment parameter) 128
Extension: 130 (MIT-SHM)
Minor opcode: 5 (X_ShmCreatePixmap)
Resource id: 0x3000010
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
Major opcode: 62 (X_CopyArea)
Resource id: 0x3000011
So, is there a way to run it with root privileges?
Upvotes: 1
Views: 1604
Reputation: 121
Try sudo QT_X11_NO_MITSHM=1
followed by your command.
for example, to run a python script:
sudo QT_X11_NO_MITSHM=1 python example.py
Upvotes: 0
Reputation: 351
I had a similar issue when I running OpenCV
in Ubuntu 18.04
. I have solved using the below command
export QT_X11_NO_MITSHM=1
Upvotes: 0
Reputation: 43
echo "export QT_X11_NO_MITSHM=1" >> $HOME/.bashrc
it work for my. thnks!
Upvotes: 0
Reputation: 26
I had a similar problem running QT from a Docker container.
Try with this (it was the solution for me):
echo "export QT_X11_NO_MITSHM=1" >> $HOME/.bashrc
Upvotes: 1