Incorrect "The Virtualmin install script must be run as root" error

I'm working on an install procedure to install virtualmin through ansible, but running into a weird issue in my install routine.

The install script fails with the following error:

The Virtualmin install script must be run as root

I've narrowed it down to this part in the install.sh file:

# Only root can run this
id | grep "uid=0(" >/dev/null
if [ "$?" != "0" ]; then

When I execute the id command manually, this is my output:

root@web1:~# id
UID=0(root) GID=0(root) groepen=0(root)

It seems that the check fails due to the response being uppercase in stead of lowercase. When I change this line:

id | grep "uid=0(" >/dev/null

to

id | grep -i "uid=0(" >/dev/null

the install proceeds as expected

Status: 
Closed (fixed)

Comments

Howdy -- well that's an odd problem, we've never seen that before after a bunch of testing on Debian.

I'm wondering if Debian changed something recently, or if maybe there's a different coreutils package installed?

What's the output of these two commands:

You're right though, fixing that should be as simple as making that grep case insensitive, I'll look into that.

Narrowed it down a bit more, root cause is that ansible connected using the dutch locale and settings. Switching it to en_US solves the capital problems :-)

What does the id -a command output when the language is set to Dutch?

Executing LANG=C before executing the script does the trick for me.

I've seen this before - the easy solution is to change the grep command as suggested by the OP.

Same problem occured here on CentOS 7. Also dutch.

Fixed with the small fix in the install file

Joe's picture
Submitted by Joe on Thu, 11/02/2017 - 19:38 Pro Licensee

Fixed. Thanks for the heads up. It never crossed my mind that the language would effect the capitalization of that output of that command!

As an aside, using LANG=C will prevent Unicode from working so the progress bars would be homely, but en_US would do the trick. Though I guess that wouldn't matter in an automated install, since nobody will be looking at the output.

Status: Fixed ยป Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.