Kodi Community Forum

Full Version: Headless Kodi
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
if you enter/exit/enter tv or movies does it not update?  It should if its using the same shared mysql database as the kodi headless..
Yes , look recent added movies / tvshow , kodi do some "cache" on the main screen ( not request each time)
Great to see some development for headless Kodi. Anyone knows whether Kodi 18 may support this natively?

I am not interested in a docker, but prefer to run Librelec Kodi in a headless VM on Unraid. There is an image available on Unraid forums (https://lime-technology.com/forums/topic...es/?page=4), but this is not updated. Anyone using this and knows whether possible to update?
Is there a patch for kodi 18 yet?
Not yet !

I 'll start watching with beta , because code don't move as much.
Kodi 18 (leila) isn't beta or alpha , it's still in dev.
i don't want to redo the patch every week ^^

A nightly isn't a release Smile

https://github.com/xbmc/xbmc/releases
Alpha 1 is out.  Any luck with a patch?  I'd like to start using this with my Android SHIELD TV since Kodi v17 freezes on me quite often and I was hoping v18 would be more stable.
I have build it , but not test ( I wait libreelec update)

https://github.com/Celedhrim/docker-kodi.../tree/leia
https://hub.docker.com/r/celedhrim/kodi-server/tags/

Have fun testing Smile
(2018-03-06, 09:02)celedhrim Wrote: [ -> ]I have build it , but not test ( I wait libreelec update)

https://github.com/Celedhrim/docker-kodi.../tree/leia
https://hub.docker.com/r/celedhrim/kodi-server/tags/

Have fun testing Smile
 /opt/kodi-server-18.0a1/bin$ ./kodi --headless
Error: /kodi-server-18.0a1/lib/kodi/kodi-x11 not found

I don't have x11 on my Ubuntu server, wonder if that's the reason kodi-x11 didn't get built?  weird that would be required with --headless option though.
xbmc/kodi was never really headless , the patch fake thing to allow starting event is the gui can't open.

But you still need X lib to build.

Your post let me see that the launch command don't work anymore ^^
Quote:CMD ["/opt/kodi-server/lib/kodi/kodi.bin","--headless","--no-test","--nolirc","-p"]
Quote:CMD ["/opt/kodi-server/lib64/kodi/kodi-x11","--headless","--no-test","--nolirc","-p"]
My problem so far is in how you build on Linux to a different directory than default.  I haven't historically used docker and have built myself, but I may need to switch over.

I got past my previous problem by manually updating the "kodi" script in /bin
./kodi --headless
Unable to find path to Kodi data files!

The same applies if I go straight to the binary in /lib/kodi
./kodi-x11 --headless
Unable to find path to Kodi data files!

I think these are not "headless" issues though and are related to other issues when I'm either building or in the source.  I'll keep digging and also try docker.
Hum ok , I launch only in portable mode , but kodi 18 change many things ( compilation chain , etc ^^)
seems harder this time ^^
I got through the userdata issues, but now I'm getting seg faults when running kodi either in normal mode or portable mode with clean files.  I built the same as the Dockerfile from scratch, too.

/opt/kodi-server-18.0a1/bin$ ./kodi --headless --no-test --no-lirc -p
Segmentation fault (core dumped)
Crash report available at /home/bleh/kodi_crashlog-20180306_103237.log

json:

10:35:55.678 T:139764771383296  NOTICE: special://profile/ is mapped to: special://masterprofile/
10:35:55.678 T:139764771383296  NOTICE: -----------------------------------------------------------------------
10:35:55.678 T:139764771383296  NOTICE: Starting Kodi (18.0-ALPHA1 Git:20180304-89a53e4-dirty). Platform: Linux x86 64-bit
10:35:55.678 T:139764771383296  NOTICE: Using Release Kodi x64 build
10:35:55.678 T:139764771383296  NOTICE: Kodi compiled Mar  6 2018 by GCC 5.4.0 for Linux x86 64-bit version 4.4.98 (263266)
10:35:55.678 T:139764771383296  NOTICE: Running on Ubuntu 16.04.4 LTS, kernel: Linux x86 64-bit version 4.4.0-109-generic
10:35:55.678 T:139764771383296  NOTICE: FFmpeg version/source: 3.4.1-Kodi
10:35:55.678 T:139764771383296  NOTICE: Host CPU: Intel® Xeon® CPU E5620 @ 2.40GHz, 16 cores available
10:35:55.678 T:139764771383296  NOTICE: special://xbmc/ is mapped to: /opt/kodi-server-18.0a1/share/kodi/
10:35:55.678 T:139764771383296  NOTICE: special://xbmcbin/ is mapped to: /opt/kodi-server-18.0a1/lib/kodi
10:35:55.678 T:139764771383296  NOTICE: special://xbmcbinaddons/ is mapped to: /opt/kodi-server-18.0a1/lib/kodi/addons
10:35:55.678 T:139764771383296  NOTICE: special://masterprofile/ is mapped to: /opt/kodi-server-18.0a1/share/kodi/portable_data/userdata
10:35:55.678 T:139764771383296  NOTICE: special://envhome/ is mapped to: /home/bleh
10:35:55.678 T:139764771383296  NOTICE: special://home/ is mapped to: /opt/kodi-server-18.0a1/share/kodi/portable_data
10:35:55.678 T:139764771383296  NOTICE: special://temp/ is mapped to: /opt/kodi-server-18.0a1/share/kodi/portable_data/temp
10:35:55.678 T:139764771383296  NOTICE: special://logpath/ is mapped to: /opt/kodi-server-18.0a1/share/kodi/portable_data/temp
10:35:55.678 T:139764771383296  NOTICE: The executable running is: /opt/kodi-server-18.0a1/lib/kodi/kodi-x11
10:35:55.678 T:139764771383296  NOTICE: Local hostname: media
10:35:55.678 T:139764771383296  NOTICE: Log File is located: /opt/kodi-server-18.0a1/share/kodi/portable_data/temp//kodi.log
10:35:55.678 T:139764771383296  NOTICE: -----------------------------------------------------------------------
10:35:56.726 T:139764771383296  NOTICE: load settings...
10:35:56.732 T:139764771383296   DEBUG: CSettings: loaded settings definition from special://xbmc/system/settings/settings.xml
10:35:56.735 T:139764771383296   DEBUG: CSettings: loaded settings definition from special://xbmc/system/settings/linux.xml
10:35:56.736 T:139764771383296   DEBUG: SECTION:LoadDLL(libbluray.so.2)
10:35:56.736 T:139764771383296   DEBUG: Loading: libbluray.so.2
10:35:56.743 T:139764771383296   DEBUG: CSkinSettings: no <skinsettings> tag found
10:35:56.743 T:139764771383296  NOTICE: No settings file to load (special://xbmc/system/advancedsettings.xml)
10:35:56.743 T:139764771383296  NOTICE: No settings file to load (special://masterprofile/advancedsettings.xml)
10:35:56.743 T:139764771383296  NOTICE: Default Video Player: VideoPlayer
10:35:56.743 T:139764771383296  NOTICE: Default Audio Player: paplayer
10:35:56.743 T:139764771383296  NOTICE: Disabled debug logging due to GUI setting. Level 0.
10:35:56.743 T:139764771383296  NOTICE: Log level changed to "LOG_LEVEL_NORMAL"
10:35:56.747 T:139764771383296  NOTICE: Running database version Addons27
10:35:56.753 T:139764771383296  NOTICE: ADDON: xbmc.json v9.1.1 installed
10:35:56.753 T:139764771383296  NOTICE: ADDON: metadata.common.fanart.tv v3.1.5 installed
10:35:56.753 T:139764771383296  NOTICE: ADDON: resource.images.weathericons.default v1.1.8 installed
10:35:56.753 T:139764771383296  NOTICE: ADDON: repository.xbmc.org v3.0.5 installed
10:35:56.753 T:139764771383296  NOTICE: ADDON: webinterface.default v2.4.4 installed
10:35:56.753 T:139764771383296  NOTICE: ADDON: screensaver.xbmc.builtin.black v1.0.32 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.instance.screensaver v2.0.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.instance.videocodec v1.0.1 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.global.main v1.0.12 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: game.controller.default v1.0.5 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.global.gui v5.12.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: screensaver.xbmc.builtin.dim v1.0.39 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: metadata.themoviedb.org v5.1.1 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.global.general v1.0.3 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: service.xbmc.versioncheck v0.3.26 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: xbmc.metadata v2.1.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.instance.audioencoder v2.0.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.instance.peripheral v1.3.7 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.resource v1.0.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: script.module.pil v1.1.7 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: xbmc.gui v5.13.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: xbmc.core v0.1.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: skin.estouchy v2.0.12 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: audioencoder.kodi.builtin.wma v1.0.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: audioencoder.kodi.builtin.aac v1.0.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.instance.vfs v2.0.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.instance.imagedecoder v2.0.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: script.module.pycryptodome v3.4.3 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: metadata.album.universal v2.7.3 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.instance.adsp v0.2.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.instance.game v1.0.36 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.global.audioengine v1.0.1 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: resource.language.en_gb v2.0.1 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.instance.pvr v5.8.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.instance.audiodecoder v2.0.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: metadata.common.allmusic.com v3.1.1 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: metadata.common.musicbrainz.org v2.1.2 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: metadata.tvdb.com v3.0.1 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.global.network v1.0.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: metadata.local v1.0.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: xbmc.webinterface v1.0.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.instance.inputstream v2.0.6 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: resource.uisounds.kodi v1.0.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: metadata.common.themoviedb.org v2.17.6 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.global.filesystem v1.0.2 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: metadata.common.theaudiodb.com v1.9.1 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: metadata.artists.universal v4.1.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: metadata.common.imdb.com v2.9.3 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: xbmc.python v2.25.0 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: kodi.binary.instance.visualization v2.0.1 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: xbmc.addon v17.9.701 installed
10:35:56.754 T:139764771383296  NOTICE: ADDON: skin.estuary v2.0.7 installed
10:35:56.764 T:139764293424896  NOTICE: No Devices found - retry: 4
10:35:58.265 T:139764293424896  NOTICE: No Devices found - retry: 3
10:35:59.765 T:139764293424896  NOTICE: No Devices found - retry: 2
10:36:01.265 T:139764293424896  NOTICE: No Devices found - retry: 1
10:36:02.765 T:139764293424896  NOTICE: Found 0 Lists of Devices
10:36:02.765 T:139764285032192   ERROR: CActiveAESink::OpenSink - no sink was returned
10:36:02.765 T:139764293424896   ERROR: ActiveAE::InitSink - returned error
10:36:02.792 T:139764069189376  NOTICE: Running database version Addons27
10:36:02.792 T:139764069189376  NOTICE: Running database version ViewModes6
10:36:02.793 T:139764069189376  NOTICE: Running database version Textures13
10:36:02.794 T:139764069189376  NOTICE: Running database version MyMusic70
10:36:02.796 T:139764069189376  NOTICE: Running database version MyVideos109
10:36:02.797 T:139764069189376  NOTICE: Running database version TV32
10:36:02.797 T:139764069189376  NOTICE: Running database version Epg11

Docker is still building to go that route...
appens with docker too.  ran in debug mode:

(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /opt/kodi-server-18.0a1/lib/kodi/kodi-x11 --headless -p
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffdc456700 (LWP 3270)]
[New Thread 0x7fffdb7c3700 (LWP 3271)]
[New Thread 0x7fffdafc2700 (LWP 3272)]
[New Thread 0x7fffda2e6700 (LWP 3274)]

Thread 1 "kodi-x11" received signal SIGSEGV, Segmentation fault.
0x0000000000ac7094 in CRenderSystemGL::EnableShader(ESHADERMETHOD) ()



(gdb) bt
#0  0x0000000000ac7094 in CRenderSystemGL::EnableShader(ESHADERMETHOD) ()
#1  0x000000000104caba in CGUITextureGL::Begin(unsigned int) ()
#2  0x000000000100568f in CGUITextureBase::Render() ()
#3  0x0000000000e8b669 in CRenderSystemBase::ShowSplash(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#4  0x000000000125aee7 in CApplication::Initialize() ()
#5  0x0000000000ec3312 in XBMC_Run ()
#6  0x000000000087ad82 in main ()
I was able to get past the Seg Fault issues by adding more IsHeadless() checks within Application.cpp anytime the ShowSplash method was called or on CApplication::Render()

I'm getting a ton of Audio errors now that I'll try and get through.

12:48:43.092 T:140736875738880   ERROR: ActiveAE::InitSink - returned error
12:48:43.593 T:140736867346176    INFO: CActiveAESink::OpenSink - initialize sink
12:48:43.593 T:140736867346176   DEBUG: CActiveAESink::OpenSink - trying to open device Default
12:48:43.593 T:140736867346176   ERROR: CActiveAESink::OpenSink - no sink was returned

They keep appearing every second
I got it running stable:

xml:

diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index 8fe1ed5..dc2b59c 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -258,6 +258,7 @@ CApplication::CApplication(void)
   , m_lastRenderTime(0)
   , m_skipGuiRender(false)
   , m_bStandalone(false)
+  , m_headless(false)
   , m_bEnableLegacyRes(false)
   , m_bTestMode(false)
   , m_bSystemScreenSaverEnable(false)
@@ -605,7 +606,7 @@ bool CApplication::Create(const CAppParamParser &params)
     return false;
   }
   // start the AudioEngine
-  if(!m_ServiceManager->StartAudioEngine())
+  if(!IsHeadless() && !m_ServiceManager->StartAudioEngine())
   {
     CLog::Log(LOGFATAL, "CApplication::Create: Failed to start the AudioEngine");
     return false;
@@ -707,7 +708,8 @@ bool CApplication::CreateGUI()
   if (sav_res)
     CDisplaySettings::GetInstance().SetCurrentResolution(RES_DESKTOP, true);

-  CServiceBroker::GetRenderSystem().ShowSplash("");
+  if (!IsHeadless())
+    CServiceBroker::GetRenderSystem().ShowSplash("");

   // The key mappings may already have been loaded by a peripheral
   CLog::Log(LOGINFO, "load keymapping");
@@ -1054,7 +1056,7 @@ bool CApplication::Initialize()
   int iDots = 1;
   while (!event.WaitMSec(1000))
   {
-    if (databaseManager.IsUpgrading())
+    if (databaseManager.IsUpgrading() && !IsHeadless())
       CServiceBroker::GetRenderSystem().ShowSplash(std:Confusedtring(iDots, ' ') + localizedStr + std:Confusedtring(iDots, '.'));

     if (iDots == 3)
@@ -1062,7 +1064,8 @@ bool CApplication::Initialize()
     else
       ++iDots;
   }
-  CServiceBroker::GetRenderSystem().ShowSplash("");
+  if (!IsHeadless())
+    CServiceBroker::GetRenderSystem().ShowSplash("");

   StartServices();

@@ -1090,14 +1093,15 @@ bool CApplication::Initialize()
     iDots = 1;
     while (!event.WaitMSec(1000))
     {
-      if (isMigratingAddons)
+      if (isMigratingAddons && !IsHeadless())
         CServiceBroker::GetRenderSystem().ShowSplash(std:Confusedtring(iDots, ' ') + localizedStr + std:Confusedtring(iDots, '.'));
       if (iDots == 3)
         iDots = 1;
       else
         ++iDots;
     }
-    CServiceBroker::GetRenderSystem().ShowSplash("");
+    if (!IsHeadless())
+      CServiceBroker::GetRenderSystem().ShowSplash("");
     m_incompatibleAddons = incompatibleAddons;
     m_confirmSkinChange = true;

@@ -1823,7 +1827,7 @@ bool CApplication::LoadCustomWindows()
 void CApplication::Render()
 {
   // do not render if we are stopped or in background
-  if (m_bStop)
+  if (m_bStop || IsHeadless())
     return;

   bool hasRendered = false;
@@ -2713,11 +2717,13 @@ bool CApplication::Cleanup()

     m_globalScreensaverInhibitor.Release();
     m_screensaverInhibitor.Release();
-
-    CServiceBroker::GetRenderSystem().DestroyRenderSystem();
-    CServiceBroker::GetWinSystem().DestroyWindow();
-    CServiceBroker::GetWinSystem().DestroyWindowSystem();
-    g_windowManager.DestroyWindows();
+
+    if (!IsHeadless()) {
+      CServiceBroker::GetRenderSystem().DestroyRenderSystem();
+      CServiceBroker::GetWinSystem().DestroyWindow();
+      CServiceBroker::GetWinSystem().DestroyWindowSystem();
+      g_windowManager.DestroyWindows();
+    }

     CLog::Log(LOGNOTICE, "unload sections");

@@ -4004,10 +4010,13 @@ bool CApplication::OnMessage(CGUIMessage& message)

       if (!m_appPlayer.IsPlayingVideo())
       {
-        if(g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO ||
-           g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_GAME)
+        if (!IsHeadless())
         {
-          g_windowManager.PreviousWindow();
+          if(g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO ||
+             g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_GAME)
+          {
+            g_windowManager.PreviousWindow();
+          }
         }
         else
         {
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32