# Offline install as root, still requires sudo

**URL:** <https://discuss.kubernetes.io/t/offline-install-as-root-still-requires-sudo/16748>\
**Category:** microk8s\
**Created:** [July 18, 2021, 9:01am UTC](https://discuss.kubernetes.io/t/offline-install-as-root-still-requires-sudo/16748 "2021-07-18T09:01:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![flipcode](https://avatars.discourse-cdn.com/v4/letter/f/848f3c/32.png) [@flipcode](https://discuss.kubernetes.io/u/flipcode)\
**Post date:** [July 18, 2021, 9:01am UTC](https://discuss.kubernetes.io/t/offline-install-as-root-still-requires-sudo/16748/1 "2021-07-18T09:01:21Z")

</div>

Hi,

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.

Thx

---

<div class="post-metadata">

**Author:** ![protosam](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/protosam/32/7732_2.png) [@protosam](https://discuss.kubernetes.io/u/protosam)\
**Post date:** [July 19, 2021, 10:07pm UTC](https://discuss.kubernetes.io/t/offline-install-as-root-still-requires-sudo/16748/2 "2021-07-19T22:07:42Z")

</div>

If you can’t remove the `requiretty` from sudoers, can you just [fake having a tty](https://unix.stackexchange.com/questions/249723/how-to-trick-a-command-into-thinking-its-output-is-going-to-a-terminal)?

In theory, something like [pty](https://docs.python.org/3/library/pty.html) can do the trick for you.

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

---

<div class="post-metadata">

**Author:** ![flipcode](https://avatars.discourse-cdn.com/v4/letter/f/848f3c/32.png) [@flipcode](https://discuss.kubernetes.io/u/flipcode)\
**Post date:** [July 19, 2021, 11:21pm UTC](https://discuss.kubernetes.io/t/offline-install-as-root-still-requires-sudo/16748/3 "2021-07-19T23:21:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![protosam](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/protosam/32/7732_2.png) [@protosam](https://discuss.kubernetes.io/u/protosam)\
**Post date:** [July 19, 2021, 11:38pm UTC](https://discuss.kubernetes.io/t/offline-install-as-root-still-requires-sudo/16748/4 "2021-07-19T23:38:56Z")

</div>

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.
