proffalken / JMR-Pi

Setup scripts for JMRI on the Raspberri-Pi
14 stars 9 forks source link

error opening logfile - vncserver won't start #10

Open topherson opened 10 years ago

topherson commented 10 years ago

I'm new to the pi platform...trying to get JMRI installed in the hopes of having an install to auto boot into jmri & launch withrottle server without mouse keyboard or monitor, but be able to have ssh and vnc access.

Was getting nowhere fast when I found your script. This is amazing as it has installed both java and jmri and lots of other goodies that I don't understand.

However, I'm experiencing an error on startup into the command line...

"error opening logfile: /var/log/x11vnc.log" AND I'm not seeing a message about where (IP:PORT) I connect via vnc like I DID notice on install of your script.

I got around the of the logfile problem by creating the file manually and giving rights to the JMRI user.

Now on restart, I do not receive this error. Still not getting an IP:PORT message. When I look at x11vnc.log I find that the vnc server is not running.

This link from within the logfile http://www.karlrunge.com/x11vnc/faq.html makes me suspect that the vnc server is not starting due to a permissions problem.

To test this theory I launched the gui with startx. then accessed the terminal and started x11vnc and received no errors.

I researched this a bit and trying to get my head around xauth and MIT-MAGIC-COOKIES but I'm getting a bit out of my depth.

Hoping you can shed some light on this. Read on the JMRI user group that you might respond quicker if issues were sent here.

regards, Christopher

proffalken commented 10 years ago

Hi Christopher,

Apologies for not getting back to you sooner.

I'm a bit busy at the moment due to family things, however I'll try to take a look at this in the next few days.

Any chance you can re-run the install script and paste the output here?

Also, if you could run "sudo ls -l /var/log/x11vnc.log" and paste that here as well it would help!

Thanks,

Matt

topherson commented 10 years ago

Hi Matt,

I understand...no rush

I just ran the script from a terminal window logged in as the pi user.

I couldn't access the vncserver at the ip:port below

I can reach the smb server

mkdir: cannot create directory jmri_downloads': File exists Package already downloading, skipping this step... Unpacking the source into /opt Reading package lists... Done Building dependency tree Reading state information... Done librxtx-java is already the newest version. openjdk-7-jre is already the newest version. x11vnc is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. useradd: user 'jmri' already exists Reading package lists... Done Building dependency tree Reading state information... Done samba is already the newest version. samba-common-bin is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. [ ok ] Stopping Samba daemons: nmbd smbd. [ ok ] Starting Samba daemons: nmbd smbd. mkdir: cannot create directory/home/jmri/.jmri': File exists Starting VNC Server update-rc.d: using dependency based boot sequencing

Your JMRI server is ready...

Please connect to 10.0.1.20:5901 with a VNC client to configure JMRI.

Please note that JMRI will take several minutes to start the first time it is run.

Your config files should be available by browsing to \10.0.1.20\JMRI\

On Nov 18, 2013, at 10:03 AM, Matthew Macdonald-Wallace notifications@github.com wrote:

Hi Christopher,

Apologies for not getting back to you sooner.

I'm a bit busy at the moment due to family things, however I'll try to take a look at this in the next few days.

Any chance you can re-run the install script and paste the output here?

Thanks,

Matt

— Reply to this email directly or view it on GitHub.

proffalken commented 10 years ago

ok, can you run the following three commands on the PI for me please and paste the output here?

