Accessing Command Line from XBMC

13 posts
by Kaneage » Wed Aug 08, 2012 12:02 pm
Hi all,

New to all this Raspberry Pi, and in the process of expanding my SD card.

How do I access the command line from XBMC?

Posts: 8
Joined: Sat Aug 04, 2012 2:38 pm
by JoeDaStudd » Wed Aug 08, 2012 12:18 pm
Which distro are you using?
With Raspbmc you simply go to the power item and select Exit.
Posts: 275
Joined: Fri Jan 27, 2012 1:34 pm
by Kaneage » Wed Aug 08, 2012 4:11 pm
I'm on OpenELEC - same deal?
Posts: 8
Joined: Sat Aug 04, 2012 2:38 pm
by Kaneage » Thu Aug 09, 2012 7:19 am
I've recently reverted back to Raspbmc, as openELEC was playing up. Only thing is, once I go to 'exit' it just restarts and loads up the Raspbmc dashboard again.

Anyway of stopping this and just going to command line?
Posts: 8
Joined: Sat Aug 04, 2012 2:38 pm
by dom » Thu Aug 09, 2012 9:23 am
Kaneage wrote:Anyway of stopping this and just going to command line?

OpenELEC's design goal is to behave like a single function appliance, hence no ability to exit to command line.
For admin purposes you can ssh in.
Forum Moderator
Forum Moderator
Posts: 4448
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by Paul Webster » Thu Aug 09, 2012 12:42 pm
With Raspbmc (from RC3) you can choose exit from the shutdown menu.
After a few seconds you should see a white screen with instructions saying that it you hit ESC from keyboard then it will drop to command line.
You then have a few seconds to login.
If you don't hit ESC or login then XBMC will restart.

Things slightly changed with RC4 if you have HDMI CEC enabled.
In that case when you exit from XBMC the screen is turned off ... which means that you won't see the white screen.
Power the screen back on quickly then you'll see it.
User avatar
Posts: 530
Joined: Sat Jul 30, 2011 4:49 am
Location: London, UK
by Kaneage » Thu Aug 09, 2012 1:29 pm
Awesome, thanks very much!
Posts: 8
Joined: Sat Aug 04, 2012 2:38 pm
by XploD » Sat Aug 11, 2012 8:31 am
I can't exit to command line. I'm using Raspbmc but when I click on exit, it just freezes. The music continues to play but I can't do nothing and I'm stuck with exit screen. The same when I tried reboot or power off, so I'm shuting down my Pi by disconnecting power supply. Any solution to this!?
Posts: 35
Joined: Sat Mar 17, 2012 12:14 pm
by astrov » Wed Aug 15, 2012 9:25 pm
Same here, any luck?
Posts: 1
Joined: Wed Aug 15, 2012 9:21 pm
by MangyMutt » Tue Feb 05, 2013 5:15 pm

Has anyone figured out how to get XBMC to exit?
Posts: 1
Joined: Tue Feb 05, 2013 5:12 pm
by socialdefect » Tue Feb 05, 2013 9:34 pm
Doesn't XBMC/OpenElec make use of the standard Unix HotKeys??? Any Linux distro I know will jump to a CLI in just a second. There are virtual login consoles hidden under [CTRL]+[Alt]+[F1] ... [F7] and sometimes even up to [F9]. In most cases boot messages and non-X11 boot splash use console 1/2/3 to display their output while booting and 7 or 9 is used by the Xserver to start the login screen and desktop sessions.

So to use the CLI while running an X11 session all you need to do is press [CTRL]+[Alt]+[F1] and enter your username and password (for each console separately). Switching consoles is done using just [Alt]+[F1] up to => [F6] or [F8] on the CLI and you return to the X11 session by pressing [Alt]+[F7] or [Alt]+[F9].

A fast way to reboot is by doing a quick [CTRL]+[Alt]+[F1] followed by [CTRL]+[Alt]+[Delete]. Doing a poweroff can be done by logging-in the CLI and execute: sudo poweroff or sudo shutdown -h now.
Powering-off by clicking software buttons can form a security issue since it requires the xbmc user or group to have setuid root permissions on /sbin/shutdown or configure the /etc/sudoers file to allow the xbmc user to run passwordless sudo on the shutdown command.

There is also such a thing as the function key which can be used to execute system commands like reboot and shutdown but this is something most distro bakers don't activate by default since it can be easily used as a local exploit.

Also I remember installing an XBMC plug-in once that let's you execute some X11 apps on top of XBMC from it's app menu.

The final way to get to a terminal is by editing the xsession script in your home folder or /usr/share/xsessions to include starting an X11 session on one of the virtual screens. These can be accessed by using the same key combinations as for the virtual CLI.
This is done by setting the SCREEN variable in your script or add a screen reference in your command, e.g. startx -:1 or openbox-session -:1 will start a second desktop session on screen1 instead of the default screen0. You can get there by pressing [CTRL]+[Alt]+[F8]

Have fun!.....
== If it's not broke... I'm not done fixing it! ==
User avatar
Posts: 107
Joined: Mon Jun 25, 2012 9:02 pm
Location: Tilburg, the Netherlands
by dom » Tue Feb 05, 2013 10:23 pm
socialdefect wrote:Doesn't XBMC/OpenElec make use of the standard Unix HotKeys???

Not in any useful way with a full screen OpenGLES app running in front of the framebuffer. You will need to exit XBMC to see the console.
Forum Moderator
Forum Moderator
Posts: 4448
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by mareg » Fri Mar 22, 2013 4:26 am
You can also use a ssh client on your PC (like Putty) and connect from there. A lot easier and you can leave xbmc running.
Posts: 1
Joined: Fri Mar 22, 2013 4:24 am