What $DISPLAY is when on login screen? aka how to run x11vnc and set resolution with xrandr on the login screen?

So I have a second computer on which I have installed manjaro to try. (I use debian on main PC).
I do not want to need to have keyboard, mouse or monitor connected to it. I want it to survive restart and be back online available with vnc.

Curently, I must login manualy or have it login automaticaly, than start a script manualy or through the “Startup Aplications” in gnome-tweaks to set the proper resolution (because it won’t detect it). x11vnc is started using cron @reboot path to script before the actual login happens, but closes any attempted connection and restarts (should be the -loop flag) . After loging in it starts working.

I have spent a long time looking through formus and wikis and now I really do not know what to do.

So, my question is, how to run x11vnc so I can use vnc to login and how to automaticaly set resolution even to the login screen.

Thanks.

x11vnc is run with -rfbauth -repeat -loop -forever -shared -auth guess -find , I connect through ssh
it’s intel pentium dual core

:+1: Welcome to Manjaro! :+1:

  1. Please read this:
    How to provide good information
    and post some more information so we can see what’s really going on. Now we know the symptom of the disease, but we need some more probing to know where the origin lies…

  2. An inxi --admin --verbosity=7 --filter --no-host --width would be the minimum required information… (Personally Identifiable Information like serial numbers and MAC addresses will be filtered out by the above command)

  3. What are the contents of /etc/systemd/system/x11vnc.service ?

  4. Please remove the cron.

:+1:

I’m sorry I did not provide enough information.
Output of inxi (that’s an awesome utility lol)

System:
  Kernel: 5.9.16-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.2.1 
  parameters: BOOT_IMAGE=/boot/vmlinuz-5.9-x86_64 
  root=UUID=a7c1732f-ef16-4b20-80da-1a3d28a1b48a ro quiet splash apparmor=1 
  security=apparmor resume=UUID=b0bd445d-a8ba-4119-b998-4bf4e8e006d0 
  udev.log_priority=3 
  Desktop: GNOME 3.38.3 tk: GTK 3.24.24 wm: gnome-shell 
  dm: GDM 3.38.2.1, LightDM 1.30.0 Distro: Manjaro Linux 
Machine:
  Type: Desktop System: Hewlett-Packard product: HP Compaq 6000 Pro SFF PC 
  v: N/A serial: <filter> Chassis: type: 4 serial: <filter> 
  Mobo: Hewlett-Packard model: 3048h serial: <filter> BIOS: Hewlett-Packard 
  v: 786G2 v01.09 date: 08/25/2009 
Memory:
  RAM: total: 5.68 GiB used: 3.09 GiB (54.5%) 
  RAM Report: permissions: Unable to run dmidecode. Root privileges required. 
CPU:
  Info: Dual Core model: Pentium E5300 bits: 64 type: MCP arch: Penryn 
  family: 6 model-id: 17 (23) stepping: A (10) microcode: A0B L2 cache: 2 MiB 
  bogomips: 10377 
  Speed: 2416 MHz min/max: 1200/2600 MHz Core speeds (MHz): 1: 2416 2: 2261 
  Flags: acpi aperfmperf apic arch_perfmon bts clflush cmov constant_tsc cpuid 
  cx16 cx8 de ds_cpl dtes64 dtherm dts est fpu fxsr ht lahf_lm lm mca mce mmx 
  monitor msr mtrr nopl nx pae pat pbe pdcm pebs pge pni pse pse36 pti 
  rep_good sep sse sse2 ssse3 syscall tm tm2 tsc vme xsave xtpr 
  Vulnerabilities: Type: itlb_multihit status: KVM: VMX unsupported 
  Type: l1tf mitigation: PTE Inversion 
  Type: mds 
  status: Vulnerable: Clear CPU buffers attempted, no microcode; SMT disabled 
  Type: meltdown mitigation: PTI 
  Type: spec_store_bypass status: Vulnerable 
  Type: spectre_v1 
  mitigation: usercopy/swapgs barriers and __user pointer sanitization 
  Type: spectre_v2 
  mitigation: Full generic retpoline, STIBP: disabled, RSB filling 
  Type: srbds status: Not affected 
  Type: tsx_async_abort status: Not affected 
