After Initial Install on Debian 11, Several Services 'Not found' or 'Failed'

davidc

Verified User
Joined
Jun 19, 2020
Messages
85
This has not been a smooth start-up! Another post described errors with CSF and the fix.

See the attached file for several more issues from systemctl --all output

I think there is something wrong in this installation.

Not running (examples):
apache2.service​
graylist.service​
mysql.service​
NTP.service​
syslog.target​

MySQL symptoms:

Tried to run mysql_secure_installation, on a brand new DA over Debian 11 install, the response was:

Bash:
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

and checking the status

Bash:
root@nvme:/usr/src/csf# sudo systemctl status mysqsl
Unit mysqsl.service could not be found.

I tried reinstalling MySQL - thanks to Poralix:
Bash:
cd /usr/local/directadmin/custombuild/
./build update
./build mysql
but it made no change.

What's next to try?
 

Attachments

This has not been a smooth start-up! Another post described errors with CSF and the fix.
Since this is also happening, I get the impression you might not have waited long enough during initial installation, before starting doing all kind of things.
Because normally things do not go wrong. And very may one. But now it's two and I start doubting if there might nog be more what went wrong.
Or if maybe apparmor has blocked something.

So when installing Directadmin, the initial install is finished very quickly. Did you wait doing stuff until you got a message that all background installations were finished or not? This will take anywhere from 25 minutes to 45 minutes depending on the speed of your system.

If you started before that, it might be best to just clear the VPS/server and start a fresh installation, so you're sure everything is in good order.
 
So when installing Directadmin, the initial install is finished very quickly. Did you wait doing stuff until you got a message that all background installations were finished or not? This will take anywhere from 25 minutes to 45 minutes depending on the speed of your system.

If you started before that, it might be best to just clear the VPS/server and start a fresh installation, so you're sure everything is in good order.
After 2 days of fighting with it, I went ahead and reinstalled Debian 11. Then, started DA install and sat on my hands (as you suggested)

systemctl looks much better, but there are still 2 problems: csf and mysql

csf threw this error in the DA install output (missing some modules):

Code:
Processing triggers for libc-bin (2.31-13+deb11u2) ...
Processing triggers for man-db (2.9.4-2) ...
Installing CSF...
######################################################################## 100.0%
open3: exec of /sbin/iptables -I OUTPUT -p tcp --dport 9999 -j ACCEPT failed: No such file or directory at /usr/local/directadmin/custombuild/tmp/tmp.TgOzzJsZGS.csf/csftest.pl line 144.
command_csf: preliminary test failed, CSF is missing some modules
2024/07/06 17:12:03  info executing task            task=action=notify&message=CustomBuild+installation+has+failed%2C+please+check+the+following+file+for+more+information%3A%0A%2Fvar%2Flog%2Fdirectadmin%2Fcustombuild.1720303910.25634.YWxsAGQA.log&subject=CustomBuild+installation+has+failed&value=admin
2024/07/06 17:12:03  info finished task             duration=36.334117ms task=action=notify&message=CustomBuild+installation+has+failed%2C+please+check+the+following+file+for+more+information%3A%0A%2Fvar%2Flog%2Fdirectadmin%2Fcustombuild.1720303910.25634.YWxsAGQA.log&subject=CustomBuild+installation+has+failed&value=admin
 
mysqsl is not a service. You need to check
Code:
systemctl status mysql
or
Code:
systemctl status mysqld
Thank you for pointing me correctly. Please note in the post above - a complete reinstall.

Now, and still the same as before, when I run your suggestions:

I followed Zeiter's recommendations from this response in Error connecting to MySQL and still have the issues below.

Code:
# systemctl status mysql
Unit mysql.service could not be found.

