comments 12

How to Autostart Kodi on Raspberry Pi using only ONE command

The second most-asked question after How to Install Latest Kodi 17.1 Krypton on Raspberry Pi is “How to make Kodi Autostart when i boot my Raspberry Pi?”.

Most people have a dedicated Raspberry Pi sitting behind a TV to act as a media center, and so they don’t want the hassle of having to connect via SSH or wireless keyboard to start Kodi whenever the Raspberry Pi is rebooted for any reason.

There are a lot of answers and solutions to this question, while some solutions work, they are neither easy nor straight-forward and most probably you will have to try a lot of solutions to find one that’s working for you.

But now i found how to make this happen with only ONE command, this is possible because basically Raspbian is running LXDE window manger, and thanks to ArchWiki i found out how to autostart an application in a safe and easy way.

All you have to do is to login to your Raspberry Pi, open a terminal, and paste the below line:

echo "@kodi" >> ~/.config/lxsession/LXDE-pi/autostart

Basically we are instructing LXDE to run Kodi after launching the window manager, that’s it, as simple as that.

If you want to know more or make Kodi autostart for any and all users, you can read more at ArchWiki’s page about LXDE

Filed under: Quick Tips, Raspberry Pi

About the Author

Posted by

I am a self-taught geek, I develop websites using PHP/Java/Python, and MySQL/ElasticSearch, over Apache/Nginx; My daily job includes working with Laravel, Magento, WordPress, WooCommerce, and enough system administration to manage servers lying around.


  1. dodli

    after doing this i get a black screen.
    kodi is working, ( i can here the sound of the button selection) but the screen is totally black.

    how do we cancel the autostart?
    how do i go back to the desktop from kodi?

    thank you.

  2. Black screen with a mouse cursor?


    According to, if there is a local file (~/.config/lxsession/LXDE-pi/autostart) and a global file, (/etc/xdg/lxsession/LXDE/autostart) LXsession only executes the local file as of v0.4.9 (I presume, of LXDE.)

    So, [echo “@kodi” >> ~/.config/lxsession/LXDE-pi/autostart] creates a new autostart, which causes the global one not to run, and the commands in THAT file are NOT run. You get no desktop on which Kodi should display.

    >>> DO THIS INSTEAD <<> ~/.config/lxsession/LXDE-pi/autostart

    /etc/xdg/lxsession/LXDE $ more ~/.config/lxsession/LXDE-pi/autostart
    File contents should look like this.
    @lxpanel –profile LXDE-pi
    @pcmanfm –desktop –profile LXDE-pi
    @xscreensaver -no-splash

    On my Raspberry Pi 4, the line, ‘@kodi’ crashed. So I had to use


    Ain’t Linux grand?

  3. I don’t know what evil the formatting system did to my preceding post, but the commands needed were:

    cp -f /etc/xdg/lxsession/LXDE-pi/autostart ~/.config/lxsession/LXDE-pi/

    followed by:

    echo “@kodi” >> ~/.config/lxsession/LXDE-pi/autostart

    Your help in correcting this would be greatly appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *