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

logname: no login name #19

Open
pelegm opened this issue Jun 27, 2015 · 11 comments
Open

logname: no login name #19

pelegm opened this issue Jun 27, 2015 · 11 comments

Comments

@pelegm
Copy link

pelegm commented Jun 27, 2015

On Ubuntu 14.04.2,

sudo ./install-tl-ubuntu --hebrew --more-tex

results

logname: no login name

It is followed by another error (?) message a bit later:

sudo: unknown user: 
sudo: unable to initialise policy plug-in

Any consequences I should be worried about..?

@scottkosty
Copy link
Owner

Thanks for this nicely formatted and clear report, pelegm. This part of the code is only used as a check that you did not have any non-standard setting of TeX Live environment variables. So my guess is that everything should be fine. If you have never installed TeX Live on this system before, I would replace "my guess is" with "I am quite confident" in the preceding statement.

However, I would appreciate your help in fixing this part of the code. Your system has more than one user, correct? How did you log in to your system before you ran the command sudo install-tl-ubuntu --hebrew --more-tex ? E.g. just through the normal Ubuntu GUI login? Or is this a headless server by chance?

What is the output of opening a terminal and running the following commands (you might need to paste them into your terminal one-by-one because for a few of them you need to put your password in)?

logname
echo "$USER"
sudo logname
sudo su
echo "$SUDO_USER"
whoami
who am i
logname

If you think the output from running the above commands might contain sensitive information, please email the output to me privately.

@pelegm
Copy link
Author

pelegm commented Jun 28, 2015

Hi,

First, I did have an aptitude version of texlive, but hopefully I have purged it properly before running the script. Regarding your questions:

  • I have only one user, peleg (excluding root of course)
  • I have logged in normally via Ubuntu's login screen (this is my personal laptop and I have a GUI installed)

And about the outputs of the commands:

peleg@lati::~$ logname
logname: no login name
peleg@lati::~$ echo "$USER"
peleg
peleg@lati::~$ sudo logname
logname: no login name
peleg@lati::~$ sudo su
root@lati:/home/peleg# echo "$SUDO_USER"
peleg
root@lati:/home/peleg# whoami
root
root@lati:/home/peleg# who am i
root@lati:/home/peleg# logname
logname: no login name

Now it looks like logname does not work properly on my machine...

@scottkosty
Copy link
Owner

First, I did have an aptitude version of texlive, but hopefully I have purged it properly before running the script.

OK it should be fine then.

I have only one user

Ah then my next guess is that you use a default shell that is not bash. Is that correct?
In some sense it was silly of me to rely on that, but in another sense I was confident that the fallback (logname) would work. However, that both fail shows that I had incorrect reasoning.

What is the output of the following?

grep "/bin/bash" /etc/passwd | perl -pe 's/.*\/(\w+):\/bin\/bash/$1/g' | grep -v "root"

I'm not sure why logname does that for you. I don't know enough to say that it is incorrect behavior, just that I did not expect that. It is good to know that $SUDO_USER might be something I could rely on. I will have to test it in different situations though.

@pelegm
Copy link
Author

pelegm commented Jul 3, 2015

Hi, I am using bash. The output of the command you've requested is

peleg
postgresql

@scottkosty
Copy link
Owner

I think that postgresql implementation is such that it creates a user account. So I believe that technically you have two non-root user accounts, in which case install-tl-ubuntu correclty went to the fallback of using logname. I suppose install-tl-ubuntu could exclude "postgresql" from the results, but I think a better approach is to figure out why logname does not work, and possibly use $SUDO_USER.

I can't think of any other questions to ask you for now.

Thanks a lot for your help on this Peleg!

@pelegm
Copy link
Author

pelegm commented Jul 4, 2015

Thank you.

You may wish to have a look at this ask-ubuntu question.

@scottkosty
Copy link
Owner

Unfortunately $LOGNAME does not work for me. To test, create a file test.sh with the following contents:

#!/bin/bash

echo $LOGNAME

When I run sudo ./test.sh, I get "root". When I replace echo $LOGNAME with just the command logname, I get "scott" when I run it.

@pelegm
Copy link
Author

pelegm commented Jul 4, 2015

Right.

However, echo $SUDO_USER does work here...

@scottkosty
Copy link
Owner

That is indeed looking like a good alternative.

@smolkaj
Copy link

smolkaj commented Sep 8, 2016

Same issue here, similar output as @pelegm.

@scottkosty
Copy link
Owner

@smolkaj thanks for confirming and sorry for the frustration. I am hoping to have some time soon to fix this issue.

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

3 participants