Graphics:
  Device-1: Intel 4 Series Integrated Graphics vendor: Hewlett-Packard 
  driver: i915 v: kernel bus ID: 00:02.0 chip ID: 8086:2e12 class ID: 0300 
  Display: x11 server: X.Org 1.20.10 compositor: gnome-shell driver: 
  loaded: modesetting alternate: fbdev,intel,vesa display ID: :0 screens: 1 
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 507x285mm (20.0x11.2") 
  s-diag: 582mm (22.9") 
  Monitor-1: VGA-1 res: 1920x1080 hz: 60 
  OpenGL: renderer: Mesa DRI Intel Q45/Q43 (ELK) v: 2.1 Mesa 20.3.4 
  direct render: Yes 
Audio:
  Device-1: Intel 82801JD/DO HD Audio vendor: Hewlett-Packard 
  driver: snd_hda_intel v: kernel bus ID: 00:1b.0 chip ID: 8086:3a6e 
  class ID: 0403 
  Sound Server: ALSA v: k5.9.16-1-MANJARO 
Network:
  Device-1: Intel 82567LM-3 Gigabit Network vendor: Hewlett-Packard 
  driver: e1000e v: kernel port: 1100 bus ID: 00:19.0 chip ID: 8086:10de 
  class ID: 0200 
  IF: enp0s25 state: up speed: 100 Mbps duplex: full mac: <filter> 
  IP v4: <filter> type: noprefixroute scope: global broadcast: <filter> 
  IP v6: <filter> type: noprefixroute scope: link 
  WAN IP: <filter> 
Bluetooth:
  Message: No Bluetooth data was found. 
RAID:
  Message: No RAID data was found. 
Drives:
  Local Storage: total: 232.89 GiB used: 10.84 GiB (4.7%) 
  SMART Message: Required tool smartctl not installed. Check --recommends 
  ID-1: /dev/sda maj-min: 8:0 vendor: Seagate model: ST250DM000-1BD141 
  size: 232.89 GiB block size: physical: 4096 B logical: 512 B speed: 3.0 Gb/s 
  rotation: 7200 rpm serial: <filter> rev: HP73 scheme: MBR 
  Message: No Optical or Floppy data was found. 
Partition:
  ID-1: / raw size: 78.12 GiB size: 76.4 GiB (97.79%) used: 9.36 GiB (12.2%) 
  fs: ext4 dev: /dev/sda3 maj-min: 8:3 label: N/A 
  uuid: a7c1732f-ef16-4b20-80da-1a3d28a1b48a 
  ID-2: /home raw size: 146.76 GiB size: 143.45 GiB (97.75%) 
  used: 1.48 GiB (1.0%) fs: ext4 dev: /dev/sda2 maj-min: 8:2 label: N/A 
  uuid: ae58cc92-3a36-4c3a-b2c6-c501d929f016 
Swap:
  Kernel: swappiness: 60 (default) cache pressure: 100 (default) 
  ID-1: swap-1 type: partition size: 8 GiB used: 0 KiB (0.0%) priority: -2 
  dev: /dev/sda1 maj-min: 8:1 label: N/A 
  uuid: b0bd445d-a8ba-4119-b998-4bf4e8e006d0 
Unmounted:
  Message: No Unmounted partitions found. 
USB:
  Hub-1: 1-0:1 info: Full speed (or root) Hub ports: 6 rev: 2.0 
  speed: 480 Mb/s chip ID: 1d6b:0002 class ID: 0900 
  Hub-2: 2-0:1 info: Full speed (or root) Hub ports: 6 rev: 2.0 
  speed: 480 Mb/s chip ID: 1d6b:0002 class ID: 0900 
  Device-1: 2-2:2 info: Realtek USB2.0-CRW type: Mass Storage 
  driver: usb-storage interfaces: 1 rev: 2.0 speed: 480 Mb/s 
  chip ID: 0bda:0181 class ID: 0806 serial: <filter> 
  Hub-3: 3-0:1 info: Full speed (or root) Hub ports: 2 rev: 1.1 speed: 12 Mb/s 
  chip ID: 1d6b:0001 class ID: 0900 
  Hub-4: 4-0:1 info: Full speed (or root) Hub ports: 2 rev: 1.1 speed: 12 Mb/s 
  chip ID: 1d6b:0001 class ID: 0900 
  Hub-5: 5-0:1 info: Full speed (or root) Hub ports: 2 rev: 1.1 speed: 12 Mb/s 
  chip ID: 1d6b:0001 class ID: 0900 
  Hub-6: 6-0:1 info: Full speed (or root) Hub ports: 2 rev: 1.1 speed: 12 Mb/s 
  chip ID: 1d6b:0001 class ID: 0900 
  Hub-7: 7-0:1 info: Full speed (or root) Hub ports: 2 rev: 1.1 speed: 12 Mb/s 
  chip ID: 1d6b:0001 class ID: 0900 
  Hub-8: 8-0:1 info: Full speed (or root) Hub ports: 2 rev: 1.1 speed: 12 Mb/s 
  chip ID: 1d6b:0001 class ID: 0900 
  Device-1: 8-2:2 info: Lenovo 300 Wireless Compact Mouse type: Mouse 
  driver: hid-generic,usbhid interfaces: 1 rev: 1.1 speed: 12 Mb/s 
  chip ID: 17ef:60ac class ID: 0301 
Sensors:
  System Temperatures: cpu: 41.0 C mobo: N/A 
  Fan Speeds (RPM): N/A 
Info:
  Processes: 195 Uptime: 15h 32m wakeups: 0 Init: systemd v: 247 Compilers: 
  gcc: N/A Packages: pacman: 1228 lib: 360 flatpak: 0 Shell: Zsh v: 5.8 
  running in: gnome-terminal inxi: 3.3.01 `

It’s nearly fresh install.

/etc/systemd/system/x11vnc.service does not exist

contents of /lib/systemd/system/x11vnc.service :

[Unit]
Description=VNC Server for X11
Requires=graphical.target
After=graphical.target

[Service]
ExecStart=/usr/bin/x11vnc

This got created automatically after install. (didn’t happen on debian lol)

Why should I disable cron?
I know I am asking another unrelated question but cron (cronie.service) was disabled by default and when apropos didn’t work I got answer from the internet in the lines off “run mandb, it should be a cron job/it should run after every udpate/package install”. So what am I missing here?

Thank you.

Kernel 5.9.16-1-MANJARO is EOL. Upgrade to 5.4 LTS (Long Term Support) or 5.10 LTS.

  • Because that’s mis-using technology: you want vnc to be available at boot time and that’s done through SystemD, not the scheduler.

  • The file in /lib is an example file that you need to personalize so:

    cp /lib/systemd/system/x11vnc.service /etc/systemd/system/x11vnc.service

Now edit /etc/systemd/system/x11vnc.service, remove ExecStart=/usr/bin/x11vnc and add the following:

[Service]
Type=forking
User=szYourUserName
ExecStart=/usr/bin/vncserver -geometry 1920x1080 -depth 16 -dpi 96 -alwaysshared -localhost %i
ExecStop=/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target

Where:

  • Screen-1: 0 s-res: 1920x1080 s-dpi: 96 from your inxi gave me the above information.
  • I’m assulung you’re using xorg and not wayland.

Now enable the service:

systemctl enable x11vnc

reboot to test whether it survives a reboot and connect.

:crossed_fingers:

1 Like

Ok, I understand my mis-use of cron. I use it as a “workaround” before I get it working with systemd
I do not have tigervnc installed, that’s the vncserver. I wanted to use x11vnc. So I installed vncserver, edited the x11vnc.service and enabled it. After restart it did not start. I have autologin enabled, maybe that’s the cause?
Anyway I tried running systemctl start x11vnc and here is output of systemctl status x11vnc:

● x11vnc.service - VNC Server for X11
     Loaded: loaded (/etc/systemd/system/x11vnc.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Thu 2021-02-25 11:44:15 CET; 2s ago
    Process: 1699 ExecStart=/usr/bin/vncserver -geometry 1920x1080 -depth 16 -dpi 96 -alwaysshared -localhost  (code=exited, status=2)

Feb 25 11:44:15 bilbo systemd[1]: Starting VNC Server for X11...
Feb 25 11:44:15 bilbo vncserver[1699]: usage: vncserver <display>
Feb 25 11:44:15 bilbo systemd[1]: x11vnc.service: Control process exited, code=exited, status=2/INVALIDARGUMENT
Feb 25 11:44:15 bilbo systemd[1]: x11vnc.service: Failed with result 'exit-code'.
Feb 25 11:44:15 bilbo systemd[1]: Failed to start VNC Server for X11.

Change %1 to ":0" and try again.

Nope. The same error when trying to start it manualy and after boot it doesn’t even try starting, no log in systemctl status x11vnc

Try with your original parameters that seemed to be working instead of mine:

I tried that, using x11vnc, not vncserver. It won’t even try to start after boot but when started from systemctl start x11vnc it works. The command doesn’t return to command line but hangs, even when I “control+c” it, the systemctl stops it for exceeding start operation timeout after some time.
Here is how my x11vnc.service looks now, I asume that there is some mistake.

[Unit]
Description=VNC Server for X11
Requires=graphical.target
After=graphical.target

[Service]
Type=forking
User=sukulent
ExecStart=/usr/bin/x11vnc -rfbauth /home/sukulent/.vnc/passwd -rfbport 5901 -repeat -forever -loop -shared -find -auth guess

[Install]
WantedBy=multi-user.target

Htmpf! Try setting Type=simple and after a reboot, please provide the output of:

systemctl status x11vnc
systemctl start x11vnc

:thinking:

Oh god, I feel bad for not responding to you for such a long time. I did other stuff and didn’t use this second PC so I kinda forgot about this.

I still did not solved the original problem. I am currently using autologin with .desktop files in ~/.config/autostart/ which point at my .sh files which run after the login. One starts the x11vnc server with my arguments and the other sets the resulution using xrand. This works well.
Also, while using it as a server I eventually want to use ssh and byobu whithout x-server.

Thank you for your help