INTERACT FORUM

Please login or register.

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

Author Topic: QuickStart Guide Raspberry Headless question  (Read 4657 times)

akira54

  • Galactic Citizen
  • ****
  • Posts: 302
QuickStart Guide Raspberry Headless question
« on: July 09, 2017, 04:08:17 am »

Hi,

Thanks to the excellent quickstart guide I was able to get MC22 running on my PI 3. I would now like to run it headless and noticed that despite telling MC22 in the options to autostart. It does not do so. The QuickStart guide has a set of instructions on how to run MC without a monitor, but since I already have VNC running automatically and can access the PI from my Mac, I am loath to follow mwillems's instructions mechanically since they appear to be partly redundant now. But since I am a linux newby I do not know what I still must do to start MC automatically. Can anyone shed some light on this?
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5162
  • "Linux Merit Badge" Recipient
Re: QuickStart Guide Raspberry Headless question
« Reply #1 on: July 09, 2017, 11:24:17 am »

Try using the systemd service here: https://yabb.jriver.com/interact/index.php/topic,108981.0.html

There's no GUI way to autostart MC properly to my knowledge.
Logged

akira54

  • Galactic Citizen
  • ****
  • Posts: 302
Re: QuickStart Guide Raspberry Headless question
« Reply #2 on: July 09, 2017, 03:50:24 pm »

Thanks for the link, I will give it a shot.

You write: "Some technical notes: this presumes you're running on your actual display, not a virtual display generated by a VNC client."  I do not quite understand. If I am running MC headless can I use the script as is? Why is the script affected by the display being used (especially when there is none)?
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: QuickStart Guide Raspberry Headless question
« Reply #3 on: July 09, 2017, 04:00:46 pm »

I'm using the method described in the guide:  Shell script that starts on boot (via cron) that runs x11vnc, and then mediacenter .  It works just fine as far as I can tell.

What's the motivation for the systemd service?  Other than it being slick and cool and fun.  :)

Brian.
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5162
  • "Linux Merit Badge" Recipient
Re: QuickStart Guide Raspberry Headless question
« Reply #4 on: July 09, 2017, 06:23:51 pm »

Thanks for the link, I will give it a shot.

You write: "Some technical notes: this presumes you're running on your actual display, not a virtual display generated by a VNC client."  I do not quite understand. If I am running MC headless can I use the script as is? Why is the script affected by the display being used (especially when there is none)?

The unit exports a DISPLAY as an environment variable.  The actual, physical, display is typically DISPLAY=:0 (except on the Gnome desktop), and if you use x11vnc, which just mirrors the actual display, DISPLAY=:0 is the correct environment variable to export.  Many VNC solutions, instead of sharing the default output, generate a virtual display on DISPLAY=:1, which obviously will not work if you tell MC to display on DISPLAY=:0.  Many of the virtual display solutions no longer work correctly with MC by the way, which is why I made the switch to x11vnc from tightvnc in the guide.

Headlessness, per se, has nothing to do with it.  For example, I run x11vnc on many headless systems, but x11vnc nonetheless mirrors what would be displayed on the actual hardware output if you plugged it in (which is useful if you ever need to plug it in).  TigerVNC or TightVNC typically generate a virtual display entirely disconnected from the physical hardware so if you plugged in a display cable, you wouldn't see the desktops created by those VNC solutions. 

In any case, the "fix" is to connect to your pi via VNC, and then open a graphical terminal in the desktop enviroment.  Then enter on the command line: echo $DISPLAY  That will tell you what you need to put in the service file environment variables.
 

I'm using the method described in the guide:  Shell script that starts on boot (via cron) that runs x11vnc, and then mediacenter .  It works just fine as far as I can tell.

What's the motivation for the systemd service?  Other than it being slick and cool and fun.  :)

Brian.

It grew out of efforts to script deployment of MC automatically to virtual machines as well as raspberry pi's.

