• 1
  • 2(current)
  • 3
  • 4
  • 5
  • 7
Linux HOW TO: Minimal Ubuntu 16.04 with Kodi, Steam & EmulationStation
#16
(2016-08-08, 17:13)DJBenson Wrote: Thanks for the guide, I've followed it and have everything working but on the occasions that Kodi crashes, how does one automatically restart Kodi?

From what I can gather, Kodi is running within LightDM/Openbox so the only way to get Kodi back up is to restart LightDM - but that's beyond the capabilities of my wife if I'm not at home.

When I used a systemd service for Kodi, it would automatically restart on crash, but now I've moved to the LightDM/Openbox method of launching Kodi, I have no idea how to automatically respawn Kodi (or relaunch LightDM) if/when Kodi crashes.

For me when Kodi crashes it just takes me back to the login screen, and if I log back in with the kodi user (no password, so I just hit Enter on my keyboard) it launches back into a Kodi/Openbox session (since that was the last used session)

I decided to use ppa:team-xbmc/unstable for the Kodi install, so I can say this works pretty reliably after every crash lol



Oh yeah, I forgot I had to delete the password on the Kodi user manually before it would let me log back in

Code:
sudo passwd [USER] -d
Reply
#17
(2016-08-08, 17:52)defaultdotxbe Wrote:
(2016-08-08, 17:13)DJBenson Wrote: Thanks for the guide, I've followed it and have everything working but on the occasions that Kodi crashes, how does one automatically restart Kodi?

From what I can gather, Kodi is running within LightDM/Openbox so the only way to get Kodi back up is to restart LightDM - but that's beyond the capabilities of my wife if I'm not at home.

When I used a systemd service for Kodi, it would automatically restart on crash, but now I've moved to the LightDM/Openbox method of launching Kodi, I have no idea how to automatically respawn Kodi (or relaunch LightDM) if/when Kodi crashes.

For me when Kodi crashes it just takes me back to the login screen, and if I log back in with the kodi user (no password, so I just hit Enter on my keyboard) it launches back into a Kodi/Openbox session (since that was the last used session) - see my edited post on the previous page.

I decided to use ppa:team-xbmc/unstable for the Kodi install, so I can say this works pretty reliably after every crash lol

That's OK if you have a keyboard attached but my setup is purely remote driven.

Thanks though, wasn't aware it would just log back in on pressing enter.

I've actually worked out a solution (see previous page) for myself that utilises the best of both worlds; kodi-openbox and systemd - my method automatically restarts kodi if/when it crashes.
Reply
#18
(2016-08-07, 23:09)solbero Wrote:
(2016-08-05, 19:17)geckow Wrote: Thank you very much for your tutorial, everything works well (just had some crashes with latest Kodi build) ! I am just wondering why do you use Minimal Xubuntu desktop, isn't Lubuntu minimal installation lighter ? (it also already includes openbox)

After some tests, it seems to work a bit better with Lubuntu (less ressources consumption), I'll report my experiences when I will have time !

I’m glad that you enjoyed the guide.

I considered using Lubuntu Minimal Desktop. However, my reasons for choosing Xubuntu Minimal Desktop are:
  • Xubuntu includes PulseAudio. Needed by quite a lot of Steam games. However some (such as Hyper Light Drifter) work with ALSA.
  • Xubuntu includes Bluez for Bluetooth. I need it to pair PS3 controllers.
  • Xubuntu includes NetworkManager. I use NetworkManager to manage my VPN.
Also, I’m more familiar configuring stuff in Xubuntu, and XFCE comes with some nice default apps. Even though this guide consists of terminal commands, I worked from the Xubuntu desktop a lot while figuring stuff out. So I wanted something I’m familiar with, and I do not have a lot of experience with LXDE.

For a setup like this, where you boot directly into Kodi, the desktop environment that is installed doesn’t really matter—you never boot in to it, you boot into Openbox instead. However, the other choices in the MinimalCD installation such as Unity or Gnome would bundle a bunch of processes that would begin at startup and slow everything down (notice that they do not have a minimal version). That‘s why you‘d want the minimal desktops. They are just the minimal needed.

