Mycroft Not Auto-Starting at Login When There Is A Mycroft Update

So because there is the need to enter the admin password when updating Mycroft when there is an update available, my script is not able to start Mycroft automatically at boot because it hangs on “enter password for evon” in the background (because i do not start Mycroft with a terminal) in Terminal.

This is the desktop file I’m using to autostart Mycroft at boot: https://github.com/hormozy/MycroftAI.desktop/blob/master/MycroftAI.desktop

Can someone help me think of a solution to this problem so that Mycroft is able to update in the background when ran at boot when he needs to update?

Thanks everyone. I’m on ubuntu 18.04 btw

If I’m reading this right, it sounds like you need to setup a nopasswd file in /etc/sudoers.d

Example:
sudo nano /etc/sudoers.d/010_$USER-nopasswd
$USER ALL=(ALL) NOPASSWD: ALL

ctrl+x and save
And that should take away the need to enter a password.

note - where $USER (evon?) add ur user login :wink:

1 Like

Hello @c0rnelius thank you for your help! This solution works for me. However, let’s say I am trying to fix this on a non-admin account? What do you think the solution would be?

I run Mycroft on one of my laptops and I don’t recall needing admin privileges for it to start with my Xfce4 session. Did you install Mycroft as root? Because that is the only reason I could think that you would need to enter a password when it updates its self.

I also run Mycroft on one of my SBCs and there as well, I’ve never been asked to enter a password. I thought it just reached out to the github and used pip locally to update its self?

I’m honestly not sure how it works; all I know is that it required me to enter my password to update it and because of this it could not run in the background because I had no terminal open when i started it via the desktop app autostarting at login. This isn’t the norm i guess, needing a password to update?

Not to my knowledge, no. I’ve never encountered this need for a password when it runs updates. Maybe someone from the Mycroft team can provide more information on the subject?

As an aside, I do tend to create a nopasswd file in my /etc/sudoers.d directory. It is possible I’ve just never noticed? But I am fairly certain I’ve never been prompted except during the initial installation of Mycroft.

hmmm maybe @gez-mycroft can chime in with some info?

@evon I just ssh’d into my sbc to check it out and noticed during its update to 19.8.7, it checks the packages installed system wide. So in that case, it would need admin privileges before finishing the update.

It appears to update in three stages. Pulls from the github, checks system wide installed packages and then updates what it needs to with pip.

2 Likes

Yeah after first install it should just be the system packages requiring sudo.

I guess you have two options:

  1. You can stop auto-update completely by setting
    "auto_update": false
    in
    mycroft-core/.dev_opts.json

However it won’t update itself so you’d need to manually update Mycroft as the admin when you wanted to pull in new changes.

  1. You could create a custom start up script to bypass the system package updates.
    I’m thinking it’s better to do a custom script rather than modify what’s there as you won’t have to deal with git conflicts. I’d take what you need from start-mycroft.sh and modify the check_dependencies function to not call dev_setup.sh. Instead pull in just the pieces you need from that script. Most importantly, leaving out install_deps .
    The only downside I can see is that if a new system package was added in a Mycroft update this wouldn’t get installed and Mycroft would fail. Or if for some reason the very latest package was required. Both of these are relatively unlikely but I’m sure will happen eventually.

This second option is something we should probably do by default. Would be helpful for some Picroft users too. There has been some talk about refactoring these scripts a little. So this is a useful nudge, thanks :slight_smile:

excellent, this solves it for now thanks @gez-mycroft and @c0rnelius

1 Like