The systemd service will wait until the desktop environment is up so there are no false starts (not usually an issue on the pi, but I've hit issues on faster hardware), and the systemd service can autorestart MC if it crashes without having to run once a minute (systemd monitors processes on an ongoing basis with low overhead).  Those are minor, but more meaningful is that the service allows MC time to shut down properly before a reboot or a poweroff, which the cron script does not do.  The systemd service also provides more diagnostic information if something goes wrong (again because systemd logs unit failures more robustly than cron does).  I could in theory script some of those advantages, but systemd does it automagically and is almost universally present.  Not all modern linux systems even ship with cron pre-installed anymore (Arch for example), or ship with cron implementations that are flaky with the @reboot time designation, but systemd is almost universal and works the same everywhere. 

Nothing wrong with the cron script if it works, I used for quite a while and obviously recommended it for years.  I just found the systemd units more elegant and easier to deploy, so I'll be switching the next version of the quick start guide over to the systemd units (with the cron offered as an alternative).
Logged

akira54

  • Galactic Citizen
  • ****
  • Posts: 302
Re: QuickStart Guide Raspberry Headless question
« Reply #5 on: July 11, 2017, 02:11:35 pm »

Thank you very much fir this very full answer. After downgrading MC22 (I too had lots of random crashes) I followed your setup instructions mentioned here https://yabb.jriver.com/interact/index.php/topic,108981.0.html but am still a little uncertain about two points. I am running RPI headless, and you state: "If you are using such a virtual display, substitute the display variable in the Environment section, and change the "After" line to refer to the name of the systemd service you're using to start your vnc server, but note that VNC virtual displays may not work correctly anymore with MC since 22.0.36."
I do not know what you mean by "substitute the display variable in the Environment section" and should I change the "after" line to read: "After=x11vnc.service" in my setup? In both jriver.service and x11vnc.service?

Also, can I now disable the built-in VNC service and still use VNC Viewer on my Mac to access the RPI?
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: QuickStart Guide Raspberry Headless question
« Reply #6 on: July 11, 2017, 04:44:30 pm »

mwillems:  Thanks for the explanation. ...and all of your work developing the guides and the methods used in them.  I'm a Linux guy from way back.  My current day job is mostly working on Linux.  But I still followed your guides; without them I'm not sure I would have bothered with a Pi setup.  But I'm glad I did.  :)

Brian.
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5162
  • "Linux Merit Badge" Recipient
Re: QuickStart Guide Raspberry Headless question
« Reply #7 on: July 11, 2017, 05:25:16 pm »

Thank you very much fir this very full answer. After downgrading MC22 (I too had lots of random crashes) I followed your setup instructions mentioned here https://yabb.jriver.com/interact/index.php/topic,108981.0.html but am still a little uncertain about two points. I am running RPI headless, and you state: "If you are using such a virtual display, substitute the display variable in the Environment section, and change the "After" line to refer to the name of the systemd service you're using to start your vnc server, but note that VNC virtual displays may not work correctly anymore with MC since 22.0.36."
I do not know what you mean by "substitute the display variable in the Environment section" and should I change the "after" line to read: "After=x11vnc.service" in my setup? In both jriver.service and x11vnc.service?

Also, can I now disable the built-in VNC service and still use VNC Viewer on my Mac to access the RPI?

If you followed my instructions exactly, you shouldn't need to modify the first service at all except to add your user name (probably "pi").  Likewise, if you're using my method, you shouldn't need to modify the second service at all except to add your username twice.

I can't say how it will interact with the built in vnc service as I've never used it.  I'm going to try and update the overall quick start guide for mc23 this weekend (assuming a non-beta arm build gets put up) to incorporate the services if you need more detailed instructions.

mwillems:  Thanks for the explanation. ...and all of your work developing the guides and the methods used in them.  I'm a Linux guy from way back.  My current day job is mostly working on Linux.  But I still followed your guides; without them I'm not sure I would have bothered with a Pi setup.  But I'm glad I did.  :)

Brian.

Thanks Brian!  I'm comparatively new to Linux proper (about 4-5 years), but I've been really excited about raspberry pi's and their potential.  I remember, as a kid, trying to write BASIC on an old Tandy Model 3, and if someone had told me then that in 30 years I could buy a computer that was smaller than an Atari cartridge for less money than an Atari cartridge, that was more powerful than any computer I'd ever used, I'd have called them a liar.  The first time I got to see a Raspberry Pi, it really brought some of the sense of wonder back into the PC hobby for me, so I'm glad that the guides are helpful to others in getting into them.  Stay tuned for an MC 23 update to the guide  ;D
Logged

akira54

  • Galactic Citizen
  • ****
  • Posts: 302
Re: QuickStart Guide Raspberry Headless question
« Reply #8 on: July 12, 2017, 12:28:25 am »

I did follow your instructions to the letter, but was just a little confused by the proviso you added. I took your remark that you have never used the built-in server to mean that it can be switched off, but what program do I need on my Mac to set up a VNC connection with the RPI. VNC Viewer which I used before now refuses to connect.

I have noticed two further problems. Would you like me to start separate threads on them?
1. When playing HD material (SACD iso) the PI stutters, i.e. every 20 seconds or so (pretty regular) it stops playing for circa 4 seconds and then continues again. NB. With 44.1 24 bit flacs playback is smooth.

2. Using JRemote makes MC crash before all the artwork for the various folders is even properly loaded. NB. After the automatic restart of MC22 the artwork is replaced by "blanks" and JRemote no longer crashes.
Logged

mwillems

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5162
  • "Linux Merit Badge" Recipient
Re: QuickStart Guide Raspberry Headless question
« Reply #9 on: July 12, 2017, 05:59:58 pm »

I did follow your instructions to the letter, but was just a little confused by the proviso you added. I took your remark that you have never used the built-in server to mean that it can be switched off, but what program do I need on my Mac to set up a VNC connection with the RPI. VNC Viewer which I used before now refuses to connect.

Try tigervnc or tightvnc; if they don't work something is misconfigured.

Quote
I have noticed two further problems. Would you like me to start separate threads on them?
1. When playing HD material (SACD iso) the PI stutters, i.e. every 20 seconds or so (pretty regular) it stops playing for circa 4 seconds and then continues again. NB. With 44.1 24 bit flacs playback is smooth.

You should open a thread on this, or have a look at the two other threads currently running about DSD on the pi/linux.

Quote
2. Using JRemote makes MC crash before all the artwork for the various folders is even properly loaded. NB. After the automatic restart of MC22 the artwork is replaced by "blanks" and JRemote no longer crashes.

You should set the thumbnailing priority to low, and then pre-build all the thumbnails using the "build thumbnails" option.  If you have a lot of files, it will take a while, but the behavior you're describing is caused by MC exhausting the very limited RAM on the pi due to aggressive thumbnailing (which is why it crashes before all h=the art finishes appearing.  Once the thumbs are generated stability dramatically improves.
Logged
Pages: [1]   Go Up