Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advise adding a requirement to run script as normal user #573

Closed
jiblime opened this issue Mar 26, 2019 · 5 comments
Closed

Advise adding a requirement to run script as normal user #573

jiblime opened this issue Mar 26, 2019 · 5 comments

Comments

@jiblime
Copy link

jiblime commented Mar 26, 2019

[Description of the issue]
Was in root shell when I ran install.sh, caused pip modules to be given root permissions and I had to reconfigure all the packages.

Steps to Reproduce

  1. Not have all the prerequisite pip modules
  2. Run the install.sh script in root shell
  3. Now have undesired installation environment

Expected behavior: For the script to end if shell configuration was improper. This was after I actually read the script and saw it had calls for root access, my mistake. Otherwise I thought it would installed correctly with packaging making it easy to remove.

Actual behaviour: Pip modules installed as root, recursive dependencies of missing packages. Unable to install/uninstall packages due to reverse dependencies/recursive dependencies.

Reproduces how often: Once. I'm not fond of hurting myself.

Versions

tizonia 0.18.0
Debug Info:
* [Boost 1_65_1]
* [TagLib 1.11.1]
* [MediaInfoLib - v17.12]

ID_LIKE="ubuntu debian"
PRETTY_NAME="KDE neon Developer Edition"
VERSION_ID="18.04"
Python = 2.7.15rc1
Python = 3.6.7
apt = 1.6.10 (amd64)

Installation Method Used

curl -kL https://github.com/tizonia/tizonia-openmax-il/raw/master/tools/install.sh | bash

Additional Information

Paste of installation log:
https://0bin.net/paste/S9E20yhBpf5zBl5h#8IuC+pDphJCdnqV9keg3m0zpV2AhZpBW7avhb0x1+L9

Any additional information, configuration or data that might be necessary to
reproduce the issue.
Unsure. Running apt update or repair operators did not resolve the issue. I went to the repository and downloaded the .deb files for my architecture, then used dpkg -i to install.

@juanrubio
Copy link
Member

Hi!, thanks for taking the time to report an issue.

I'm sorry to hear that you ended up with problems while running the installation script on a root shell.

Working on a root shell is highly discouraged in most distros (especially Ubuntu and derivatives). If I remember correctly, depending on the method used to gain root access on your shell, your environment variables may or may not have been reset from user to root. So things like $PATH, or $HOME may still be the user's while running the commands as root. I have the impression that this is what happened to you.

Expected behavior: For the script to end if shell configuration was improper.

The problem here is to define what 'improper' means here. E.g. running the script as root is not a problem per se. Perhaps a check could be added to verify that $HOME, $USER and $(id -u) all have a consistent view.

What method was used to get your root shell? Do you know?

@jiblime
Copy link
Author

jiblime commented Mar 31, 2019

Hello,

I was intentionally running as root from a prior project. Therefore everything was ran with root user's environment variables. I can see your PoV about running it as root not being a problem; I do realize now it's an option I chose rather than an issue with how the script itself should function. Your idea of checking the env rather than just the user sounds like a good implementation if this was a more common issue.

I don't particularly like running pip with sudo (my mistake not reading the script + root shell), perhaps you could install as user and check if $PATH needs to be appended if it isn't a requirement to do so. The only actual issue that occurred was needing to install Tizonia packages manually but I don't see where that issue could've arisen from your end.

@juanrubio
Copy link
Member

Hi,

perhaps you could install as user and check if $PATH needs to be appended if it isn't a requirement to do so.

The script is intended to do a system-wide installation of Tizonia, and that is why a system-wide installation of pip packages is the only option. That is the only way to guarantee that Tizonia works for all users in the system. If someone wishes to install pip packages in its user environment only, then the option of tweaking the script to do pip install --user is simple enough. So I would not change anything in that regard.

But I like the idea of warning the user if the script is run as root, in which case I think the execution should be aborted. So I'm thinking about adding a command-line option to the script that would be required in case you want to install as root. E.g. something along these lines:

# On a root shell:
$ ./install.sh
WARNING: Running as root: installation aborted. Please add '--safe' to bypass this check and continue installing as root.

@juanrubio
Copy link
Member

This change has been commited to master : 3823763

@jiblime
Copy link
Author

jiblime commented Apr 4, 2019

I've got to say, you've one of the most responsive and cordial devs I've had the pleasure of speaking with. I hope to be able to emulate the same level of professionalism that you've shown someday. Thanks for all you do.

@jiblime jiblime closed this as completed Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants