INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Running MC headless -no physical display on the machine on which MC is installed  (Read 10730 times)

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13875

This thread is for users to post their method(s) of running MC headless (connecting to the installation machine with a client like vnc, ssh, remote desktop, etc).

I'll start it off with my dummy X server configuration.
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13875
Using the linux package xserver-xorg-video-dummy
« Reply #1 on: February 13, 2017, 02:24:04 pm »

To me this is the simplest and seems to work no matter how you use it. It's designed to run totally headless. There is no video server display possible on the installation machine.

On the MC installation machine:

sudo apt-get install xserver-xorg-video-dummy
This will pull in the dummy video display and all of it's prerequisites.

Here is the configuration file I use for the dummy xserver:
/etc/X11/xorg.conf

Code: [Select]
Section "Files"
        FontPath        "/usr/share/fonts/X11/misc"
        FontPath        "/usr/X11R6/lib/X11/fonts/misc"
        FontPath        "/usr/share/fonts/X11/cyrillic"
        FontPath        "/usr/X11R6/lib/X11/fonts/cyrillic"
        FontPath        "/usr/share/fonts/X11/100dpi/:unscaled"
        FontPath        "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
        FontPath        "/usr/share/fonts/X11/75dpi/:unscaled"
        FontPath        "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
        FontPath        "/usr/share/fonts/X11/Type1"
        FontPath        "/usr/X11R6/lib/X11/fonts/Type1"
        FontPath        "/usr/share/fonts/X11/100dpi"
        FontPath        "/usr/X11R6/lib/X11/fonts/100dpi"
        FontPath        "/usr/share/fonts/X11/75dpi"
        FontPath        "/usr/X11R6/lib/X11/fonts/75dpi"
        # path to defoma fonts
        FontPath        "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
EndSection
Section "Device"
    Identifier  "Configured Video Device"
    Driver      "dummy"
    VideoRam 10000
EndSection

Section "Monitor"
    Identifier  "Configured Monitor"
    HorizSync 5.0 - 1000.0
    VertRefresh 5.0 - 200.0
    Modeline "1920x1080" 23.53 1920 1952 2040 2072 1080 1106 1108 1135
EndSection

Section "Screen"
    Identifier  "Default Screen"
    Monitor     "Configured Monitor"
    Device      "Configured Video Device"
    DefaultDepth 24
    SubSection "Display"
    Depth 24
    Modes "1920x1080"
    EndSubSection
EndSection

This has the old fixed fonts in it as well. It will also work for MC 20 and 21.
The default display size is 1920x1080

Now you need to start this up somehow. If you are using debian JESSIE, by default it uses systemd.
See the following for information on how to configure that:
https://yabb.jriver.com/interact/index.php/topic,108981.0.html

Next add a vnc server:
sudo apt-get install x11vnc
This will pull in the vnc server and all of it's prerequisites.

I run this as follows from the /etc/rc.local script which on my machine starts after the dummy xserver is running:
x11vnc -q -display :0 -bg -forever -geometry 1920x1080 -rfbport 5900 -rfbauth /home/bob/.vnc/passwd

The file /home/bob/.vnc/passwd contains the password to use when you connect with a vnc client.
You can create it as follows (for example as user bob):
mkdir -p /home/bob/.vnc
x11vnc -storepasswd mypasword /home/bob/.vnc/passwd


You should now be able to connect to your MC machine with a vnc client. I've used xtightvncviewer on linux and tightvnc on windows successfully.

Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13875
Using ssh to run MC remotely
« Reply #2 on: February 13, 2017, 02:35:41 pm »

Pretty much all linux has a running ssh server these days.
You may have to turn on an X11 forwarding on the MC server machine and restart ssh.
In the sshd_config file you want:
X11Forwarding yes

Then you can connect to that machine with another linux machine (or Mac running XQuartz from a XQuartz terminal window).

ssh -X the-macine-mc-is-on

Login as the user that normally runs MC, NOT as root.

If MC is running remotely you'll want to kill it before accessing it over the X connection (if not skip the following 2 lines):
killall -HUP mediacenter22
and wait 20 seconds or so for it to shut down gracefully.

Then you can simply run MediaCenter
mediacenter22

Performance will be MUCH better over the lan as opposed to a wan connection.

If you need to restart MC on the remote machine, after you exit your running version of MC do:
export DISPLAY=:0 ; nohup mediacenter22 &


Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13875
Using an remote XServer to run MC
« Reply #3 on: February 13, 2017, 02:57:24 pm »

This is similar to the ssh method except that you don't use ssh forwarding, you simply redirect the display to your client machine.

In the case of linux, or Mac (with XQuartz) you open up a terminal window and do

xhost +
which allows remote X connections to your server.

Then connect to your MC server machine using ssh and do:

export DISPLAY=1.2.3.4:0   (replace 1.2.3.4 with the IP address of your linux or Mac machine).

Then simply
mediacenter22

You will want to kill any running copies of MC as in the ssh example first.


You can also do this from Windows!
Install xming xserver
http://www.straightrunning.com/XmingNotes/
and run it.
Using putty either create or use an existing connection configuration however in the left pane under connection->ssh enable X forwarding.
Then connect to your MC server with putty and from the putty terminal:
export DISPLAY=1.2.3.4:0   (replace 1.2.3.4 with the IP address of your Windows machine).

and
mediacenter22
Logged

