Offline install as root, still requires sudo


When I try to install using the Offline method (snap install ./microk8s_2262.snap) it’s fails part way through when running sudo, even if I install as root.

Message is:
Sudo : Sorry, You Must Have A Tty To Run Sudo

I can narrow this down to /etc/sudoers has:
Defaults requiretty

If I disable temporarily this, microk8s installs. However, it seems it’s still required to be disabled to start microk8s.

Is it possible to perform an install where “Defaults requiretty” is enabled? Ditto general use of microk8s with this enabled.

Can’t turn this off in a corporate network.


If you can’t remove the requiretty from sudoers, can you just fake having a tty?

In theory, something like pty can do the trick for you.

This isn’t an issue with the snap package itself. Relying on sudo is reasonable.

OK but sudo to what? I’m starting this as root and cannot see any account/user information in any of the systemd configuration files (or any other so far).

I did read that link you shared, but it’s not that clear how to implement this with microk8s?

My assumption is that you would just wrap the fake tty around the snap install call. All the things ran therein should share the tty.

Caveat here, I don’t use snap myself so I don’t really know what to expect.

Regarding the question of sudo to what?, installers will often make blanket calls using sudo and the expected behavior is that if you’re root, it doesn’t matter because the results will be the same. It’s also kindof nice because calls to sudo tend to leave auditable information behind too.