Audit not updated error

NethServer Version: 7.7.1908

Hi guys,
I have a problem where the samba audit doesn’t work anymore.
image
[root@dama bin]# /usr/bin/setsid /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-samba/audit/update | jq
DBI connect(‘smbaudit:localhost’,‘smbd’,…) failed: Access denied for user ‘smbd’@‘localhost’ (using password: YES) at /usr/bin/smbauditdbupdate.pl line 33.
Cannot connect to database: Access denied for user ‘smbd’@‘localhost’ (using password: YES) at /usr/bin/smbauditdbupdate.pl line 33.
error: error running non-shared prerotate script for /var/log/smbaudit.log of '/var/log/smbaudit.log '
{
*** “type”: “GenericError”,***
*** “id”: 1580906379,***
*** “message”: “generic_error”***
}
[root@dama bin]#

How can I fix this error?

You should update smbd password into mysql with the password saved into /var/lib/nethserver/secrets/smbd

Copy your password: you can see that with tail /var/lib/nethserver/secrets/smbd

Follow this commands:

mysql

Once you are into mysql console launch:

ALTER USER 'smbd'@'localhost' IDENTIFIED BY 'yourcopiedpassword';
FLUSH PRIVILEGES;

Retry to update settings. Tell me if it works (change password command can be also different).

Thanks for repling but mysql access denied

ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)

the password in /var/lib/nethserver/secret/mysql is the same as /root/.my.cnf

Is the service running properly?

systemctl status mysqld

[root@dama ~]# systemctl status mysqld
● mysqld.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Wed 2020-02-05 13:10:44 -03; 48min ago
Process: 1609 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Process: 1608 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
Process: 1334 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 1608 (code=exited, status=0/SUCCESS)

Feb 05 13:08:29 dama.pdc.local systemd[1]: Starting MariaDB database server…
Feb 05 13:08:30 dama.pdc.local mariadb-prepare-db-dir[1334]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
Feb 05 13:08:30 dama.pdc.local mariadb-prepare-db-dir[1334]: If this is not the case, make sure the /var/lib/mysql is empty before running mariadb-prepare-db-dir.
Feb 05 13:08:32 dama.pdc.local mysqld_safe[1608]: 200205 13:08:32 mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log’.
Feb 05 13:08:32 dama.pdc.local mysqld_safe[1608]: 200205 13:08:32 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 05 13:08:35 dama.pdc.local systemd[1]: Started MariaDB database server.

MariaDB is running
[root@dama ~]# service mariadb status
Redirecting to /bin/systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-02-05 13:08:35 -03; 51min ago
Process: 1607 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Process: 1333 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 1606 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─1606 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─2988 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socke…

Feb 05 13:08:29 dama.pdc.local systemd[1]: Starting MariaDB database server…
Feb 05 13:08:30 dama.pdc.local mariadb-prepare-db-dir[1333]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
Feb 05 13:08:30 dama.pdc.local mariadb-prepare-db-dir[1333]: If this is not the case, make sure the /var/lib/mysql is empty before running mariadb-prepare-db-dir.
Feb 05 13:08:32 dama.pdc.local mysqld_safe[1606]: 200205 13:08:32 mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log’.
Feb 05 13:08:32 dama.pdc.local mysqld_safe[1606]: 200205 13:08:32 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Feb 05 13:08:35 dama.pdc.local systemd[1]: Started MariaDB database server.

Could you please try to start mysqld?

systemctl start mysqld

but mariadb it’s running

On my server mysqld is running and mariadb not:

[root@mail ~]# systemctl status mysqld
● mysqld.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-11-27 12:29:01 CET; 2 months 10 days ago
 Main PID: 6842 (mysqld_safe)
   CGroup: /system.slice/mysqld.service
           ├─6842 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─7016 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socke...

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.


[root@mail ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

Try:

systemctl stop mariadb
systemctl reset-failed mysqld
systemctl start mysqld

If an error occurs post the output of:

journalctl -xe

and some relevant logs.

Sorry for the slow reply.

It’s work using:

systemctl stop mariab
systemctl reset-failed mysqld
mysqld_safe --skip-grant-tables --skip-networking
systemctl start mysqld

I changed the password using SET PASSWORD FOR ‘smbd’@‘localhost’ = PASSWORD(‘password’); and it’s work.

[root@dama ~]# /usr/bin/setsid /usr/bin/sudo /usr/libexec/nethserver/api/nethserver-samba/audit/update | jq
{
“state”: “success”
}

But when I access Samba audit, the page is loading and gives the following message:

In the cockpit is only loading screen

I have de same problem.
I followed the same procedures but does not loading the Samba audit.
Any suggestion?

Sorry, I’m still having problems with Samba Audit

Please use the new cockpit server-manager to work with samba audit. It has some fixes that make it behave well when you have a lot of entries in the logs.

If you still have problems, you have to drop the whole smbaudit database.

I’m using the Cockpit for this, but it takes about 10 minutes to open the page. If I do a search, it’s another 10 minutes around.

How can I do this?

If you know phpmyadmin (https://wiki.nethserver.org/doku.php?id=phpmyadmin&s[]=phpmyadmin) use it, please (you may discover how big the db has grown).

Otherwise from the terminal:

mysql -e "DROP DATABASE smbaudit"

3 Likes

Thank you, I will test these options

Thank you very much, I used phpmyadmin and made a backup of smdaudit and created another one. It had 25GB :dizzy_face:

@Wellington_Rodrigues could you please keep an eye on the database size in the next days? Just to be sure that it will not grow big again.

Sure, no problem!