ne peut pas démarrer x11vnc sans moniteur connecté

Je voudrais installer x11vnc (ou tout autre server vnc) pour démarrer au moment du démarrage. Le gestionnaire d'affichage est kdm , la dissortingbution est Ubuntu 12.04.2 LTS.

Lorsque j'essaie de démarrer x11vnc, j'obtiens ces erreurs:

 $ x11vnc -rfbauth /var/run/xauth/A:0-crWk72 -rfbport 5901 passing arg to libvncserver: -rfbauth passing arg to libvncserver: /var/run/xauth/A:0-crWk72 passing arg to libvncserver: -rfbport passing arg to libvncserver: 5901 x11vnc version: 0.9.12 lastmod: 2010-09-09 pid: 2828 XOpenDisplay("") failed. Trying again with XAUTHLOCALHOSTNAME=localhost ... *** XOpenDisplay failed. No -display or DISPLAY. *** Trying ":0" in 4 seconds. Press Ctrl-C to abort. *** 1 2 3 4 XOpenDisplay(":0") failed. Trying again with XAUTHLOCALHOSTNAME=localhost ... XOpenDisplay(":0") failed. Trying again with unset XAUTHLOCALHOSTNAME ... 

J'ai essayé d'installer xserver-xorg-video-dummy afin d'éviter les problèmes sans écran attaché, mais jusqu'à présent sans succès.

Je suis venu avec la solution suivante:

  1. sudo apt-get install x11vnc xserver-xorg-video-dummy
  2. vérifiez /etc/default/grub qu'il inclut le drapeau nomodeset :

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"

  3. Créez (ou modifiez) /etc/X11/xorg.conf , modifiez l'adresse USER et LISTEN fonction de vos parameters.

 Section "Monitor" Identifier "Monitor0" HorizSync 28.0-80.0 VertRefresh 48.0-75.0 # 1680x1050 @ 60.00 Hz (GTF) hsync: 65.22 kHz; pclk: 147.14 MHz Modeline "1680x1050_60.00" 147.14 1680 1784 1968 2256 1050 1051 1054 1087 -HSync +Vsync EndSection Section "Device" Identifier "Card0" Driver "dummy" VideoRam 256000 EndSection Section "Screen" DefaultDepth 24 Identifier "Screen0" Device "Card0" Monitor "Monitor0" SubSection "Display" Depth 24 Modes "1680x1050" EndSubSection EndSection 

Vous pouvez générer votre propre résolution .

4 – créer un script de service dans /etc/init.d/vncserver

 #!/bin/sh -e ### BEGIN INIT INFO # Provides: vncserver # Required-Start: networking # Default-Start: 3 4 5 # Default-Stop: 0 6 ### END INIT INFO PATH="$PATH:/usr/X11R6/bin/" CMD="/usr/bin/x11vnc" # The Username:Group that will run VNC export USER="your_username" # The display that VNC will use DISPLAY="1" # Color depth (between 8 and 32) DEPTH="16" # The Desktop geometry to use. #GEOMETRY="<WIDTH>x<HEIGHT>" #GEOMETRY="800x600" GEOMETRY="1680x1050" #GEOMETRY="1280x1024" # The name that the VNC Desktop will have. NAME="my-vnc-server" PORT=5900 LISTEN="192.168.1.10" OPTIONS="-xkb -noxrecord -noxfixes -noxdamage -listn ${LISTEN} -name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY} -auth guess -usepw ~/.vnc/passwd -rfbport ${PORT} -forever -bg -oa /var/log/x11vnc.log" . /lib/lsb/init-functions case "$1" in start) echo ${OPTIONS} log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "${CMD} ${OPTIONS}" ;; stop) log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "${CMD} -kill :${DISPLAY}" ;; restart) $0 stop $0 start ;; esac exit 0 

Ce qui suit me donne toujours une session VNC de travail rapidement:

 apt-get install vnc4server x11-xserver-utils xserver-xorg-video-dummy xterm wm2 

J'ai ajouté x11-xserver-utils et xserver-xorg-video-dummy dans le cas où X11 n'est pas encore installé sur votre système et que vous voulez éviter d'avoir une installation complète de X11. Cependant, ce point est probablement hors de propos dans votre cas, il suffit de l'append au cas où quelqu'un d'autre le findait utile.

J'ai ajouté xterm et wm2 au cas où vous voudriez une installation simple et pas une session gnome complète ou similaire. Si tel est le cas, exécutez vnc4server sous votre count d'user pour créer automatiquement ~ / .vnc / xstartup. Puis tuez-le et éditez ~ / .vnc / xstartup et ajoutez les 2 lignes suivantes au bas.

 x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & wm2 & 

Et réexécutez vnc4server.

Sinon, il suffit de lancer vnc4server sous votre propre count devrait suffire. Lorsqu'il est démarré pour la première fois, vncserver vous requestra de créer un mot de passe, utilisez ce mot de passe pour vous connecter à partir d'un système distant.

Sur le système distant, installez quelque chose comme xtightvncviewer et utilisez-le pour vous connecter à votre server vnc:

 apt-get install xtightvncviewer xtightvncviewer 192.0.2.1:1 [1] 

1 – Consultez http://www.iana.org/go/rfc5737 pour savoir pourquoi utiliser cette plage d'adresses IP dans la documentation