Skip to content

Instantly share code, notes, and snippets.

@munho
Created August 14, 2019 04:25
Show Gist options
  • Select an option

  • Save munho/0359ee0c905dd71896bad3857a46ed3a to your computer and use it in GitHub Desktop.

Select an option

Save munho/0359ee0c905dd71896bad3857a46ed3a to your computer and use it in GitHub Desktop.
BBB Autostart a GUI

You could read this:

https://learn.adafruit.com/running-programs-automatically-on-your-tiny-computer

or this:

http://mattrichardson.com/BeagleBone-System-Services/

and think that this will be an easy job. What is not said is that if your code loads a GUI, this won't work at all. Systemd services configure system services. Your GUI has to wait until the display server and display manager have started.

So what would that be for the BeagleBone Black running Debian Jessie?

Researching how the BeagleBone starts up, I found the following steps:

  • U-Boot initializes the processor, vital peripherals and then load Linux image from Flash,
  • U-Boot starts Linux image by passing it some parameters, the bootargs,
  • Linux starts, mounts its rootfs and launches /sbin/init,
  • init process checks its /etc/inittab config file and executes the instructions it contains,
  • this config file generally asks init to launch /etc/init.d/rcS at some point,
  • /etc/init.d/rcS looks at all scripts in /etc/init.d/ directory which start with a S, and executes them in ascending order

I really just included this list for the final line, so that people who don't use Embedded Linux can get a feeling for our pain.

You may find your way to the LXQt GUI and the Sessions Settings > Autostart. I couldn't get anything I put in setting to save. Wrote a bug report.

Here's what works

  1. chmod 755 your file

  2. Write a file to /etc/xdg/autostart like this:

     [Desktop Entry]
     Type=Application
     Exec=sudo /usr/bin/python /home/debian/oqy/oqy.py
     Name=oqy
     Comment=Startup OQY on load
    

To stop the script, ssh into the BBB and

pkill -f oqy.py

Hotkeys probably won't work because the keyboard will likely be locked out by the display manager.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment