I made a dirty hack, adding sleep command into /DietPi/dietpi/misc/start_kodi
#/////////////////////////////////////////////////////////////////////////////////////
# Main Loop
#/////////////////////////////////////////////////////////////////////////////////////
#-----------------------------------------------------------------------------------
#Raspberry Pi
if (( $G_HW_MODEL < 10 )); then
sleep 2m
kodi-standalone
#Everything else
Ok, so I added the code and it works. But kodi is having problems starting up, I keep getting error messages when kodi tries to start.
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid
Aborted
Cras report available at /kodi_crashlog-20180213_003222.log
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid
Aborted
Cras report available at /kodi_crashlog-20180213_003223.log
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid
Aborted
Cras report available at /kodi_crashlog-20180213_003225.log
/usb/bin/kodi --standalone has exited in an unclean state 3 times in the last 6 seconds.
Something is probably wrong
And the crash logs only contain
root@Mars:/# cat kodi_crashlog-20180213_00322*
############## Kodi CRASH LOG ###############
################ SYSTEM INFO ################
Date: Tue 13 Feb 00:32:22 EET 2018
Kodi Options:
Arch: armv7l
Kernel: Linux 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017
Release: Raspbian GNU/Linux 9 (stretch)
############## END SYSTEM INFO ##############
############### STACK TRACE #################
gdb not installed, can't get stack trace.
############# END STACK TRACE ###############
################# LOG FILE ##################
Logfile not found in the usual place.
Please attach it separately.
Use pastebin.com or similar for forums or IRC.
############### END LOG FILE ################
############ END Kodi CRASH LOG #############
############## Kodi CRASH LOG ###############
################ SYSTEM INFO ################
Date: Tue 13 Feb 00:32:23 EET 2018
Kodi Options:
Arch: armv7l
Kernel: Linux 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017
Release: Raspbian GNU/Linux 9 (stretch)
############## END SYSTEM INFO ##############
############### STACK TRACE #################
gdb not installed, can't get stack trace.
############# END STACK TRACE ###############
################# LOG FILE ##################
Logfile not found in the usual place.
Please attach it separately.
Use pastebin.com or similar for forums or IRC.
############### END LOG FILE ################
############ END Kodi CRASH LOG #############
############## Kodi CRASH LOG ###############
################ SYSTEM INFO ################
Date: Tue 13 Feb 00:32:25 EET 2018
Kodi Options:
Arch: armv7l
Kernel: Linux 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017
Release: Raspbian GNU/Linux 9 (stretch)
############## END SYSTEM INFO ##############
############### STACK TRACE #################
gdb not installed, can't get stack trace.
############# END STACK TRACE ###############
################# LOG FILE ##################
Logfile not found in the usual place.
Please attach it separately.
Use pastebin.com or similar for forums or IRC.
############### END LOG FILE ################
############ END Kodi CRASH LOG #############
root@Mars:/#
Edit:
Installed gdb to get something out of the crashlog, got this.
root@Mars:~# cat /kodi_crashlog-20180213_104756.log
############## Kodi CRASH LOG ###############
################ SYSTEM INFO ################
Date: Tue 13 Feb 10:47:56 EET 2018
Kodi Options:
Arch: armv7l
Kernel: Linux 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017
Release: Raspbian GNU/Linux 9 (stretch)
############## END SYSTEM INFO ##############
############### STACK TRACE #################
=====> Core file: /core (2018-02-13 10:47:56.591485956 +0200)
=========================================
[New LWP 3416]
[New LWP 3417]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Core was generated by `/usr/lib/arm-linux-gnueabihf/kodi/kodi_v7.bin --lircdev /var/run/lirc/lircd'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
[Current thread is 1 (Thread 0x71ed8000 (LWP 3416))]
Thread 2 (Thread 0x71ed7300 (LWP 3417)):
#0 0x76f3a94c in __pthread_cond_wait (cond=0x2cddf30, mutex=0x2cddf68) at pthread_cond_wait.c:186
#1 0x009f1488 in ANNOUNCEMENT::CAnnouncementManager::Process() ()
#2 0x0069f674 in CThread::Action() ()
#3 0x0069feb0 in CThread::staticThread(void*) ()
#4 0x76f33fc4 in start_thread (arg=0x71ed7300) at pthread_create.c:335
#5 0x753e3c68 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:76 from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
Thread 1 (Thread 0x71ed8000 (LWP 3416)):
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x7533f824 in __GI_abort () at abort.c:89
#2 0x754f3060 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#3 0x754f0db0 in ?? () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#4 0x754f0e24 in std::terminate() () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#5 0x754f1158 in __cxa_throw () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#6 0x755194d4 in std::__throw_logic_error(char const*) () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#7 0x007ea6cc in ?? ()
#8 0x007ecddc in CApplication::Create() ()
#9 0x006b7988 in XBMC_Run ()
#10 0x003d37ac in main ()
############# END STACK TRACE ###############
################# LOG FILE ##################
Logfile not found in the usual place.
Please attach it separately.
Use pastebin.com or similar for forums or IRC.
############### END LOG FILE ################
############ END Kodi CRASH LOG #############
Confirmed with Kodi, I tried a few methods with no success, doesnt seem to like being launched under bash with systemD.
Needs further investigations, will need to pick this up at a later date.
Simple solution for now is using your hack (http://dietpi.com/phpbb/viewtopic.php?f=11&t=2832&p=10900#p10866) and selecting Kodi as autostart option.
Just bear in mind, updating DietPi will revert your changes (replaced with latest scripts), so you’ll need to re-add it back in.