Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Lightdm and x11vnc startup
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
g-virus
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2017
Posts: 111

PostPosted: Fri Mar 22, 2019 12:58 pm    Post subject: Lightdm and x11vnc startup Reply with quote

Hello, everyone. I'm fighting with one problem - how to startup x11vnc server with lightdm. I have i3wm installed with LightDM, everything is configured and works, but the only problem is remaining - I cannot start x11vnc properly. It complains that it can't open display :0. I've tried many ways:

1. Tried to change depends() function in x11vnc init-script, (changed "need xdm" to "after xdm") - doesn't work
2. Tried to use VNCServer section in the lightdm configuration file. (changed "enabled" to true and replaced the "command" with "rc-service x11vnc re-/start") - doesn't work
3. Tried to use display-setup-script just to try to run x11vnc after the lightdm will run X. Also I tried to use greeter-setup-script. Both are don't work :(
4. Tried to use for-loop in start() function of x11vnc init-script just to wait for X will launch. Doesn't work

Why am I still trying to find a way to launch it? Because if I wait for LightDM will start (while greeter will appear) and switch to another terminal and launch x11vnc manually - it works! So please help me to fix it, thanks in advance!

I really wouldn't like to use TigerVNC since I already have Xserver installed and I don't want to have overhead software
Back to top
View user's profile Send private message
g-virus
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2017
Posts: 111

PostPosted: Wed Mar 27, 2019 3:59 pm    Post subject: Reply with quote

As I found out, x11vnc doesn't want to start before a user session will be started. But I've set up the LightDM to skip a password entrance and go further, but x11vnc still didn't start up....
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Wed Mar 27, 2019 7:05 pm    Post subject: Reply with quote

Hello, I use X11vnc. When no normal user is connected to X, to access the display manager I start X11vnc service as root with the Xauthority that Lightdm have created in the /run directory.

When a user is connected I use the $HOME/.Xauthority of this user.

I think it's mandatory to start X11vnc as root to access the display manager who can only be seen when no user is connected to X. I use a Systemd unit x11vnc.service to start X11vnc.

I can show you this unit if you want with all X11vnc parameters that I use. X11vnc work nornally for me.
_________________
Paul
Back to top
View user's profile Send private message
g-virus
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2017
Posts: 111

PostPosted: Fri Mar 29, 2019 11:22 pm    Post subject: Reply with quote

Logicien wrote:
Hello, I use X11vnc. When no normal user is connected to X, to access the display manager I start X11vnc service as root with the Xauthority that Lightdm have created in the /run directory.

When a user is connected I use the $HOME/.Xauthority of this user.

I think it's mandatory to start X11vnc as root to access the display manager who can only be seen when no user is connected to X. I use a Systemd unit x11vnc.service to start X11vnc.

I can show you this unit if you want with all X11vnc parameters that I use. X11vnc work nornally for me.


Hi. Thank you, but I use OpenRC :) Anyway, I've checked x11vnc openrc-init script, and it actually tries to find proper .Xauthority, so it does everything you have offered. No idea what is a problem..
Back to top
View user's profile Send private message
g-virus
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2017
Posts: 111

PostPosted: Mon Apr 15, 2019 11:27 am    Post subject: Reply with quote

Any more ideas, guys? :) The question is still relevant
Back to top
View user's profile Send private message
g-virus
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2017
Posts: 111

PostPosted: Mon May 06, 2019 3:49 pm    Post subject: Reply with quote

By the way, I forgot to say I have a headless machine without any specific Xorg configurations. Could it be a reason for x11vnc fails? Probably I need to have some common xorg configuration, but I've tried everything described above with the machine connected via HDMI and nothing changes. Interesting that x11vnc starts to work after I log in via ssh first, seems like the service waits for some state
Back to top
View user's profile Send private message
Elleni
Veteran
Veteran


Joined: 23 May 2006
Posts: 1270

PostPosted: Mon May 06, 2019 7:18 pm    Post subject: Reply with quote

Do you know x2goserver? I just played a bit with it. You just emerge the server and enable x11 forwarding in ssh config. Then you can connect to it with x2client. Both are in portage. Maybe worth a try?

