Stop OSMC starting automatically on boot and run from command line

Can you tell me how to stop OSMC starting at boot. It seems to run a process called mediaserver early on. How can I stop this running automatically and run OSMC from the command line. I want touse my PI for other things but want OSMC as a media centre.

Cheers
Spart

1 Like
sudo systemctl stop mediacenter

Sam thanks for coming back to me so quickly.

We are looking at using Rpi’s in the classroom to replace PC’s and save a ton on power. We has successfully installed Alpha4 and the Mate desktop environment. I say successfully because it installed from the standard repos just fine. However we have not worked out how to run it.

Our ideal is to have the pi boot to a command prompt and them we can either run the DT or OSMC or even OSMC from the DT fullscreen.

The command you posted does stop OSMC/Kodi but we have to ssh into the pi to run it. and then we get a terminal prompt on the pi screen.

OSMC is great BTW using the confluence skin it is identical to our previous RaspBMC install. I understand that OSMC is a mediacenter build, we want the media centre capabilites but also the DT capabilities of the Rpi2.

If we exit from OSMC/Kodi it returns us to the OSMC logo screen then restarts OSMC. SO we can’t get a command prompt directly from the pi. If we remove your mediacenter script from the service startup then we can’t call it using systemctl.

I am certian I have misunderstood some of this but hopefully you can advise.

Many thanks
Spart

We should be up and running on NOOBS soon which lets you run multiple OS’. I think switching between Raspbian and OSMC would be a better bet

S

Would that mean having to reboot the pi each time and have it install the OS each time. What we really want is to be able to use OSMC exit then use the DT. Or run OSMC from the DT in a fullcreeen session the exit back to the DT.

With the additional power the Pi2 gives us we really need to find a way to take advantage of it and using it as a desktop and a mediacentre would be great for us.

Cheers
Spart

Since you are in the business of education, I’d like to make sure you understand the termnologys you are using so that there’s no confusion and no one misunderstands or is misinformed. OSMC is our entire distro as a whole. Kodi is the media center that I’m assuming you are trying to prevent from starting at boot.

I think some of what sam is trying to convey is that, if you are trying to teach linux, using pure Raspbian would be a much better distro to do so with. It has a desktop environment, it has CLI, and all things work as expected in Linux. OSMC is built with a very specific purpose in mind, to run Kodi. There will be differences between Raspbian and OSMC for this reason. This might also be the case that, while teaching someone linux, functions of OSMC could be broken and that could take quite a bit of time out of your class to resolve.

Using NOOBS is probably a better option since, it allows you to have multiple operating systems installed on one sdcard. Simply rebooting the device (as I understand it) will bring you to a menu prompting you to select which OS you’d like to boot. This way, you have access to both systems and able to decide which to boot for the appropriate task at hand.

I udnerstand the terminology just fine! I am aware as I stated earlier that OSMC is a complete mediacentre build. I am not sure why you thought we were teaching Linux.

NOOBS does not fit out proposed use case. If it were as simple as using Raspbian and installing KODI as an application that would be fine. But sadly there is no Kodi build available to install. I am not really sure why. With the additional power the Rpi2 has we could have the the potential to replace a lot of PC technology, not all, but for the basic use cases we have it should do a great job (Web/Docs/Presentations etc.), but we need a mediacentre application. We use it for learning videos etc.

Being able to use a well supported mediacentre such as OSMC/Kodi would mean we are using the best DT and the best Mediacentre for the PI. I am sure our use case will not be unique as more people switch onto the idea of using the new Rpi2’s for general use. The previous generation just were not powerful enough.

Maybe not the right place, but as a very long time user of RaspBMC and with Sam’s platform experience the best place I could think of to look for help achieving this.

Spart

/etc/systemd/system/multi-user.target.wants/mediacenter.service

is what launches Kodi

1 Like

Thanks that explains why I could not get it to stop after removing mediacenter from RcX runlevels :smile:

Cheers
Spart

We use the systemd initialisation system. You should be able to install a minimal desktop quite easily (I recommend LXDE). You can then disable X from automatically starting at boot. You’d then have the choice of being able to decide at boot what you want to load with

startx # loads LXDE
sudo systemctl start mediacenter # loads Kodi

Sam,

Many thanks. I have started with a clean USB install of OSMC Alpha4 on my test B+.

On first boot, I SSH into the pi and run:

sudo systemctl disable mediacenter
sudo reboot now

On reboot the pi displays the OSMC logo screen. It seems it is using tty1 for this. Mediacenter is not running, in fact very little is running. I can switch to tty2-6. If I edit config,.txt and comment out start_x=1 then the pi fails to boot and I get 4 green flashes. I then have to edit config.txt on the sdcard and put it back to start_x=1 to get the pi to boot. At this point I have not tried to install anything else it is a vanilla OSMC installl with mediacenter disabled on startup.

Clearly something is displaying the OSMC logo screen and taking over tty1 at boot time. Is there another process I need to systemctl disable to get a command prompt on tty1 after boot?

