(Kali) Can't create GVM user, throws an error "Failed to create user: Invalid characters in user name"

GVM installation was successful. After that “sudo gvm-check-setup” shows following.

Step 5: Checking Postgresql DB and user ... 
        OK: Postgresql version and default port are OK.
 gvmd      | _gvm     | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
        ERROR: No users found. You need to create at least one user to log in.
        FIX: create a user by running 'sudo runuser -u _gvm -- gvmd --create-user=<name> --password=<password>'

 ERROR: Your GVM-21.4.3 installation is not yet complete!

Please follow the instructions marked with FIX above and run this
script again.

After this when I try to create new user, I get an error below.

$ sudo runuser -u _gvm -- gvmd --create-user=admin --password=admin
Failed to create user: Invalid characters in user name

I also tried following command to create new user. But that doesn’t work as well, because I don’t see any users created (as shown below).

sudo gvmd --create-user=admin --password=admin 
                                                                                                                                                                                                                           
┌──(kali㉿kali)-[~]
└─$ sudo gvmd --get-users                          
                                                                                                                                                                                                                           
┌──(kali㉿kali)-[~]
└─$ 

I also checked var/log/gvm/gvmd.log but I couldn’t figure out issue based on this.

md manage:   INFO:2022-09-18 06h14.15 utc:3483:    Creating user.
md manage:WARNING:2022-09-18 06h14.17 utc:3483: Invalid characters in user name!

md   main:MESSAGE:2022-09-18 06h32.39 utc:8394:    Greenbone Vulnerability Manager version 21.4.5 (DB revision 242)
md manage:   INFO:2022-09-18 06h32.39 utc:8394:    Creating user.
md manage:WARNING:2022-09-18 06h32.39 utc:8394: sql_open: PQconnectPoll failed
md manage:WARNING:2022-09-18 06h32.39 utc:8394: sql_open: PQerrorMessage (conn): connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  role "root" does not exist
md manage:WARNING:2022-09-18 06h32.39 utc:8394: init_manage_open_db: sql_open failed
md   main:MESSAGE:2022-09-18 06h32.59 utc:8493:    Greenbone Vulnerability Manager version 21.4.5 (DB revision 242)
md manage:   INFO:2022-09-18 06h32.59 utc:8493:    Getting users.
md manage:WARNING:2022-09-18 06h32.59 utc:8493: sql_open: PQconnectPoll failed
md manage:WARNING:2022-09-18 06h32.59 utc:8493: sql_open: PQerrorMessage (conn): connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  role "root" does not exist
md manage:WARNING:2022-09-18 06h32.59 utc:8493: init_manage_open_db: sql_open failed

I think _ in _gvm seems to be causing this issue, but not sure how to correct this.

Due to this issue, I can’t login to greenbone via browser, it says “username or password invalid”.

I am novice to Kali Linux and GVM, so any help is appreciated.

1 Like

@techsec how to is installed and what is os running os? from packages? latest kali?

“Failed to create user: Invalid characters in user name” means that something is wrong in username.

try running command on root

su - _gvm -s /bin/bash and then running command (do not paste it, just type it)

Eero

Thanks for response.

I have installed GVM via apt-get install gvm on Kali Linux running on VirtualBox (find the version of Kali Linux and GVM below).

_gvm@kali:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Kali
Description:    Kali GNU/Linux Rolling
Release:        2022.3
Codename:       kali-rolling
┌──(kali㉿kali)-[/home/kali]
└─PS> sudo gvmd --version
Greenbone Vulnerability Manager 21.4.5
Manager DB revision 242
Copyright (C) 2009-2021 Greenbone Networks GmbH
License: AGPL-3.0-or-later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

I tried to run command to root, but it didn’t make any difference.

┌──(root㉿kali)-[/var/log/gvm]
└─# runuser -u _gvm -- gvmd --create-user=admin --password=admin 
Failed to create user: Invalid characters in user name

I also ran the command which you provided. Seems like we do have user created _gvm, but not sure where to go next from there!

┌──(root㉿kali)-[/var/log/gvm]
└─# su - _gvm -s /bin/bash
_gvm@kali:~$ 
_gvm@kali:~$

Well.

gvmd --create-user=admin --password=admin

Eero

Yeah I have already tried that command but it doesn’t work either. It doesn’t throw an error when I run it, but when check existing users, I don’t get any users.

┌──(kali㉿kali)-[/home/kali]
└─PS> sudo gvmd --create-user=admin --password=admin
                                                                                                                                                                                                                           
┌──(kali㉿kali)-[/home/kali]                                                                                                                                                                                               
└─PS> sudo gvmd --get-users                                                                                                                                                                                                
                                                                                                                                                                                                                           
┌──(kali㉿kali)-[/home/kali]                                                                                                                                                                                               
└─PS>

@techsec please read what I said.

su - _gvm -s /bin/bash
gvmd --create-user=admin --password=admin

Eero

Got it, thanks. Please find results below, I am getting same error.

_gvm@kali:~$ gvmd --create-user=admin --password=admin
Failed to create user: Invalid characters in user name
_gvm@kali:~$

@techsec You are probably pasting that command with some weird nonspace charachers. please type it manually.

Eero

@Eero Thanks, I tried that two times below, typed manually without any pasted characters. But it throws same error, please find results below.

_gvm@kali:~$ gvmd --create-user=admin --password=admin
Failed to create user: Invalid characters in user name
_gvm@kali:~$ gvmd --create-user=admin --password=admin
Failed to create user: Invalid characters in user name
_gvm@kali:~$

Hello,

I have the same problem as techsec with an installation on RASPBERRY PI and Kali linux.
The message is Invalid characters in user name.

@techsec do you use an AZERTY keyboard?

@El_LoCo No I have QWERTY keyboard.

Ah OK

I have an AZERTY. I thought the error came from this keyboard.

I have searched many forums and tutorials without finding a solution to this problem.

I hope an expert can help us.

@El_LoCo Yeah likewise, I hope so too.

There is an open bug report for Kali here:

https://bugs.kali.org/view.php?id=7926

As this only started recently after an update in Kali without any changes from GVM side i would wait for some feedback from the Kali maintainers (e.g. some buggy libraries introduced in Kali, some problems in the terminal used for the setup scripts, …).

2 Likes

Hi,

as @cfi mentioned this is very likely an issue introduced by Kali. The code - which is failing here - is very simple and only applies a regex (gvmd/manage.c at stable · greenbone/gvmd · GitHub) that clearly shouldn’t fail.

3 Likes

@techsec are you running latest kali linux? try upgrading it.

Eero

@bricks Kali – the source of all problems.

Eero

Thanks to @cfi and @bricks

I did the installation on a kali linux 2022.2.
There is no longer this error message. it’s OK.

I was able to change the password with:

sudo -E -u _gvm -g _gvm gvmd --user=admin --new-password=new_password

then a check:

sudo gvm-check-setup

Everything went well, I got the following message:

It seems like your GVM-21.4.3 installation is OK.

1 Like

I think that mine is a similar issue. As I have had a working install for years and then within the past couple of days the latest Kali update broke it. I cannot create new users get the same error as well and check-setup says all is good. If I look in the log I see failed logins with an empty user name. So I suspect when a new user is created it is passing blanks and also this is the reason why it will not authenticate as it is just seeing blanks in the username. Interesting thing is that it is still scanning correctly just cannot login to see the results.

1 Like

Same problem here:

Latest KALI LINUX update and then:

  1. GVM login credentials NOT recognized (error)!!!
  2. When trying to create NEW user in GVM, the error message writes “illegal characters in user name”!!!

Any standard solution?

Thanks!!!