imugli

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1598

I use x2go with xfce desktop environment. It requires an x11 environment (e.g XQuartz on Mac) on the client side, but works well.

I'll post a setup when I get a chance.

kdwykleingeld

  • World Citizen
  • ***
  • Posts: 118

Hi, i use MobaXterm (free) with xrdp for most other tasks but for mc this does not seem to work since it appears to be a 16 bit (color) combination and mc requires a 24 bit solution. Will try out the other suggestions posted here. For my windows environment i used to use vnc (realvnc) in the past. Thanks and keep posting here !

reg koen
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5234
  • "Linux Merit Badge" Recipient

My method of remote access requires minimal configuration and is fairly robust.  It relies on autostarting the machine's actual display hardware without needing to have a monitor attached.  The main limitation is that it doesn't work on machines that lack video hardware (i.e. machine's without video outputs), but those are rare (see below)


1) Configure Display Manager Autostart/Login


On a raspberry pi this step happens automatically, you don't need to do this part. On a normal vanilla x86 debian install you need to make sure you've done two things: a) If you didn't install xfce4 or another lightweight desktop environment during installation,* install lightdm, x11vnc, and xfce4 (i.e. "sudo apt-get install lightdm xfce4 xfce4-goodies x11vnc") and 2) configure lightdm to autologin.  You can configure lightdm to autologin by replacing /etc/lightdm.conf with the following (replacing "your_username_here" with your username)

Code: [Select]
[LightDM]

[Seat:*]
pam-autologin-service=lightdm-autologin
autologin-user=your_username_here
autologin-user-timeout=0

[XDMCPServer]

[VNCServer]

As an aside, I recommend disabling xfce's power management/screensaver options as they're irrelevant in a headless config and can cause mischief.

* I strongly recommend using xfce4 or something lighter like LXDE or openbox for this kind of setup.  The debian default DE (gnome) is great for desktop use but has been broken over VNC for years, and has recently introduced new technology (wayland) that will greatly complicate the task of remote access.  Installing xfce4 via the installer, or using the command above is the easiest way, but other lightweight DEs should work too.

2) Set up x11vnc to automatically start

Use the systemd service I wrote to start x11vnc, see https://yabb.jriver.com/interact/index.php/topic,108981.0.html

Follow the recommended steps in that thread, then the VNC server will automatically start on boot, and restart if it fails.  If you want to test it immediately, run "sudo systemctl start x11vnc".

You can then connect to the VNC server with any VNC client from other computers (tightvnc, tigervnc, etc.).

This method has several advantages and one disadvantage:

Advantages:
1) Relies on the actual physical display adapter so is maximally compatible.  If jriver or another program works on the native display it will work with this method.  At present, some virtual xservers are compatible with JRiver and some are not and there was a big change recently that broke compatibility with several that I was previously using.  Because this method is just relaying what's shown on the physical hardware, it should be compatible indefinitely.  There are rumors that the dummy-xserver may soon be deprecated (upstream, not by JRiver) and increasing wayland adoption will prevent x-forwarding-based methods from working because wayland isn't network transparent (already an issue with clients running fedora and newer gnome builds which run wayland by default).  Wayland would interfere with my method if used on the server side (x11vnc wouldn't work), but will have no effect if used on the client side.

2) Because x11vnc is pulling from the actual display hardware, you see what would be coming out of the HDMI or VGA port if the device were plugged into a monitor.  So if your device is intermittently plugged in you'll only have one desktop to worry about (i.e. if your vnc server fails, you can plug in a monitor and see exactly the same desktop).  Likewise if you just want to be able to remotely administer your HTPC this method will work for that.

3) Because you're using the actual display hardware you get hardware acceleration which makes the jriver interface much more responsive and allows for using theater view or watching video (not an ideal experience, but is useful for testing) or doing other tasks that require graphical hardware acceleration.

Disadvantages:
1) If you're using physical hardware that doesn't have any video outputs or are in a virtualized environment that doesn't provide a virtual graphics adapter (virtualbox and kvm/qemu do, some others don't) this won't work at all, and you'll need to use the dummy-xserver method described above.   Almost all consumer PC hardware has an integrated graphics adapter so this is mostly an issue for dev board type systems on a chip and virtual environments.
Logged

astromo

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2251

Gave the various methods noted above a try but to no avail.

Just for fun I've gave this info a try on an Ubuntu 17.04 installation and !yippee! it worked for me:
https://unlockforus.com/remotely-control-linux-mint-18-x-vnc-server-x11vnc-setup/

Notes:
1. I exchanged "xed" for "nano" as the editor used from the command line
2. "vino" is a virtual terminal application that isn't relevant to Debian (AKAIK)

Unfortunately, I got a dud as far as the armhf (cubox-i) Debian Jessie installation ... the search continues.
Logged
MC33, Win10 x64, HD-Plex H5 Gen2 Case, HD-Plex 400W Hi-Fi DC-ATX / AC-DC PSU, Gigabyte Z370 ULTRA Gaming 2.0 MoBo, Intel Core i7 8700 CPU, 4x8GB GSkill DDR4 RAM, Schiit Modi Multibit DAC, Freya Pre, Nelson Pass Aleph J DIY Clone, Ascension Timberwolf 8893BSRTL Speakers, BJC 5T00UP cables, DVB-T Tuner HDHR5-4DT
Pages: [1]   Go Up