[Risolto]Real VNC:The connection was refused by the computer

Networking, configurazione della connessione, periferiche e condivisioni di rete.
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12949
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: [RISOLTO]Real VNC:The connection was refused by the comp

Messaggio da thece »

Beh "mio mio" proprio no, scopiazzato e riadattato diciamo
rax25 [url=https://forum.ubuntu-it.org/viewtopic.php?p=5012071#p5012071][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: Quindi se ho ben capito, copio il contenuto in leafpad/nano, inserisco l'user che voglio che lo avvii ('pi') e come lo salvo? Una volta reso eseguibile dove lo metto? Perdona l'ignoranza :)

Codice: Seleziona tutto

cd /etc/init.d
sudo touch tightvncserver
sudo nano tightvncserver     <---<< Corretto

Cut&Paste con modifica della riga commentata e da scommentare

export USER='TUO_UTENTE'

sudo chmod 755  tightvncserver
sudo update-rc.d tightvncserver defaults
e riavvi il PC
Ultima modifica di thece il martedì 3 ottobre 2017, 22:22, modificato 1 volta in totale.
rax25
Prode Principiante
Messaggi: 161
Iscrizione: lunedì 2 marzo 2015, 20:06
Distribuzione: Xubuntu 16.04 / Raspbian
Sesso: Maschile

Re: [RISOLTO]Real VNC:The connection was refused by the comp

Messaggio da rax25 »

Codice: Seleziona tutto

pi@raspberrypi ~ $ cd /etc/init.d
pi@raspberrypi /etc/init.d $ sudo touch tightvncserver
pi@raspberrypi /etc/init.d $ sudo gedit tightvncserver
sudo: gedit: command not found
pi@raspberrypi /etc/init.d $ sudo leafpad tightvncserver
leafpad: Impossibile aprire il display:
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12949
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: [RISOLTO]Real VNC:The connection was refused by the comp

Messaggio da thece »

Ops ... dimenticavo che stai usando Raspian ... vai di nano
rax25
Prode Principiante
Messaggi: 161
Iscrizione: lunedì 2 marzo 2015, 20:06
Distribuzione: Xubuntu 16.04 / Raspbian
Sesso: Maschile

Re: [RISOLTO]Real VNC:The connection was refused by the comp

Messaggio da rax25 »

Ok :)

Immagine
Spoiler
Mostra
Scusatemi, non ho resistito! :D

EDIT

Non va, mi continua a rifiutare la connessione e per collegarmi devo dare:

Codice: Seleziona tutto

 tightvncserver :1 -geometry 1024x768 -depth 24 -dpi 96
dal raspberry. :nono:
Avatar utente
axilot
Imperturbabile Insigne
Imperturbabile Insigne
Messaggi: 2704
Iscrizione: lunedì 7 luglio 2008, 17:29
Distribuzione: Ubuntu 16.04 64bit

Re: [RISOLTO]Real VNC:The connection was refused by the comp

Messaggio da axilot »

Prova a lanciare manualmente lo script abilitando il debugging così controlli eventuali errori

Codice: Seleziona tutto

bash -x /etc/init.d/tightvncserver 
"Experience, the name men give to their mistakes" (O.Wilde)
Pc principale: Ubuntu 16.04 64Bit - Pc secondario: Ubuntu 18.04 64 Bit - Raspberry Pi: Rpi 1B+, Rpi 2, Rpi 3+, Rpi Zero W
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12949
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: [RISOLTO]Real VNC:The connection was refused by the comp

Messaggio da thece »

rax25 [url=https://forum.ubuntu-it.org/viewtopic.php?p=5012105#p5012105][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: Non va, mi continua a rifiutare la connessione e per collegarmi devo dare:

Codice: Seleziona tutto

 tightvncserver :1 -geometry 1024x768 -depth 24 -dpi 96
dal raspberry. :nono:
Sicuramente hai ceffato qualche passaggio, controlliamo ... iniziamo con

Codice: Seleziona tutto

ls -l /etc/init.d/tightvncserver
cat /etc/init.d/tightvncserver
rax25
Prode Principiante
Messaggi: 161
Iscrizione: lunedì 2 marzo 2015, 20:06
Distribuzione: Xubuntu 16.04 / Raspbian
Sesso: Maschile

Re: [RISOLTO]Real VNC:The connection was refused by the comp

Messaggio da rax25 »

thece ha scritto: Sicuramente hai ceffato qualche passaggio, controlliamo...
Non posso escluderlo, ieri ero molto stanco :)

Codice: Seleziona tutto

pi@raspberrypi ~ $ ls -l /etc/init.d/tightvncserver
-rw-r--r-- 1 root root 88 ott  3 22:36 /etc/init.d/tightvncserver
pi@raspberrypi ~ $ cat /etc/init.d/tightvncserver
export USER=pi

sudo chmod 755  tightvncserver
sudo update-rc.d tightvncserver defaults
pi@raspberrypi ~ $
Ultima modifica di rax25 il giovedì 12 ottobre 2017, 23:51, modificato 1 volta in totale.
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12949
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: [RISOLTO]Real VNC:The connection was refused by the comp

Messaggio da thece »

Direi che hai ceffato tutto: controlla e riprova.

Ti riposto la procedura, magari hai inteso male qualche passaggio

Codice: Seleziona tutto

cd /etc/init.d
sudo touch tightvncserver
sudo nano tightvncserver
Fai Copia&Incolla dello script

Codice: Seleziona tutto

#!/bin/sh

### BEGIN INIT INFO
# Provides:          tightvncserver
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts Tight VNC Server
# Description:       Starts Tight VNC Server
#
# To start automatically Tight VNC Server at boot
# sudo update-rc.d tightvncserver defaults
#
# To uninstall
# sudo update-rc.d -f tightvncserver remove
#
### END INIT INFO

# Set the USER variable to the name of the user to start tightvncserver under
# export USER='TUO_UTENTE'

eval cd ~$USER

case "$1" in
	start)
		echo "Starting Tight VNC Server for $USER ..."
		su $USER -c '/usr/bin/tightvncserver :1 -geometry 1024x768 -depth 24 -dpi 96'
		;;

	stop)
		echo "Stopping Tight VNC Server ..."
		killall Xtightvnc
		;;

	*)
		echo "Usage: /etc/init.d/tightvncserver {start|stop}"
		exit 1
		;;
esac

exit 0
avendo cura di scommentare la riga

Codice: Seleziona tutto

# export USER='TUO_UTENTE'
ed inserire il tuo utente.
Salvi il file.
Chiudi il file.
Poi

Codice: Seleziona tutto

sudo chmod 755  tightvncserver
sudo update-rc.d tightvncserver defaults
rax25
Prode Principiante
Messaggi: 161
Iscrizione: lunedì 2 marzo 2015, 20:06
Distribuzione: Xubuntu 16.04 / Raspbian
Sesso: Maschile

Re: [RISOLTO]Real VNC:The connection was refused by the comp

Messaggio da rax25 »

Perfetto! Funziona!

L'errore, ricontrollando, è che ieri in un momento di standby del mio cervello ho fatto un errore nel copiare lo script ed ho inserito al suo interno anche:

Codice: Seleziona tutto

sudo chmod 755  tightvncserver
sudo update-rc.d tightvncserver defaults
senza poi darli effettivamente da terminale!

Grazie mille per la pazienza :)
rax25
Prode Principiante
Messaggi: 161
Iscrizione: lunedì 2 marzo 2015, 20:06
Distribuzione: Xubuntu 16.04 / Raspbian
Sesso: Maschile

Re: [RISOLTO]Real VNC:The connection was refused by the comp

Messaggio da rax25 »

Piccolo up:
a seguito di pasticci con le configurazioni del raspberry ho deciso che la soluzione migliore sarebbe stata quella di ripartire da zero, così ho ricreato un sistema ex novo e ripetuto gli stessi passaggi della guida.

VNC effettivamente funziona, ma solo se digito a mano:

Codice: Seleziona tutto

vncserver :1 -geometry 1920x1080 -depth 24
Questo processo, prima era automattizato all'avvio e penso che l'errore sia proprio qui.

Posto l'output incriminato

Codice: Seleziona tutto

sudo update-rc.d tightvncserver defaults
update-rc.d: using dependency based boot sequencing
insserv: Script tightvncserver is broken: incomplete LSB comment.
insserv: missing `Provides:' entry: please add.
insserv: missing `Required-Start:' entry: please add even if empty.
insserv: missing `Required-Stop:'  entry: please add even if empty.
insserv: missing `Default-Start:'  entry: please add even if empty.
insserv: missing `Default-Stop:'   entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `tightvncserver'
insserv: Default-Stop  undefined, assuming empty stop  runlevel(s) for script `tightvncserver'
Soluzioni?
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12949
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: [RISOLTO]Real VNC:The connection was refused by the comp

Messaggio da thece »

Molto probabilmente hai ricostruito male lo script /etc/init.d/tightvncserver , oppure hai sbagliato qualche passaggio, ricontrolla.
rax25
Prode Principiante
Messaggi: 161
Iscrizione: lunedì 2 marzo 2015, 20:06
Distribuzione: Xubuntu 16.04 / Raspbian
Sesso: Maschile

Re: [RISOLTO]Real VNC:The connection was refused by the comp

Messaggio da rax25 »

Penso di aver fatto bene i passaggi ma nel dubbio ti posto lo script, mi puoi dire se va bene?

Codice: Seleziona tutto

    #!/bin/sh

    ### BEGIN INIT INFO
    # Provides:          tightvncserver
    # Required-Start:    $local_fs
    # Required-Stop:     $local_fs
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Starts Tight VNC Server
    # Description:       Starts Tight VNC Server
    #
    # To start automatically Tight VNC Server at boot
    # sudo update-rc.d tightvncserver defaults
    #
    # To uninstall
    # sudo update-rc.d -f tightvncserver remove
    #
    ### END INIT INFO

    # Set the USER variable to the name of the user to start tightvncserver under
    export USER='pi'

    eval cd ~$USER

    case "$1" in
       start)
          echo "Starting Tight VNC Server for $USER ..."
          su $USER -c '/usr/bin/tightvncserver :1 -geometry 1024x768 -depth 24 -dpi 96'
          ;;

       stop)
          echo "Stopping Tight VNC Server ..."
          killall Xtightvnc
          ;;

       *)
          echo "Usage: /etc/init.d/tightvncserver {start|stop}"
          exit 1
          ;;
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12949
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: [RISOLTO]Real VNC:The connection was refused by the comp

Messaggio da thece »

Per come lo hai postato direi che la risposta è no.
Ti ho già postato tutti i passi necessari da effettuare. A scopo didattico: perchè non controlli da te? Sei a conoscenza del fatto che esistono dei tool che servono per fare il confronto di file di testo?
rax25
Prode Principiante
Messaggi: 161
Iscrizione: lunedì 2 marzo 2015, 20:06
Distribuzione: Xubuntu 16.04 / Raspbian
Sesso: Maschile

Re: [Risolto]Real VNC:The connection was refused by the comp

Messaggio da rax25 »

Sarei felice di capire dove sbaglio, ma ci ho sbattuto la testa per giorni senza venirne a capo. Per questo chiedo qui, ovviamente non chiedo la pappa pronta, mi sta anche bene un piccolo aiuto per arrivarci da solo, però una mano mi serve perché nella condizione attuale non riesco a capire l'errore :D
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12949
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: [Risolto]Real VNC:The connection was refused by the comp

Messaggio da thece »

rax25 [url=https://forum.ubuntu-it.org/viewtopic.php?p=5014161#p5014161][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: Sarei felice di capire dove sbaglio, ma ci ho sbattuto la testa per giorni senza venirne a capo.
Iniziamo da qui: rispondi a queste domande (con prova):

- hai creato il file dello script?
- il file dello script ha il nome corretto?
- il file dello script è nella posizione corretta?
- il file dello script ha il contenuto corretto? (con dall'assunto che lo script che ti ho passato io è corretto)
- il file dello script ha la proprietà corretta?
- il file dello script ha i permessi corretti?
rax25
Prode Principiante
Messaggi: 161
Iscrizione: lunedì 2 marzo 2015, 20:06
Distribuzione: Xubuntu 16.04 / Raspbian
Sesso: Maschile

Re: [Risolto]Real VNC:The connection was refused by the comp

Messaggio da rax25 »

thece [url=https://forum.ubuntu-it.org/viewtopic.php?p=5014167#p5014167][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto:
rax25 [url=https://forum.ubuntu-it.org/viewtopic.php?p=5014161#p5014161][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: Sarei felice di capire dove sbaglio, ma ci ho sbattuto la testa per giorni senza venirne a capo.
Iniziamo da qui: rispondi a queste domande (con prova):

- hai creato il file dello script?
- il file dello script ha il nome corretto?
- il file dello script è nella posizione corretta?
- il file dello script ha il contenuto corretto? (con dall'assunto che lo script che ti ho passato io è corretto)
- il file dello script ha la proprietà corretta?
- il file dello script ha i permessi corretti?
Grazie per la pazienza!

Allora la buona notizia è che ho risolto perché avevo intuito che il problema fosse nello script, l'ho zappato via e ricopiato il tuo contenuto, ora funziona! :D
La notizia meno buona è che non ho capito nel dettaglio cosa non andasse in quello script...
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12949
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: [Risolto]Real VNC:The connection was refused by the comp

Messaggio da thece »

rax25 [url=https://forum.ubuntu-it.org/viewtopic.php?p=5014268#p5014268][img]https://forum.ubuntu-it.org/images/icons/icona-cita.gif[/img][/url] ha scritto: La notizia meno buona è che non ho capito nel dettaglio cosa non andasse in quello script...
Se tu avessi "perso" tempo a seguire le mie indicazioni ... ma forse non è troppo tardi ... questo è lo script che ti ho postato io

Codice: Seleziona tutto

#!/bin/sh

### BEGIN INIT INFO
# Provides:          tightvncserver
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts Tight VNC Server
# Description:       Starts Tight VNC Server
#
# To start automatically Tight VNC Server at boot
# sudo update-rc.d tightvncserver defaults
#
# To uninstall
# sudo update-rc.d -f tightvncserver remove
#
### END INIT INFO

# Set the USER variable to the name of the user to start tightvncserver under
# export USER='thece'

eval cd ~$USER

case "$1" in
	start)
		echo "Starting Tight VNC Server for $USER ..."
		su $USER -c '/usr/bin/tightvncserver :1 -geometry 1024x768 -depth 24 -dpi 96'
		;;

	stop)
		echo "Stopping Tight VNC Server ..."
		killall Xtightvnc
		;;

	*)
		echo "Usage: /etc/init.d/tightvncserver {start|stop}"
		exit 1
		;;
esac

exit 0
mentre questo è lo script che mi hai riportato tu

Codice: Seleziona tutto

    #!/bin/sh

    ### BEGIN INIT INFO
    # Provides:          tightvncserver
    # Required-Start:    $local_fs
    # Required-Stop:     $local_fs
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: Starts Tight VNC Server
    # Description:       Starts Tight VNC Server
    #
    # To start automatically Tight VNC Server at boot
    # sudo update-rc.d tightvncserver defaults
    #
    # To uninstall
    # sudo update-rc.d -f tightvncserver remove
    #
    ### END INIT INFO

    # Set the USER variable to the name of the user to start tightvncserver under
    export USER='pi'

    eval cd ~$USER

    case "$1" in
       start)
          echo "Starting Tight VNC Server for $USER ..."
          su $USER -c '/usr/bin/tightvncserver :1 -geometry 1024x768 -depth 24 -dpi 96'
          ;;

       stop)
          echo "Stopping Tight VNC Server ..."
          killall Xtightvnc
          ;;

       *)
          echo "Usage: /etc/init.d/tightvncserver {start|stop}"
          exit 1
          ;;
se hai voglia di di provare ad usare un confrontatore di file di testo.
rax25
Prode Principiante
Messaggi: 161
Iscrizione: lunedì 2 marzo 2015, 20:06
Distribuzione: Xubuntu 16.04 / Raspbian
Sesso: Maschile

Re: [Risolto]Real VNC:The connection was refused by the comp

Messaggio da rax25 »

Ho utilizzato il comando "diff" con la seguente stringa:

Codice: Seleziona tutto

sudo diff -y originale copia
dove il tuo file è "originale".
Le differenze che ho notato sono due:
1) nel mio file c'è una gestione differente degli spazi ad inizio rigo;
2) nel mio file è assente la parte finale:

Codice: Seleziona tutto

  esac                                                      <
                                                              <
    exit 0    
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12949
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: [Risolto]Real VNC:The connection was refused by the comp

Messaggio da thece »

Questo è poco importante. Comunque è sempre bene riallineare a sinistra il testo copiato dal Forum attraverso il Copia&Incolla. E' un problema dovuto al browser.
Tombola!



Per quanto io sia un "entusiasta" del terminale, per questo genere di operazioni è meglio appoggiarsi ad uno strumento grafico tipo DiffMerge, Meld, Beyond Compare o simili. L'operatività migliora notevolmente.
rax25
Prode Principiante
Messaggi: 161
Iscrizione: lunedì 2 marzo 2015, 20:06
Distribuzione: Xubuntu 16.04 / Raspbian
Sesso: Maschile

Re: [Risolto]Real VNC:The connection was refused by the comp

Messaggio da rax25 »

[quote="thece Immagine"
Per quanto io sia un "entusiasta" del terminale, per questo genere di operazioni è meglio appoggiarsi ad uno strumento grafico tipo DiffMerge, Meld, Beyond Compare o simili. L'operatività migliora notevolmente.[/quote]

Ci avevo pensato, ma visto che questa era una delle ultime configurazioni che dovrò eseguire sul raspberry, per non appesantirlo troppo, in prima battuta ho deciso di provare col terminale intanto, se non ne fossi venuto a capo, avrei usato anche programmi da GUI.

Grazie mille per la lezione! :ciao:
Scrivi risposta

Ritorna a “Connessione e configurazione delle reti”

Chi c’è in linea

Visualizzano questa sezione: 0 utenti iscritti e 9 ospiti