Code:
# systemctl status mysqld
● mysqld.service - MySQL database server
     Loaded: loaded (/etc/systemd/system/mysqld.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2024-07-06 19:29:19 EDT; 26min ago
    Process: 416466 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 416468 ExecStartPre=/bin/sh -c [ ! -e /usr/local/mysql/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/local/mysql/bin/..; /usr/local/mysql/bin/g>
    Process: 416519 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
   Main PID: 416488 (mysqld)
     Status: "Taking your SQL requests now..."
      Tasks: 30 (limit: 19660)
     Memory: 106.3M
     CGroup: /system.slice/mysqld.service
             └─416488 /usr/local/mysql/bin/mysqld --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock

Jul 06 19:29:19 vps.software.com mysqld[416488]: 2024-07-06 19:29:19 0 [Note] Plugin 'FEEDBACK' is disabled.
Jul 06 19:29:19 vps.software.com mysqld[416488]: 2024-07-06 19:29:19 0 [Note] InnoDB: Buffer pool(s) load completed at 240706 19:29:19
Jul 06 19:29:19 vps.software.com mysqld[416488]: 2024-07-06 19:29:19 0 [Note] Server socket created on IP: '::'.
Jul 06 19:29:19 vps.software.com mysqld[416488]: 2024-07-06 19:29:19 0 [Note] Reading of all Master_info entries succeeded
Jul 06 19:29:19 vps.software.com mysqld[416488]: 2024-07-06 19:29:19 0 [Note] Added new Master_info '' to hash table
Jul 06 19:29:19 vps.software.com mysqld[416488]: 2024-07-06 19:29:19 0 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Jul 06 19:29:19 vps.software.com mysqld[416488]: Version: '10.4.34-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
Jul 06 19:29:19 vps.software.com systemd[1]: Started MySQL database server.
Jul 06 19:29:37 vps.software.com mysqld[416488]: 2024-07-06 19:29:37 8 [Warning] Access denied for user 'root'@'localhost' (using password: NO)
Jul 06 19:39:57 vps.software.com mysqld[416488]: 2024-07-06 19:39:57 9 [Warning] Access denied for user 'root'@'localhost' (using password: NO)

Code:
# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): <enter>
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Enter current password for root (enter for none):

I don't know the password, because it's never been set.

Code:
# mysql -u root -p
Enter password:
 
Last edited:
the problem is csf fail to installing, that's why other service not install or not config correctly.

try simple check with thess command.
Code:
stat /sbin/iptables
stat /usr/sbin/iptables
which iptables

in case if second command found the binary file. you might need to create symlink from "/sbin/" into "/usr/sbin"
 
don't know the password, because it's never been set.
Use this command:

Code:
mysql --defaults-extra-file=/usr/local/directadmin/conf/my.cnf

Als did you try:
Code:
#uninstall csf
/etc/csf//uninstall.sh

#and reinstall
da build update
da build csf

If you want to know the root user password for the mysql server check your directadmin build log there during build the root password is given.

Also check your socket with:

Code:
mysql_config --socket

or:
Code:
ps aux | grep mysql

Is it running on a socket?

Check also if your host file contains your 127.0.0.1 localhost entry.
check with:
Code:
cat /etc/hosts
if the 127.0.0.1 is not there add it like this:
Code:
127.0.0.1 localhost

When you know your socket path on Debian/Ubuntu you need to put the socket in the my.cnf file under [mysqld]
Example:

Code:
[mysqld]
socket=/var/lib/mysql-socket/mysql.sock
 
Last edited:
Code:
stat /sbin/iptables
stat: cannot statx '/sbin/iptables': No such file or directory

Code:
stat /usr/sbin/iptables
  File: /usr/sbin/iptables -> /etc/alternatives/iptables
  Size: 26            Blocks: 0          IO Block: 4096   symbolic link
Device: 7820b6e1h/2015409889d    Inode: 404698      Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2024-07-07 10:25:18.588317292 -0400
Modify: 2021-12-01 13:01:25.825413888 -0500
Change: 2021-12-01 13:01:25.826413900 -0500
 Birth: -

in case if second command found the binary file. you might need to create symlink from "/sbin/" into "/usr/sbin"
Just to be sure ... you are suggesting a symlink from /sbin/iptables to /usr/sbin/iptables ?
 
yes, anyway you want, but some other service might use "/sbin/" instead of "/usr/sbin".

so fully symlink directory could fixed the problem in the future.
 
Use this command:

Code:
mysql --defaults-extra-file=/usr/local/directadmin/conf/my.cnf

Als did you try:
Code:
#uninstall csf
/etc/csf//uninstall.sh

#and reinstall
da build update
da build csf

If you want to know the root user password for the mysql server check your directadmin build log there during build the root password is given.

Also check your socket with:

Code:
mysql_config --socket

or:
Code:
ps aux | grep mysql

Is it running on a socket?

Check also if your host file contains your 127.0.0.1 localhost entry.
check with:
Code:
cat /etc/hosts
if the 127.0.0.1 is not there add it like this:
Code:
127.0.0.1 localhost
@Stije Interesting, your whole post did not show up until I attempted to reply. (Looking your suggestions over and will reply shortly)
 
MySQL

Found the root password in da build update_versions log. (It would be nice if somewhere, someone would alert to look for this!)

I seem to be able to be to gain access and query.

Apparently this issue is fixed.

Although, I must admit that my my.cnf is different:
Code:
# cat /etc/my.cnf
[mysql]
socket = /usr/local/mysql/data/mysql.sock

[mysqld]
max_allowed_packet=64M
local-infile=1
socket = /usr/local/mysql/data/mysql.sock
innodb_file_per_table

[client]
socket=/usr/local/mysql/data/mysql.sock

[mysqldump]
socket = /usr/local/mysql/data/mysql.sock

What do you think about this?

---------

Still working on CSF ....
 
your mysql is running you see it because this:
Code:
systemctl status mysqld

Showed a running server. So you are running mariadb on debian. If you want to do mysql safe you need to do:

mariadb-secure-installation

Also that is why mysql_secure_installation is not doing anything as you do not have mysql but mariadb. So than you won't need to edit any files because it is logical your commands did not work

before editting try mariadb-secure-installation first to check if it works
 
@Stije /etc/hosts does not have 127.0.0.1

Code:
# cat /etc/hosts
108.160.145.54    vps.software.com vps
::1    localhost ip6-localhost ip6-loopback
ff02::1    ip6-allnodes
ff02::2    ip6-allrouters

# Auto-generated hostname. Please do not remove this comment.
108.160.145.54 vps.software.com vps
 
@Stije Thank you for your continued support. I tried to run mariadb-secure-installation and enter the root password, but something must be wrong in configuration.

Code:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
 
108.160.145.54 vps.software.com vps
You have this one duplicated, because it's autogenerated too. So you can remove the one you made yourself.

I fully agree with @Stije on the localhost for 127.0.0.1 as several things rely on that.

Mine is like this:
Code:
127.0.0.1 localhost.localdomain localhost
195.xxx.xxx.xxx  server.mydomain.nl server
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
2a01:xxx:xxx:xxx server.mydomain.nl server

So I also never use the "localhost" on the ipv6 but use ip6-localhost instead.

As for that CSF installation, that should be correct, I never had issues with that on Debian 11, so I wonder why that is happening.
You might want to send a ticket to DA about that so future installations will work flawlessly again.
Just to be sure ... you are suggesting a symlink from /sbin/iptables to /usr/sbin/iptables
I would check first how it looks.
Because on Alma 8 and Alma 9 iptables is already present in /usr/sbin/iptables, my outputs were the same as yours.

And in /sbin/iptables there are already symlinks, but they are a bit different, it looks like this:
Code:
lrwxrwxrwx.  1 root root   26 2023-09-10 06:18 iptables -> /etc/alternatives/iptables
lrwxrwxrwx   1 root root   17 2024-04-03 12:33 iptables-nft -> xtables-nft-multi
lrwxrwxrwx   1 root root   17 2024-04-03 12:33 iptables-nft-restore -> xtables-nft-multi
lrwxrwxrwx   1 root root   17 2024-04-03 12:33 iptables-nft-save -> xtables-nft-multi
lrwxrwxrwx.  1 root root   34 2023-09-10 06:18 iptables-restore -> /etc/alternatives/iptables-restore
lrwxrwxrwx   1 root root   17 2024-04-03 12:33 iptables-restore-translate -> xtables-nft-multi
lrwxrwxrwx.  1 root root   31 2023-09-10 06:18 iptables-save -> /etc/alternatives/iptables-save
lrwxrwxrwx   1 root root   17 2024-04-03 12:33 iptables-translate -> xtables-nft-multi
As you can see, iptables is linked to /etc/alternatives/iptables and not to /usr/sbin.

And in /etc/alternatives it's linked to:
lrwxrwxrwx. 1 root root 22 2023-09-10 06:18 iptables -> /usr/sbin/iptables-nft

So if you want to make a symlink, you might need to make it to/from /etc/alternatives/iptables and not from /usr/sbin/iptables.
I can't doublecheck for you, don't run Debian anymore.
 
Can you check if mariadb-common is installed via apt? If yes, remove it, restart vps and try again.
This was what caused the issue in my case with Debian at that time I was puzzled with the odd things in Debian.
 
Back
Top