Cheers
Spart

here is a little how to

https://discourse.osmc.tv/t/howto-for-auto-quit-start-kodi-based-on-tv-status/

Unrelated, but just to clear it up:
I am quite certain that start_x=1 has nothing to do with startx or LXDE.
If I´m not mistaken start_x=1 is a setting to use the *_x.elf and *_x.dat firmware files.
Comment that out without having the other firmware files and you will not be able to boot.

osmc@osmc:~$ ls -lash /boot
total 16M
1.5K drwxr-xr-x 4 root root 1.5K Jan 1 1970 .
4.0K drwxr-xr-x 23 root root 4.0K Jan 1 1970 …
4.5K -rwxr-xr-x 1 root root 4.2K Feb 1 20:14 bcm2708-rpi-b.dtb
4.5K -rwxr-xr-x 1 root root 4.2K Feb 1 20:14 bcm2708-rpi-b-plus.dtb
18K -rwxr-xr-x 1 root root 18K Jan 31 12:42 bootcode.bin
512 -rwxr-xr-x 1 root root 57 Jan 1 1980 cmdline.txt
100K -rwxr-xr-x 1 root root 100K Feb 1 18:05 config-3.18.5-2-osmc
512 -rwxr-xr-x 1 root root 315 Feb 8 15:13 config.txt
512 -rwxr-xr-x 1 root root 113 Feb 8 14:59 config.txt~
512 drwxr-xr-x 3 root root 512 Jan 1 1980 dtb-3.18.5-2-osmc
9.0K -rwxr-xr-x 1 root root 9.0K Jan 31 12:42 fixup_x.dat
2.5K -rwxr-xr-x 1 root root 2.4K Jan 1 1980 install.log
5.2M -rwxr-xr-x 1 root root 5.2M Feb 1 20:49 kernel.img
1.5K -rwxr-xr-x 1 root root 1.5K Jan 31 12:42 LICENCE.broadcom
1.0K drwxr-xr-x 2 root root 1.0K Jan 1 1980 overlays
512 -rwxr-xr-x 1 root root 93 Jan 1 1980 preseed.cfg
3.5M -rwxr-xr-x 1 root root 3.5M Jan 31 12:42 start_x.elf
1.8M -rwxr-xr-x 1 root root 1.8M Feb 1 19:51 System.map-3.18.5-2-osmc
5.2M -rwxr-xr-x 1 root root 5.2M Feb 1 19:51 vmlinuz-3.18.5-2-osmc

Everything in my /boot directory.

As I said, unrelated, but just to explain;
Pi will as default look for start.elf and fixup.dat on boot, these are the GPU firmware files.
If you instead want to use the start_x.elf and fixup_x.dat (which is a little different) you need to add start_x=1 in config.txt.

There are actually three ways of doing this;

  1. You can simply rename the firmware files
  2. Add start_x=1 to config.txt (just like OSMC does)
  3. Add 2 lines to config.txt: start_file=start_x.elf + start_fixup=fixup_x.dat (as Raspbmc does)

Again, this is completely unrelated from your topic, but I just wanted to explain it as I saw you were editing this setting.

Miappa,

Thanks for the explanation. My mistaken guess to try and get to a command prompt. Clearly there is another process that loads the OSMC logo screen and takes over tty1. So disabling mediacenter with systemctl disable mediacenter definatley stops mediacenter form running, but does not boot to a command prompt from which I can install a desktop (LXDE) and decide to:

startx # loads LXDE
sudo systemctl start mediacenter # loads Kodi

I think the key sentence in Sams reply was:

You can then disable X from automatically starting at boot.

There is nothing x related I can see in the runlevels /etc/rc*

So systemd is probably the culprit. Black magic to me :smile:

Cheers
Spart

The screen you’re talking about is the splash screen, you need to disable splash. As it stands you have no x server, you need to install one, off the top of my head sudo apt-get update sudo apt-get install lxde-minimal
Package name may not be quite right you can try "sudo apt-cache search lxde*’ but the output may be big. Once you install an x server you can then disable it and boot to command prompt where you can either start the x server with a command similar to “startx” or launch Kodi with “sudo systemctl start mediacenter”

Dilligaf

Thanks for responding. You clearly understand the detail. Can you elaborate a little on your comments:

“you need to disable splash” - Can you advise how? I tried disable_splash=1 in config.txt

I understand I have no x server installed. I was just trying to go in simple steps:

  1. Get OSMC to boot to a command prompt and run mediacenter from the command line.
  2. Install a Graphical Desktop
  3. Either launch mediacenter from the desktop or from the command line

“Once you install an x server you can then disable it” - Can you advise how

Many thanks.
Spart

I honestly don’t know off the top of my head. What I would do if I wanted to achieve this is use my Google Foo, as you want it and not me it’s up to you to Google. Seriously I’m NOT trying to be an ass, Google is where I would be right now.