install-tl-ubuntu icon indicating copy to clipboard operation
install-tl-ubuntu copied to clipboard

logname: no login name

Open pelegm opened this issue 9 years ago • 11 comments

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..?

pelegm avatar Jun 27 '15 13:06 pelegm

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.

scottkosty avatar Jun 28 '15 04:06 scottkosty

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...

pelegm avatar Jun 28 '15 08:06 pelegm

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.

scottkosty avatar Jun 28 '15 09:06 scottkosty

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

peleg
postgresql

pelegm avatar Jul 03 '15 13:07 pelegm

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!

scottkosty avatar Jul 03 '15 13:07 scottkosty

Thank you.

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

pelegm avatar Jul 04 '15 09:07 pelegm

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.

scottkosty avatar Jul 04 '15 09:07 scottkosty

Right.

However, echo $SUDO_USER does work here...

pelegm avatar Jul 04 '15 10:07 pelegm

That is indeed looking like a good alternative.

scottkosty avatar Jul 04 '15 10:07 scottkosty

Same issue here, similar output as @pelegm.

smolkaj avatar Sep 08 '16 18:09 smolkaj

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

scottkosty avatar Sep 09 '16 14:09 scottkosty