sudo netstat -antpl sudo tail /var/log/messages sudo ls -lad /home/*

topherson commented 10 years ago

On Nov 19, 2013, at 4:45 AM, Matthew Macdonald-Wallace notifications@github.com wrote:

ok, can you run the following three commands on the PI for me please and paste the output here?

sudo netstat -antpl sudo tail /var/log/messages sudo ls -lad /home/*

— Reply to this email directly or view it on GitHub.

Sure...I have two SD cards and re ran the install script on both. below is the output for the three commands issued.

Card-A

pi@ps-raspberrypi ~ $ sudo netstat -antpl Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 1937/smbd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 1937/smbd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2097/sshd
tcp 0 256 10.0.1.20:22 10.0.1.14:59422 ESTABLISHED 2256/sshd: pi [priv pi@ps-raspberrypi ~ $ sudo tail /var/log/messages Nov 18 18:59:07 ps-raspberrypi kernel: [ 3.718813] usb 1-1.3: New USB device found, idVendor=1267, idProduct=0103 Nov 18 18:59:07 ps-raspberrypi kernel: [ 3.741826] usb 1-1.3: New USB device strings: Mfr=0, Product=0, SerialNumber=0 Nov 18 18:59:07 ps-raspberrypi kernel: [ 3.774230] input: HID 1267:0103 as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.0/input/inpu t1 Nov 18 18:59:07 ps-raspberrypi kernel: [ 3.809756] hid-generic 0003:1267:0103.0002: input,hidraw1: USB HID v1.10 Keyboard [HID 1267:0103] on usb-bcm2708_usb-1.3/input0 Nov 18 18:59:07 ps-raspberrypi kernel: [ 3.849412] input: HID 1267:0103 as /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3:1.1/input/inpu t2 Nov 18 18:59:07 ps-raspberrypi kernel: [ 3.882208] hid-generic 0003:1267:0103.0003: input,hidraw2: USB HID v1.10 Device [HID 1267:0103] on u sb-bcm2708_usb-1.3/input1 Nov 18 18:59:07 ps-raspberrypi kernel: [ 10.211464] EXT4-fs (mmcblk0p6): re-mounted. Opts: (null) Nov 18 18:59:07 ps-raspberrypi kernel: [ 10.687858] EXT4-fs (mmcblk0p6): re-mounted. Opts: (null) Nov 18 18:59:07 ps-raspberrypi kernel: [ 21.082820] smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0xC5E1 Nov 18 18:59:10 ps-raspberrypi kernel: [ 24.810211] Adding 102396k swap on /var/swap. Priority:-1 extents:1 across:102396k SS pi@ps-raspberrypi ~ $ sudo ls -lad /home/* drwxr-xr-x 10 jmri jmri 4096 Nov 14 21:47 /home/jmri drwxr-xr-x 10 pi pi 4096 Nov 14 21:33 /home/pi pi@ps-raspberrypi ~ $

Card-B

pi@raspberrypi ~ $ sudo netstat -antpl Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 2355/smbd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 2355/smbd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2066/sshd
tcp 0 0 10.0.1.20:445 10.0.1.13:57863 ESTABLISHED 2387/smbd
tcp 0 0 10.0.1.20:22 10.0.1.13:62094 ESTABLISHED 3266/sshd: pi [priv pi@raspberrypi ~ $ sudo tail /var/log/messages Nov 19 06:25:06 raspberrypi rsyslogd: [origin software="rsyslogd" swVersion="5.8.11" x-pid="1808" x-info="http://www.rsyslog.com"] rsyslogd was HUPed pi@raspberrypi ~ $ sudo ls -lad /home/* drwxr-xr-x 6 jmri jmri 4096 Nov 12 12:03 /home/jmri drwxr-xr-x 19 pi pi 4096 Nov 12 02:26 /home/pi pi@raspberrypi ~ $

proffalken commented 10 years ago

ok, thanks, can you run "sudo service vncserver start" and see what that gives you?

From the above, the VNC Server isn't even starting, but I can't see a clear reason why...

topherson commented 10 years ago

Thanks, "sudo service vncserver start" returned "Starting VNC Server"

What follows is the contents of the x11vnc.log which I could only get after creating an empty file an given access to the "JMRI" user.

22/11/2013 06:53:57 passing arg to libvncserver: -rfbport 22/11/2013 06:53:57 passing arg to libvncserver: 5900 ###############################################################

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@ @

@ * WARNING * WARNING * WARNING * WARNING \ @

@ @

@ YOU ARE RUNNING X11VNC WITHOUT A PASSWORD!! @

@ @

@ This means anyone with network access to this computer @

@ may be able to view and control your desktop. @

@ @

@ >>> If you did not mean to do this Press CTRL-C now!! <<< @

@ @

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

@ @

@ You can create an x11vnc password file by running: @

@ @

@ x11vnc -storepasswd password /path/to/passfile @

@ or x11vnc -storepasswd /path/to/passfile @

@ or x11vnc -storepasswd @

@ @

@ (the last one will use ~/.vnc/passwd) @

@ @

@ and then starting x11vnc via: @

@ @

@ x11vnc -rfbauth /path/to/passfile @

@ @

@ an existing ~/.vnc/passwd file from another VNC @

@ application will work fine too. @

@ @

@ You can also use the -passwdfile or -passwd options. @

@ (note -passwd is unsafe if local users are not trusted) @

@ @

@ Make sure any -rfbauth and -passwdfile password files @

@ cannot be read by untrusted users. @

@ @

@ Use x11vnc -usepw to automatically use your @

@ ~/.vnc/passwd or ~/.vnc/passwdfile password files. @

@ (and prompt you to create ~/.vnc/passwd if neither @

@ file exists.) Under -usepw, x11vnc will exit if it @

@ cannot find a password to use. @

@ @

@ @

@ Even with a password, the subsequent VNC traffic is @

@ sent in the clear. Consider tunnelling via ssh(1): @

@ @

@ http://www.karlrunge.com/x11vnc/#tunnelling @

@ @

@ Or using the x11vnc SSL options: -ssl and -stunnel @

@ @

@ Please Read the documention for more info about @

@ passwords, security, and encryption. @

@ @

@ http://www.karlrunge.com/x11vnc/faq.html#faq-passwd @

@ @

@ To disable this warning use the -nopw option, or put @

@ 'nopw' on a line in your ~/.x11vncrc file. @

@ @

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

############################################################### 22/11/2013 06:53:58 x11vnc version: 0.9.13 lastmod: 2011-08-10 pid: 4777 22/11/2013 06:53:58 XOpenDisplay("") failed. 22/11/2013 06:53:58 Trying again with XAUTHLOCALHOSTNAME=localhost ... 22/11/2013 06:53:58  22/11/2013 06:53:58 * XOpenDisplay failed. No -display or DISPLAY. 22/11/2013 06:53:58 * Trying ":0" in 4 seconds. Press Ctrl-C to abort. 22/11/2013 06:53:58 *\ 1 2 3 4 22/11/2013 06:54:02 XOpenDisplay(":0") failed. 22/11/2013 06:54:02 Trying again with XAUTHLOCALHOSTNAME=localhost ... 22/11/2013 06:54:02 XOpenDisplay(":0") failed. 22/11/2013 06:54:02 Trying again with unset XAUTHLOCALHOSTNAME ... 22/11/2013 06:54:02

22/11/2013 06:54:02 *** 22/11/2013 06:54:02 *\ XOpenDisplay failed (:0)

* x11vnc was unable to open the X DISPLAY: ":0", it cannot continue. * There may be "Xlib:" error messages above with details about the failure.

Some tips and guidelines:

\ An X server (the one you wish to view) must be running before x11vnc is started: x11vnc does not start the X server. (however, see the -create option if that is what you really want).

\ You must use -display , -OR- set and export your $DISPLAY environment variable to refer to the display of the desired X server.

\ Next, you need to have sufficient permissions (Xauthority) to connect to the X DISPLAY. Here are some Tips:

\ If NO ONE is logged into an X session yet, but there is a greeter login program like "gdm", "kdm", "xdm", or "dtlogin" running, you will need to find and use the raw display manager MIT-MAGIC-COOKIE file. Some examples for various display managers:

 gdm:     -auth /var/gdm/:0.Xauth
          -auth /var/lib/gdm/:0.Xauth
 kdm:     -auth /var/lib/kdm/A:0-crWk72
          -auth /var/run/xauth/A:0-crWk72
 xdm:     -auth /var/lib/xdm/authdir/authfiles/A:0-XQvaJk
 dtlogin: -auth /var/dt/A:0-UgaaXa

Sometimes the command "ps wwwwaux | grep auth" can reveal the file location.

Starting with x11vnc 0.9.9 you can have it try to guess by using:

          -auth guess

(see also the x11vnc -findauth option.)

Only root will have read permission for the file, and so x11vnc must be run as root (or copy it). The random characters in the filenames will of course change and the directory the cookie file resides in is system dependent.

See also: http://www.karlrunge.com/x11vnc/faq.html

On Nov 22, 2013, at 1:21 AM, Matthew Macdonald-Wallace notifications@github.com wrote:

ok, thanks, can you run "sudo service vncserver start" and see what that gives you?

From the above, the VNC Server isn't even starting, but I can't see a clear reason why...

— Reply to this email directly or view it on GitHub.

proffalken commented 10 years ago

Hi,

Sorry it's taken so long to get back to you.

Are you running this as the "pi" user or the dedicated "jmri" user?

Please can you run the following and paste the output here:

ps auxf | grep jrmi

Thanks,

Matt

twknox commented 10 years ago

Was this ever resolved? I just did a JRM-PI install and have encountered the exact errors as above. Thanks.

proffalken commented 10 years ago

Hi, I didn't get the output of ps auxf | grep jmri from @topherson and that, coupled with a distinct lack of time recently, has meant that I have not been able to troubleshoot this.

@twknox if you have the same issue, please can you run that command and paste the output here so I can try and debug.

I'm afraid I probably won't get to this for a week or so, but I'd like to see it fixed.

Matt

twknox commented 10 years ago

Yes, let me reimage so I can start from a new install. I will post it here over the next few days.

On Fri, Oct 10, 2014 at 6:02 AM, Matthew Macdonald-Wallace < notifications@github.com> wrote:

Hi, I didn't get the output of ps auxf | grep jmri from @topherson https://github.com/topherson and that, coupled with a distinct lack of time recently, has meant that I have not been able to troubleshoot this.

@twknox https://github.com/twknox if you have the same issue, please can you run that command and paste the output here so I can try and debug.

I'm afraid I probably won't get to this for a week or so, but I'd like to see it fixed.

Matt

— Reply to this email directly or view it on GitHub https://github.com/proffalken/JMR-Pi/issues/10#issuecomment-58635982.

Tom Knox