Edit to add, it works fine with lxde, but not with the both big ones, kde and gnome :(
Back to top
View user's profile Send private message
g-virus
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2017
Posts: 111

PostPosted: Fri May 10, 2019 1:41 pm    Post subject: Reply with quote

Elleni wrote:
Do you know x2goserver? I just played a bit with it. You just emerge the server and enable x11 forwarding in ssh config. Then you can connect to it with x2client. Both are in portage. Maybe worth a try?

Edit to add, it works fine with lxde, but not with the both big ones, kde and gnome :(


Hi. There is i3wm on the machine, but the VNC server is still needed since clients are VNC ready. I almost reached my goal, the only remaining thing is to have x11vnc launched on startup :D
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Fri May 10, 2019 1:52 pm    Post subject: Reply with quote

I had similar issue, I needed x11vnc running on multiple non primary X sessions with lighdm,
I've used this startup script to make it work, maybe it would help you.
Code:
#!/sbin/openrc-run
# Distributed under the terms of the GNU General Public License, v2

PORTS=(16381 16411 16301 16273)
X_PATH="$(which Xorg)"
PS_X_PATH="/usr/bin/X"
PS_CMD="ps aux | grep ${PS_X_PATH} | grep -v grep"

depend() {
        after xdm
}

#                lightdm)
#                        EXE=/usr/sbin/lightdm
#                        PIDFILE=/run/lightdm.pid
#                        START_STOP_ARGS="--background"
#                        ;;

start() {
        ebegin "Starting up other seats"
   local NUM_OF_GPUS=$(lspci | egrep -i 'display|vga' | wc -l)

   while [ 1 ]; do
      local NEXT_X_SESSION_ID=$(eval "${PS_CMD}" | cut -f 2- -d '/' | tr ' ' '\n' | egrep "^:[0-9]+$" | cut -f 2 -d : | sort -n | tail -1)
      local NEXT_X_SESSION_ID=$((NEXT_X_SESSION_ID+1))
      local X_CONFIG_FILE="seat${NEXT_X_SESSION_ID}.conf"
      local NUM_OF_ACTIVE_X_SESSIONS=$(eval "${PS_CMD}" | wc -l)

      if [ ${NUM_OF_ACTIVE_X_SESSIONS} -ge ${NUM_OF_GPUS} -o ! -f "/etc/X11/${X_CONFIG_FILE}" ]; then
         break;
      fi

      local NEXT_SEAT_ID=$(dm-tool list-seats | grep "^Seat" | sort -n | tail -1 | sed 's/^Seat//g')
      local NEXT_SEAT_ID=$((NEXT_SEAT_ID+1))
      local NEXT_VT_ID=$(eval "${PS_CMD}" | cut -f 2- -d '/' | tr ' ' '\n' | egrep "^vt[0-9]+$" | sed 's/^vt//g' | sort -n | tail -1)
      local NEXT_VT_ID=$((NEXT_VT_ID+1))

      einfo "Starting Seat ${NEXT_SEAT_ID} on display ${NEXT_X_SESSION_ID}, vt ${NEXT_VT_ID}"
      ${X_PATH} :${NEXT_X_SESSION_ID} -seat seat${NEXT_SEAT_ID} -auth /var/run/lightdm/root/:${NEXT_X_SESSION_ID} -nolisten tcp vt${NEXT_VT_ID} -novtswitch -config ${X_CONFIG_FILE} &
      sleep 1s
      eval "${PS_CMD}" | grep -q " :${NEXT_X_SESSION_ID} "
      if [ $? -eq 0 ]; then
         x11vnc -dontdisconnect -shared -forever -cursor arrow -rfbport ${PORTS[$((NEXT_X_SESSION_ID-1))]} -bg -o /var/log/x11vnc-${NEXT_X_SESSION_ID}.log -display :${NEXT_X_SESSION_ID} > /dev/null
         dm-tool add-local-x-seat ${NEXT_X_SESSION_ID} > /dev/null
      fi
   done

   eend 0
}

stop() {
   kill -9 $(eval "${PS_CMD}" | grep -v " :0 " | awk '{print $2}' | xargs)
        return 0
}

# vim: set ts=4 :


the most relevant part for you is this:
Code:
x11vnc -dontdisconnect -shared -forever -cursor arrow -rfbport ${PORTS[$((NEXT_X_SESSION_ID-1))]} -bg -o /var/log/x11vnc-${NEXT_X_SESSION_ID}.log -display :${NEXT_X_SESSION_ID} > /dev/null
         dm-tool add-local-x-seat ${NEXT_X_SESSION_ID} > /dev/null


I hope it works.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
g-virus
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2017
Posts: 111

PostPosted: Wed May 15, 2019 9:59 pm    Post subject: Reply with quote

[/code]

the most relevant part for you is this:
Code:
x11vnc -dontdisconnect -shared -forever -cursor arrow -rfbport ${PORTS[$((NEXT_X_SESSION_ID-1))]} -bg -o /var/log/x11vnc-${NEXT_X_SESSION_ID}.log -display :${NEXT_X_SESSION_ID} > /dev/null
         dm-tool add-local-x-seat ${NEXT_X_SESSION_ID} > /dev/null


I hope it works.[/quote]

Hi. Thank you for your suggestion, I just tried it now and, unfortunately, that didn't help :( But finally I found a real reason why doesn't it work actually. It cannot start without a network, despite the fact that I commented out "need net" in the x11vnc's init-script. It works perfectly with default parameters if a network device is available. The problem is I have a network device running on startup, but it is running with the hostapd service and configured with a static IP address (WIreless access point). I have my laptop connected to this WiFi-AP and I can connect to SSH for example, it works perfectly. But when I try to connect to x11vnc it refuses a connection. I cannot find any parameters of x11vnc that could be used to replace a network interfaces used by x11vnc, and I actually have no idea why it would need a specific net-device since SSH works in this situation, for example. Do you have any ideas how can I fix this last issue? I've almost reached my goal :D
Back to top
View user's profile Send private message
g-virus
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2017
Posts: 111

PostPosted: Wed Jun 19, 2019 9:33 pm    Post subject: Reply with quote

Hello again. I found a reason: x11vnc doesn't start without net.* service. It needs any service running successfully, wlan or ethernet. It works without internet as well. I've tried to edit init file x11vnc, removed need net, added need hostapd,
unfortunately it doesn't help. Also I've added a parameter to x11vnc to listen only Ip address that is set on wlan0 internal wifi interface that used in hostapd service. How could I fix that?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum