Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62531 > unrolled thread
| Started by | Jean Dubois <jeandubois314@gmail.com> |
|---|---|
| First post | 2013-12-22 05:02 -0800 |
| Last post | 2013-12-23 09:02 -0800 |
| Articles | 6 — 2 participants |
Back to article view | Back to comp.lang.python
vnc-problem with idle running as sudo on raspberry pi Jean Dubois <jeandubois314@gmail.com> - 2013-12-22 05:02 -0800
Re: vnc-problem with idle running as sudo on raspberry pi Jean Dubois <jeandubois314@gmail.com> - 2013-12-22 05:27 -0800
Re: [OT] vnc-problem with idle running as sudo on raspberry pi Michael Torrie <torriem@gmail.com> - 2013-12-22 10:06 -0700
Re: [OT] vnc-problem with idle running as sudo on raspberry pi Jean Dubois <jeandubois314@gmail.com> - 2013-12-23 06:06 -0800
Re: [OT] vnc-problem with idle running as sudo on raspberry pi Michael Torrie <torriem@gmail.com> - 2013-12-23 08:29 -0700
Re: [OT] vnc-problem with idle running as sudo on raspberry pi Jean Dubois <jeandubois314@gmail.com> - 2013-12-23 09:02 -0800
| From | Jean Dubois <jeandubois314@gmail.com> |
|---|---|
| Date | 2013-12-22 05:02 -0800 |
| Subject | vnc-problem with idle running as sudo on raspberry pi |
| Message-ID | <b0b2ea81-0051-4e59-9b91-67cd9decbcab@googlegroups.com> |
I found the following solution to use idle on the raspberry pi
as sudoer (which is necessary or at least comfortable when programming the
GPIO)
1. Open a terminal
2. type cd ~/Desktop
3. type touch idle_as_root
4. type nano idle_as_root
5. type in sudo idle
6. exit nano
7. type in sudo chmod +x idle_as_root
8. Close terminal
9. Double click on the idle_as_root program on your desktop
This all works fine as long as I use X, however
I also want to use it via vnc
For vnc I did the following:
Installed script "tightvncserver" on the RPiwith the following contents:
#!/bin/bash
# /etc/init.d/tightvncserver
VNCUSER='pi'
case "$1" in
start)
# su $VNCUSER -c '/usr/bin/tightvncserver :1'
su -l $VNCUSER -c '/usr/bin/tightvncserver :1'
echo "Starting TightVNC server for $VNCUSER "
;;
stop)
pkill Xtightvnc
echo "Tightvncserver stopped"
;;
*)
echo "Usage: /etc/init.d/tightvncserver {start|stop}"
exit 1
;;
esac
exit 0
sudo chmod 755 /etc/init.d/tightvncserver
sudo update-rc.d tightvncserver defaults
when starting the script manually like this
sudo /etc/init.d/tightvncserver start
everything works as expected i.e. I can click on the idle_as_root-icon and
it works as expected.
If however I reboot the system, the service does start and I do see the
rpi-desktop but clicking the idle_as_root-icon doesn't work. Manually
trying to start it as follows show an error:
pi@raspberrypi ~ $ sudo idle
Client is not authorized to connect to ServerTraceback (most recent call
last):
File "/usr/bin/idle", line 5, in <module>
main()
File "/usr/lib/python2.7/idlelib/PyShell.py", line 1427, in main
root = Tk(className="Idle")
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in __init__
self.tk = _tkinter.create(screenName, baseName, className,
interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display ":1.0"
Does someone here have a solution for this problem?
thanks in advance
jean
[toc] | [next] | [standalone]
| From | Jean Dubois <jeandubois314@gmail.com> |
|---|---|
| Date | 2013-12-22 05:27 -0800 |
| Message-ID | <6fc90651-e42f-444d-a6de-2ca030cc9110@googlegroups.com> |
| In reply to | #62531 |
Op zondag 22 december 2013 14:02:47 UTC+1 schreef Jean Dubois:
> I found the following solution to use idle on the raspberry pi
> as sudoer (which is necessary or at least comfortable when programming the
> GPIO)
> 1. Open a terminal
> 2. type cd ~/Desktop
> 3. type touch idle_as_root
> 4. type nano idle_as_root
> 5. type in sudo idle
> 6. exit nano
> 7. type in sudo chmod +x idle_as_root
> 8. Close terminal
> 9. Double click on the idle_as_root program on your desktop
> This all works fine as long as I use X, however
> I also want to use it via vnc
> For vnc I did the following:
> Installed script "tightvncserver" on the RPiwith the following contents:
> #!/bin/bash
> # /etc/init.d/tightvncserver
> VNCUSER='pi'
> case "$1" in
> start)
> # su $VNCUSER -c '/usr/bin/tightvncserver :1'
> su -l $VNCUSER -c '/usr/bin/tightvncserver :1'
> echo "Starting TightVNC server for $VNCUSER "
> ;;
> stop)
> pkill Xtightvnc
> echo "Tightvncserver stopped"
> ;;
> *)
> echo "Usage: /etc/init.d/tightvncserver {start|stop}"
> exit 1
> ;;
> esac
> exit 0
> sudo chmod 755 /etc/init.d/tightvncserver
> sudo update-rc.d tightvncserver defaults
> when starting the script manually like this
> sudo /etc/init.d/tightvncserver start
> everything works as expected i.e. I can click on the idle_as_root-icon and
> it works as expected.
I was wrong writing idle_as_root worked this way. As a matter of fact,
this method also does not work as expected, as can be seen from this
message:
X11 connection rejected because of wrong authentication.
New 'X' desktop is raspberrypi:1
Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/raspberrypi:1.log
Starting TightVNC server for pi
> If however I reboot the system, the service does start and I do see the
> rpi-desktop but clicking the idle_as_root-icon doesn't work. Manually
> trying to start it as follows show an error:
> pi@raspberrypi ~ $ sudo idle
> Client is not authorized to connect to ServerTraceback (most recent call
> last):
> File "/usr/bin/idle", line 5, in <module>
> main()
> File "/usr/lib/python2.7/idlelib/PyShell.py", line 1427, in main
> root = Tk(className="Idle")
> File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in __init__
> self.tk = _tkinter.create(screenName, baseName, className,
> interactive, wantobjects, useTk, sync, use)
> _tkinter.TclError: couldn't connect to display ":1.0"
[toc] | [prev] | [next] | [standalone]
| From | Michael Torrie <torriem@gmail.com> |
|---|---|
| Date | 2013-12-22 10:06 -0700 |
| Subject | Re: [OT] vnc-problem with idle running as sudo on raspberry pi |
| Message-ID | <mailman.4493.1387732035.18130.python-list@python.org> |
| In reply to | #62532 |
On 12/22/2013 06:27 AM, Jean Dubois wrote: > I was wrong writing idle_as_root worked this way. As a matter of fact, > this method also does not work as expected, as can be seen from this > message: > > X11 connection rejected because of wrong authentication. > > New 'X' desktop is raspberrypi:1 > > Starting applications specified in /home/pi/.vnc/xstartup > Log file is /home/pi/.vnc/raspberrypi:1.log > > Starting TightVNC server for pi In future, I suspect you'll need to take questions like this that don't really have anything to do with Python to a Raspberry Pi forum or e-mail list. Or a general Linux list. Short answer: Edit /etc/sudoers and add this line somewhere in it (probably near other lines that look similar): Defaults env_keep += "DISPLAY XAUTHORITY" If that doesn't work, then you'll have to talk to folks running the Rasbian on their Pi. Sometimes XAUTHORITY isn't set.
[toc] | [prev] | [next] | [standalone]
| From | Jean Dubois <jeandubois314@gmail.com> |
|---|---|
| Date | 2013-12-23 06:06 -0800 |
| Subject | Re: [OT] vnc-problem with idle running as sudo on raspberry pi |
| Message-ID | <f5a0c02d-2cbd-47e8-820c-77dd67e28a0e@googlegroups.com> |
| In reply to | #62533 |
Op zondag 22 december 2013 18:06:39 UTC+1 schreef Michael Torrie: > On 12/22/2013 06:27 AM, Jean Dubois wrote: > > I was wrong writing idle_as_root worked this way. As a matter of fact, > > this method also does not work as expected, as can be seen from this > > message: > > > > X11 connection rejected because of wrong authentication. > > > > New 'X' desktop is raspberrypi:1 > > > > Starting applications specified in /home/pi/.vnc/xstartup > > Log file is /home/pi/.vnc/raspberrypi:1.log > > > > Starting TightVNC server for pi > In future, I suspect you'll need to take questions like this that don't > really have anything to do with Python to a Raspberry Pi forum or e-mail > list. Or a general Linux list. > Short answer: > Edit /etc/sudoers and add this line somewhere in it (probably near other > lines that look similar): > Defaults env_keep += "DISPLAY XAUTHORITY" > If that doesn't work, then you'll have to talk to folks running the > Rasbian on their Pi. Sometimes XAUTHORITY isn't set. I thought this would be something python-people are familiar with, after all idle is a Python IDE and running it as a root sometimes is necessary. Anyway, I tried out your suggestion but it didn't work, however googling the line you suggested brought me close to a solution: the following command does the trick: xhost +local:root unfortunately putting it in ~/.bash_profile doesn't make it work automatically after booting, neither does putting it in ~/.xsession, in ~/.xinitrc nor in an autostart-file in ~/.config/openbox/ putting it in .bashrc does work _after_ opening a terminal which isn't very nice. thanks and kind regards, jean
[toc] | [prev] | [next] | [standalone]
| From | Michael Torrie <torriem@gmail.com> |
|---|---|
| Date | 2013-12-23 08:29 -0700 |
| Subject | Re: [OT] vnc-problem with idle running as sudo on raspberry pi |
| Message-ID | <mailman.4562.1387812576.18130.python-list@python.org> |
| In reply to | #62628 |
On 12/23/2013 07:06 AM, Jean Dubois wrote: > I thought this would be something python-people are familiar with, after > all idle is a Python IDE and running it as a root sometimes is necessary. On most desktop distros like Fedora, sudo idle would indeed work. The fact that it's not working on your pi, means it must be specific to the distro that your pi is running. And by the way you never mentioned what distro this is. > Anyway, > I tried out your suggestion but it didn't work, however googling the line > you suggested brought me close to a solution: The solution likely lies in understanding how MIT-Cookie's work with X11 and how to use xauth. > the following command does the trick: > xhost +local:root > > unfortunately putting it in ~/.bash_profile doesn't make it work > automatically > after booting, neither does putting it in ~/.xsession, in ~/.xinitrc nor > in an autostart-file in ~/.config/openbox/ > putting it in .bashrc does work _after_ opening a terminal which isn't > very nice. > > thanks and kind regards, > jean
[toc] | [prev] | [next] | [standalone]
| From | Jean Dubois <jeandubois314@gmail.com> |
|---|---|
| Date | 2013-12-23 09:02 -0800 |
| Subject | Re: [OT] vnc-problem with idle running as sudo on raspberry pi |
| Message-ID | <d6e8e371-dd4a-48ad-83f1-1e9fc7f27ab9@googlegroups.com> |
| In reply to | #62635 |
Op maandag 23 december 2013 16:29:09 UTC+1 schreef Michael Torrie: > On 12/23/2013 07:06 AM, Jean Dubois wrote: > > I thought this would be something python-people are familiar with, after > > all idle is a Python IDE and running it as a root sometimes is necessary. > > On most desktop distros like Fedora, sudo idle would indeed work. > > The fact that it's not working on your pi, means it must be specific to > the distro that your pi is running. And by the way you never mentioned > what distro this is. > > > Anyway, > > I tried out your suggestion but it didn't work, however googling the line > > you suggested brought me close to a solution: > > The solution likely lies in understanding how MIT-Cookie's work with X11 > and how to use xauth. > In fact no need for that, changing sudo /usr/bin/idle to gksu /usr/bin/idle is all is needed to make this work. kind regards, jean
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web