As such, Lubuntu Minimal Desktop is as a good a choice as Xubuntu Minimal Desktop. In Lubuntu, you wouldn’t have to install Openbox as you point out, but you might have to install some other programs which are included in Xubuntu Minimal Desktop. Both work for this kind of setup, so choose the one you like. Big Grin

TL;DR: Both Xubuntu Minimal Desktop and Lubuntu Minimal Deskop work for this kind of setup.

You're right, I didn't know for PulseAudio !
On top of that, performances are quite similar, I installed both on virtual machines :

Xubuntu Minimal:
67 seconds boot
165MB-171MB RAM consumption
2705MB (Kodi displays 2,7G) disk space used
Kodi 16.1 Git:c327c53 Apr 25 2016

Lubuntu Minimal:
54 seconds boot
126MB-136MB RAM consumption
2563MB (Kodi displays 2,7G) disk space used
Kodi 16.1 Git:c327c53 Apr 25 2016

(2016-08-08, 17:13)DJBenson Wrote: Thanks for the guide, I've followed it and have everything working but on the occasions that Kodi crashes, how does one automatically restart Kodi?

From what I can gather, Kodi is running within LightDM/Openbox so the only way to get Kodi back up is to restart LightDM - but that's beyond the capabilities of my wife if I'm not at home.

When I used a systemd service for Kodi, it would automatically restart on crash, but now I've moved to the LightDM/Openbox method of launching Kodi, I have no idea how to automatically respawn Kodi (or relaunch LightDM) if/when Kodi crashes.

EDIT: I actually managed to work this out myself using a mixture of the kodi-openbox-session binary and the kodi.system systemd script.

If you want Kodi to automatically restart on crash, you will need to;

Code:
Remove (or comment out) the following from /etc/lightdm/lightdm.conf

[Seat:*]
autologin-user=[USER]
autologin-session=kodi-openbox

Disable the lightdm service
Code:
sudo systemctl disable lightdm

Create a new systemd file for kodi
Code:
sudo nano /etc/systemd/system/kodi.system

and enter the following code;
Code:
[Unit]
Description = Kodi Media Center

# if you don't need the MySQL DB backend, this should be sufficient
# After = systemd-user-sessions.service network.target sound.target

# if you need the MySQL DB backend, use this block instead of the previous
After = systemd-user-sessions.service network.target sound.target mysql.service # Remove mysql.service if you are not using the mysql backend for kodi or kodi and mysql are installed on different machines
Wants = mysql.service # Remove this line if you are not using the mysql backend for kodi or kodi and mysql are installed on different machines

[Service]
User = kodi2 # Use your kodi user here
Group = kodi2 # Use your kodi user here
Type = simple
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/bin/kodi-openbox-session -- :0 -nolisten tcp vt7
Restart = always # You may need to tweak this option, see https://www.freedesktop.org/software/systemd/man/systemd.service.html for the list of restart options. 'always' pretty much means you cannot exit kodi (gracefully or otherwise) without it restarting. This works for me but my kodi box is dedicated to kodi so I have no need to access X any other way.
RestartSec = 5

[Install]
WantedBy = multi-user.target

Be sure to check the inline comments in the service file above as some options are optional depending upon your setup (i.e. the mysql.service is only relevant IF you are using mysql for kodi AND both kodi and mysql are installed on the same physical machine)

Enable the new kodi service
Code:
sudo systemctl enable kodi.service

Reboot.

Now Kodi will launch (using openbox) via systemd and will relaunch if it crashes.

I have found a much simpler way to do that with a built-in kodi-openbox feature, just add the following at the end of ~/.kodi-openbox/onfinish and ~/.kodi-openbox/onkill
Code:
/usr/bin/kodi-openbox-session
Reply
#19
Thank you all for your kind words. I never thought this HOW TO would get any response, as I thought the setup to be too specialized for my usage case.

So on to other things. For autostarting or restarting scripts/programs, there are some different possibilities with this setup.


For programs that require to be run as root (such as xboxdrv and sixad) use /etc/rc.local. You can edit it as ADMIN.
Code:
sudo nano /etc/rc.local
Place your code before “exit 0”.


For programs that should be run as USER and apply to all programs run in the Openbox session use ~/.config/openbox/autostart. You must edit this file as USER.
Code:
nano ~/.config/openbox/autostart

You might have to copy the files to ~/.config/openbox/ if you haven’t already done so earlier.
Code:
cp -R /etc/xdg/openbox ~/.config/


For programs that should be run when Kodi starts, stops or is killed use the files in ~/.kodi-openbox/. You must edit these files as USER.

Put some code here to run when a kodi-openbox session successfully starts
Code:
~/.kodi-openbox/onstart

Put some code here to run when a kodi-openbox session ends
Code:
~/.kodi-openbox/onfinish

Put some code here to run when a kodi-openbox session is sent a SIGINT or SIGQUIT
Code:
~/.kodi-openbox/onkill

It is also possible to use SystemD as DJBenson suggested.
Reply
#20
(2016-08-08, 17:47)defaultdotxbe Wrote: Thanks for the guide, I've always used KodiBuntu before, but I like this better. Cool

Now I just need to figure out es_systems.cfg lol

I used this es_systems.cfg as a basis for my config. Try to modify this, but read the documentation I linked to in my first post, so you know what the different XHTML-tags do.
Reply
#21
I saw the EmulationStation documentation, but didn't notice the additional ES+RetroArch guide you linked. Figuring out the appropriate commands for the <command> tag was what was giving me troubles. Thanks again
Reply
#22
Made an account to just say great write up and thanks. I have been testing a similar configuration that includes a mythtv backend for OTA broadcasting and PVR functionality. Was too impatient to for the kodibuntu ISO to be updated from 14.04 and helix. A working emulator setup is the only thing I was missing. Now I have the whole package. I went the route of geckow and used lubuntu instead and just added additional packages (pulseaudio, nvidia drivers, etc.) as needed.

One question. Any way to prevent the monitor from turning off while running emulationstation? Everything works fine but after about 20 minutes or so of game play the monitor seems to go into power save mode and turns off. A tap of the keyboard turns it back on but when this setup gets moved to 10 foot interface thats a no go. Is this more of a setting in retroarch to prevent the monitor from turning off?

Thanks again.
Reply
#23
(2016-08-09, 22:20)helodog76 Wrote: One question. Any way to prevent the monitor from turning off while running emulationstation? Everything works fine but after about 20 minutes or so of game play the monitor seems to go into power save mode and turns off. A tap of the keyboard turns it back on but when this setup gets moved to 10 foot interface thats a no go. Is this more of a setting in retroarch to prevent the monitor from turning off?

Thanks again.

Go into Lubuntu’s power manager and set screen blanking and shutdown to never.
Reply
#24
In case anyone else runs into the screen blanking/monitor powersaving issue I finally found a solution. After disabling the screensaver and power settings with no difference I eventually uninstalled xscreensaver altogether and still experienced the issue. While digging around I came across the link below which seems to have resolved the problem.

http://askubuntu.com/questions/291135/ho...ter-10-min

Not sure if this has to do with the proprietary Nvidia drivers but adding the line

xset s off && xset -dpms

to the end of the file .profile (located at /home/{yourusernamehere}/.profile) After adding that line the monitor no longer goes into power save mode. Now my all in one Kodi-Emulator-MythTV setup is complete.

Thanks again to solbero for this solid write up.
Reply
#25
Can I do this with Ubuntu server? I want do dual boot with windows 10 in uefi.

This is what it says in the web:

mini system in UEFI mode

While the minimal iso image is handy, it isn't useful for installing on UEFI-based systems that you want to run in UEFI mode. The mini iso lacks the proper files for booting the computer in UEFI mode. Thus, the computer will boot in BIOS compatibility mode, and the installation will be in BIOS mode.

You can use an Ubuntu Server amd64 iso file (64-bit) for 'mini installations' in UEFI mode. There is a compressed image file dd_text_16.04-UEFI-n-BIOS-4-pendrive-7.8GB.img.xz of such an installed system, that can be used as a start of a custom installation.
Reply
#26
(2016-08-18, 20:57)Hammurabi Wrote: Can I do this with Ubuntu server? I want do dual boot with windows 10 in uefi.

This is what it says in the web:

mini system in UEFI mode

While the minimal iso image is handy, it isn't useful for installing on UEFI-based systems that you want to run in UEFI mode. The mini iso lacks the proper files for booting the computer in UEFI mode. Thus, the computer will boot in BIOS compatibility mode, and the installation will be in BIOS mode.

You can use an Ubuntu Server amd64 iso file (64-bit) for 'mini installations' in UEFI mode. There is a compressed image file dd_text_16.04-UEFI-n-BIOS-4-pendrive-7.8GB.img.xz of such an installed system, that can be used as a start of a custom installation.

You could do this with Ubuntu Server, and install the xubuntu-core or lubuntu-core meta package. However, there might be a lot of other packages you would need to install to satisfy all dependencies and make everything work.

Or, by doing a web search, I found this tutorial which shows how to make the MinimalCD boot in UEFI.

However, I am genuinely curious as to why you want to dual boot Windows 10 and such a specialized install as the one described in this thread. What are you trying to accomplish? Care to share?
Reply
#27
(2016-08-18, 22:38)solbero Wrote: Or, by doing a web search, I found this tutorial which shows how to make the MinimalCD boot in UEFI.

Thank you, I installed the OS in UEFI with that method. But I'm having constant buffering in acestream, in windows its ok. I installed Kodi 17 nightly build because of EGL. Check this thread 231955 (thread) , u think that all this things
PHP Code:
sudo apt-get update
sudo apt
-get install ssh python-software-properties software-properties-common xorg xserver-xorg-legacy alsa-utils mesa-utils git-core librtmp1 lirc libmad0 lm-sensors libmpeg2-4 avahi-daemon libnfs8 libva1 vainfo i965-va-driver linux-firmware dbus-x11 udisks2 openbox pastebinit
sudo apt
-get dist-upgrade 
are necessary for better performance? I have a celeron J1900.


(2016-08-18, 22:38)solbero Wrote: However, I am genuinely curious as to why you want to dual boot Windows 10 and such a specialized install as the one described in this thread. What are you trying to accomplish? Care to share?
haha, it's nothing really, I want to try kodi in linux but i need windows because when my niece come to my house he likes to play a disney game that's windows only.
Reply
#28
Thank you very much for your HOW-TO! This was exactly what i was looking for!
Reply
#29
I followed this guide, and so far everything looks good, except I am having audio problems in Kodi. Before, I was running 14.04 with just x server and Kodi, and using Alsa sound. I wiped my HTPC and followed the instructions here. PulseAudio didn't work at all. I uninstalled it and switched to Alsa, but Alsa works randomly for a half-second every 10 seconds or so. I have reinstalled Pulse, but don't know what to do from here. Does anyone know of a good guide for setting up Pulse? All of the documentation I've found is cryptic.
Reply
#30
(2016-08-22, 22:09)MrTarantula Wrote: I followed this guide, and so far everything looks good, except I am having audio problems in Kodi. Before, I was running 14.04 with just x server and Kodi, and using Alsa sound. I wiped my HTPC and followed the instructions here. PulseAudio didn't work at all. I uninstalled it and switched to Alsa, but Alsa works randomly for a half-second every 10 seconds or so. I have reinstalled Pulse, but don't know what to do from here. Does anyone know of a good guide for setting up Pulse? All of the documentation I've found is cryptic.

Could you describe your audio setup?
Reply
  • 1
  • 2(current)
  • 3
  • 4
  • 5
  • 7

Logout Mark Read Team Forum Stats Members Help
HOW TO: Minimal Ubuntu 16.04 with Kodi, Steam & EmulationStation4