MycroftAI / enclosure-picroft

Mycroft interface for Raspberry Pi environment
https://mycroft.ai/documentation/picroft
GNU Lesser General Public License v3.0
806 stars 192 forks source link

autorun tries to launch services on every terminal #41

Closed jherico closed 6 years ago

jherico commented 6 years ago

The autorun script seems to assume that if you're not connecting over SSH it should launch the mycroft services. But if you're working locally, it's not uncommon for an experienced *nix developer to rely on multiple TTYs in the absence of a windowing system (ctrl-alt-1, ctrl-alt-2, etc).

The autorun script should detect if the services have already been launched or detect that we're not running on the default TTY and not attempt to launch them again.

penrods commented 6 years ago

Are you certain it is relaunching? The script explicitly checks for SSH logins here https://github.com/MycroftAI/enclosure-picroft/blob/master/home/pi/auto_run.sh#L21

It only runs the last portion of the autorun (line 164 onward) if not running on the main console.

jherico commented 6 years ago

I'm not talking about SSH logins. If you connect the Pi to a monitor and keyboard and boot it up it will be on TTY 1 and will login and run the script. If you then hit ctrl-alt-2 it will switch to TTY 2 and give you a login prompt. Logging in as pi will then re-run the script including the content in the if statement, because TTY 2 isn't an SSH login, it's just another terminal on the same system.

penrods commented 6 years ago

Ah, that isn't a use case the script expected. Any suggestions to add to the script to catch that?

jherico commented 6 years ago

you could look at the output of /usr/bin/tty and skip the bulk of the code if it's not /dev/tty1

russ-go commented 6 years ago

Just ran into this problem troubleshooting microphones. Opened a second local terminal to watch the logs.

Zephael86 commented 6 years ago

I can confirm. Same use case as @jherico

penrods commented 6 years ago

Fixed by #44