Page 1 of 1

MariaDB - I cannot stop the service

Posted: Fri Nov 08, 2024 11:47 am
by wellsey
On my recent clean install of mx23.4 I installed the local server (lamp) under the Server option of MXPI's popular packages tab. However I dont seem to be able to stop it and restart it.

Code: Select all

$ ps aux |grep mariadb
mysql       2641  0.0  2.9 1275268 230620 ?      Sl   16:05   0:00 /usr/sbin/mariadbd --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-log-error --pid-file=/run/mysqld/mysqld.pid --socket=/run/mysqld/mysqld.sock
steve       4917  0.0  0.0  75660  2188 pts/2    S+   16:08   0:00 grep mariadb

Code: Select all

$ sudo service mariadb stop
[sudo] password for steve:         
Stopping MariaDB database server: mariadbd failed!

$ sudo  /etc/init.d/mariadb stop
Stopping MariaDB database server: mariadbd failed!

Code: Select all

$ sudo ls -hal /var/run/mysqld/
total 4.0K
drwxr-xr-x  2 mysql root    80 Nov  8 16:05 .
drwxr-xr-x 34 root  root  1.2K Nov  8 16:08 ..
-rw-rw----  1 mysql mysql    5 Nov  8 16:05 mysqld.pid
srwxrwxrwx  1 mysql mysql    0 Nov  8 16:05 mysqld.sock
There does not appear to be any Mysql/MariaDB log file in /var/log/

I have tried pkill but on looking it is still running

Code: Select all

$ sudo pkill  -9 2641
steve@mx-laptop:~
$ ps aux |grep mariadb
mysql       2641  0.0  3.0 1275268 239032 ?      Sl   16:05   0:00 /usr/sbin/mariadbd --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-log-error --pid-file=/run/mysqld/mysqld.pid --socket=/run/mysqld/mysqld.sock
steve       6840  0.0  0.0  75660  2304 pts/2    S+   16:34   0:00 grep mariadb
Any ideas ? Is something restarting it?


Code: Select all

Snapshot created on: 20241029_1714
System:
  Kernel: 6.1.0-26-amd64 [6.1.112-1] arch: x86_64 bits: 64 compiler: gcc v: 12.2.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-6.1.0-26-amd64 root=UUID=<filter> ro quiet splash
  Desktop: Xfce v: 4.18.1 tk: Gtk v: 3.24.36 info: xfce4-panel wm: xfwm v: 4.18.0 vt: 7
    dm: LightDM v: 1.26.0 Distro: MX-23.4_x64 Libretto September 15  2024 base: Debian GNU/Linux 12
    (bookworm)
Machine:
  Type: Laptop System: Dell product: Latitude E4310 v: 0001 serial: <superuser required> Chassis:
    type: 9 serial: <superuser required>
  Mobo: Dell model: 0D8H24 v: A00 serial: <superuser required> BIOS: Dell v: A06 date: 02/15/2011
Battery:
  ID-1: BAT0 charge: 15.4 Wh (57.5%) condition: 26.8/48.8 Wh (55.0%) volts: 12.0 min: 11.1
    model: SMP DELL 9H41496 type: Li-ion serial: <filter> status: charging
CPU:
  Info: model: Intel Core i5 M 560 bits: 64 type: MT MCP arch: Westmere gen: core 1 level: v2
    built: 2010-11 process: Intel 32nm family: 6 model-id: 0x25 (37) stepping: 5 microcode: 0x7
  Topology: cpus: 1x cores: 2 tpc: 2 threads: 4 smt: enabled cache: L1: 128 KiB
    desc: d-2x32 KiB; i-2x32 KiB L2: 512 KiB desc: 2x256 KiB L3: 3 MiB desc: 1x3 MiB
  Speed (MHz): avg: 1246 high: 1307 min/max: 1199/2667 boost: enabled scaling:
    driver: acpi-cpufreq governor: ondemand cores: 1: 1307 2: 1198 3: 1261 4: 1221 bogomips: 21280
  Flags: ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable
  Type: mds status: Vulnerable: Clear CPU buffers attempted, no microcode; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data status: Unknown: No mitigations
  Type: reg_file_data_sampling status: Not affected
  Type: retbleed status: Not affected
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: Retpolines; IBPB: conditional; IBRS_FW; STIBP: conditional; RSB
    filling; PBRSB-eIBRS: Not affected; BHI: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel Core Processor Integrated Graphics vendor: Dell driver: i915 v: kernel
    arch: Gen-5.75 process: Intel 45nm built: 2010 ports: active: HDMI-A-1,eDP-1 empty: DP-1, DP-2,
    HDMI-A-2, VGA-1 bus-ID: 00:02.0 chip-ID: 8086:0046 class-ID: 0300
  Device-2: Primax Dell Laptop Integrated Webcam 2Mpix type: USB driver: uvcvideo bus-ID: 1-1.4:5
    chip-ID: 0461:4db1 class-ID: 0e02
  Display: x11 server: X.Org v: 1.21.1.7 compositor: xfwm v: 4.18.0 driver: X: loaded: intel
    dri: crocus gpu: i915 display-ID: :0.0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22") s-diag: 582mm (22.93")
  Monitor-1: HDMI-A-1 mapped: HDMI1 model: Samsung T24D390 built: 2013 res: 1920x1080 hz: 60
    dpi: 94 gamma: 1.2 size: 520x290mm (20.47x11.42") diag: 598mm (23.5") ratio: 16:9 modes:
    max: 1920x1080 min: 720x400
  Monitor-2: eDP-1 mapped: eDP1 pos: primary model: LG Display 0x024d built: 2010 res: 1913x1076
    hz: 60 dpi: 168 gamma: 1.2 size: 290x170mm (11.42x6.69") diag: 338mm (13.3") ratio: 16:9
    modes: 1366x768
  API: OpenGL v: 2.1 Mesa 22.3.6 renderer: Mesa Intel HD Graphics (ILK) direct-render: Yes
Audio:
  Device-1: Intel 5 Series/3400 Series High Definition Audio vendor: Dell 5 driver: snd_hda_intel
    v: kernel bus-ID: 00:1b.0 chip-ID: 8086:3b57 class-ID: 0403
  API: ALSA v: k6.1.0-26-amd64 status: kernel-api tools: alsamixer,amixer
  Server-1: PipeWire v: 1.0.0 status: active with: 1: pipewire-pulse status: active
    2: wireplumber status: active 3: pipewire-alsa type: plugin 4: pw-jack type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel 82577LM Gigabit Network vendor: Dell driver: e1000e v: kernel port: 6040
    bus-ID: 00:19.0 chip-ID: 8086:10ea class-ID: 0200
  IF: eth0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Device-2: Intel Centrino Advanced-N 6200 driver: iwlwifi v: kernel modules: wl pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 bus-ID: 02:00.0 chip-ID: 8086:422c class-ID: 0280
  IF: wlan0 state: down mac: <filter>
Bluetooth:
  Device-1: Dell DW375 Bluetooth Module type: USB driver: btusb v: 0.8 bus-ID: 2-1.7:3
    chip-ID: 413c:8187 class-ID: fe01 serial: <filter>
  Report: hciconfig ID: hci0 rfk-id: 3 state: up address: <filter> bt-v: 2.0 lmp-v: 3.0
    sub-v: 4203 hci-v: 3.0 rev: 205
  Info: acl-mtu: 1021:8 sco-mtu: 64:1 link-policy: rswitch hold sniff park
    link-mode: peripheral accept service-classes: rendering, capturing, object transfer, audio,
    telephony
RAID:
  Hardware-1: Intel 82801 Mobile SATA Controller [RAID mode] driver: ahci v: 3.0 port: 6020
    bus-ID: 00:1f.2 chip-ID: 8086:282a rev: N/A class-ID: 0104
Drives:
  Local Storage: total: 223.57 GiB used: 40.61 GiB (18.2%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: SanDisk model: SDSSDA240G size: 223.57 GiB block-size:
    physical: 512 B logical: 512 B speed: 3.0 Gb/s type: SSD serial: <filter> rev: 70RL scheme: MBR
Partition:
  ID-1: / raw-size: 176.7 GiB size: 172.86 GiB (97.83%) used: 40.61 GiB (23.5%) fs: ext4
    dev: /dev/sda2 maj-min: 8:2
Swap:
  Kernel: swappiness: 15 (default 60) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 8.79 GiB used: 0 KiB (0.0%) priority: -2 dev: /dev/sda1
    maj-min: 8:1
Sensors:
  System Temperatures: cpu: 55.0 C mobo: N/A sodimm: SODIMM C
  Fan Speeds (RPM): cpu: 3081
Repos:
  Packages: pm: dpkg pkgs: 2155 libs: 1060 tools: apt,apt-get,aptitude,nala,synaptic pm: rpm
    pkgs: 0 pm: flatpak pkgs: 0
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/brave-browser-release.list
    1: deb [arch=amd64 signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main
  Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list
    1: deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/debian.list
    1: deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
    2: deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/microsoft-edge.list
    1: deb [arch=amd64] https://packages.microsoft.com/repos/edge/ stable main
  Active apt repos in: /etc/apt/sources.list.d/mx.list
    1: deb http://mxlinux.mirrors.uk2.net/packages/mx/repo/ bookworm main non-free
  Active apt repos in: /etc/apt/sources.list.d/vscode.list
    1: deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/repos/code stable main
Info:
  Processes: 234 Uptime: 27m wakeups: 2 Memory: 7.56 GiB used: 2.28 GiB (30.2%) Init: SysVinit
  v: 3.06 runlevel: 5 default: graphical tool: systemctl Compilers: gcc: 12.2.0 alt: 12
  Client: shell wrapper v: 5.2.15-release inxi: 3.3.26
Boot Mode: BIOS (legacy, CSM, MBR)

Re: MariaDB - I cannot stop the service

Posted: Fri Nov 08, 2024 12:00 pm
by CharlesV
Try using the mysql instead.

Code: Select all

sudo service mysql stop


Re: MariaDB - I cannot stop the service

Posted: Fri Nov 08, 2024 1:06 pm
by wellsey
CharlesV wrote: Fri Nov 08, 2024 12:00 pm Try using the mysql instead.

Code: Select all

sudo service mysql stop

I forgot to mention i have tried that

Code: Select all

$ sudo service mysql stop
[sudo] password for steve:         
mysql: unrecognized service

Re: MariaDB - I cannot stop the service

Posted: Fri Nov 08, 2024 1:16 pm
by CharlesV
hmm.. try mongod

sudo service mongod status

Re: MariaDB - I cannot stop the service

Posted: Sat Nov 09, 2024 10:00 am
by wellsey
Again "unrecognised service"

Re: MariaDB - I cannot stop the service

Posted: Sat Nov 09, 2024 10:09 am
by dolphin_oracle
I believe the commands in the original post are the correct service names, but they do not work, for whatever reason. maybe something else needs closed down first? I really don't know much about the LAMP stack.

Re: MariaDB - I cannot stop the service

Posted: Sat Nov 09, 2024 11:09 am
by wellsey
dolphin_oracle wrote: Sat Nov 09, 2024 10:09 am I believe the commands in the original post are the correct service names, but they do not work, for whatever reason. maybe something else needs closed down first? I really don't know much about the LAMP stack.
Yes they are correct, I think this was what was really being suggested

Code: Select all

$ sudo service mariadb status
[sudo] password for steve:         
/usr/bin/mariadb-admin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
and Chatgpt tells me that the 'status' option accesses the database not just the service - and there are ways to configure that but I dont see a reason to I can see the process running. Chatgpt suggested pkilling then removing the .pid file - I did that to no avail

Re: MariaDB - I cannot stop the service

Posted: Sat Nov 09, 2024 11:24 am
by CharlesV
What version of mariadb is loaded?

Have you tried directly shutting it down with the mariadb-admin command?
https://mariadb.com/kb/en/mariadb-admin/
https://mariadb.com/kb/en/shutdown/

In my installs I have to use mongod or mysql to shut the service down, and have only ever used those.

Re: MariaDB - I cannot stop the service

Posted: Sat Nov 09, 2024 1:32 pm
by aika
wellsey wrote: Fri Nov 08, 2024 11:47 am...

Code: Select all

$ sudo service mariadb stop
[sudo] password for steve:         
Stopping MariaDB database server: mariadbd failed!
...
Was MariaDB started correctly under SysVinit? I would start the MX system as SystemD and test whether MariaDB then behaves correctly:

Code: Select all

sudo systemctl stop mariadb
MariaDB with SysVinit => https://mariadb.com/kb/en/sysvinit/#int ... er-process
MariaDB with SystemD => https://mariadb.com/kb/en/systemd/#inte ... er-process

Re: MariaDB - I cannot stop the service

Posted: Sat Nov 09, 2024 3:55 pm
by timkb4cq
Have you tried using kill instead of pkill? pkill sends a message to the process. kill -9 just terminates it.

Re: MariaDB - I cannot stop the service

Posted: Sun Nov 10, 2024 11:12 am
by wellsey
timkb4cq wrote: Sat Nov 09, 2024 3:55 pm Have you tried using kill instead of pkill? pkill sends a message to the process. kill -9 just terminates it.
Thanks for that, tried it 'kill' does live up to its name, 'pkill' did not

Re: MariaDB - I cannot stop the service

Posted: Sun Nov 10, 2024 11:24 am
by wellsey
aika wrote: Sat Nov 09, 2024 1:32 pm
Was MariaDB started correctly under SysVinit? I would start the MX system as SystemD and test whether MariaDB then behaves correctly:

Code: Select all

sudo systemctl stop mariadb
MariaDB with SysVinit => https://mariadb.com/kb/en/sysvinit/#int ... er-process
MariaDB with SystemD => https://mariadb.com/kb/en/systemd/#inte ... er-process
Good idea to try SystemD - and it works correctly in SystemD ie the systemctl command will start/stop/restart ( even status command produces information but not complete info as a DB password is not given )

So maybe the conclusion is the install from MXPI under SysVinit was not properly done?

Re: MariaDB - I cannot stop the service  [Solved]

Posted: Sun Nov 10, 2024 11:59 am
by wellsey
CharlesV wrote: Sat Nov 09, 2024 11:24 am What version of mariadb is loaded?

Have you tried directly shutting it down with the mariadb-admin command?
https://mariadb.com/kb/en/mariadb-admin/
https://mariadb.com/kb/en/shutdown/

In my installs I have to use mongod or mysql to shut the service down, and have only ever used those.
I used Popular packages under the Server tab of MXPI and it iinstalled mariadb 10.11

Thank YOU , Your suggestion of

Code: Select all

 mariadb-admin shutdown
WORKED and because the command allows the use of a password

Code: Select all

  sudo mariadb-admin -pmypassword status
Uptime: 867  Threads: 1  Questions: 2  Slow queries: 0  Opens: 17  Open tables: 10  Queries per second avg: 0.002
also worked

( command mysqladmin worked just the same BTW)

I can understand the need for a special command to cope with the controlled shutting down of replication to slaves, but in my situation of not using replication I would have thought that a simple stop of the service should work in SysVinit just as it did under SystemD

Any way this seems to have solved it I will mark it so - Thanks to all who posted

Re: MariaDB - I cannot stop the service

Posted: Sun Nov 10, 2024 12:05 pm
by CharlesV
Excellent! Glad you have it resolved.

Re: MariaDB - I cannot stop the service

Posted: Sun Nov 10, 2024 12:22 pm
by fehlix
wellsey wrote: Sun Nov 10, 2024 11:24 am So maybe the conclusion is the install from MXPI under SysVinit was not properly done?
Not sure, installed with running sysvinit, and testing start,stop status:
Status:

Code: Select all

sudo service mariadb status
/usr/bin/mariadb-admin  Ver 9.1 Distrib 10.11.6-MariaDB, for debian-linux-gnu on x86_64
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Server version      10.11.6-MariaDB-0+deb12u1
Protocol version    10
Connection      Localhost via UNIX socket
UNIX socket     /run/mysqld/mysqld.sock
Uptime:         11 sec

Threads: 1  Questions: 61  Slow queries: 0  Opens: 33  Open tables: 26  Queries per second avg: 5.545.
Stop:

Code: Select all

sudo service mariadb stop
Stopping MariaDB database server: mariadbd.
Status:

Code: Select all

sudo service mariadb status
MariaDB is stopped..
Start:

Code: Select all

sudo service mariadb start
Starting MariaDB database server: mariadbd.
Status again:

Code: Select all

sudo service mariadb status
/usr/bin/mariadb-admin  Ver 9.1 Distrib 10.11.6-MariaDB, for debian-linux-gnu on x86_64
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Server version      10.11.6-MariaDB-0+deb12u1
Protocol version    10
Connection      Localhost via UNIX socket
UNIX socket     /run/mysqld/mysqld.sock
Uptime:         7 sec

Threads: 1  Questions: 61  Slow queries: 0  Opens: 33  Open tables: 26  Queries per second avg: 8.714.
Works all as it should be.

Re: MariaDB - I cannot stop the service

Posted: Sun Nov 10, 2024 12:30 pm
by CharlesV
From what I read in the mariadb KB, some applications using the DB will lock a table or record and then the ONLY method of shutting the DB down is with either the kill command or that admin shutdown.

I have not seen any of these in my installs, but I am primarily using Unifi Controllers or very simple DB apps.

Re: MariaDB - I cannot stop the service

Posted: Sun Nov 10, 2024 1:09 pm
by fehlix
CharlesV wrote: Sun Nov 10, 2024 12:30 pm From what I read in the mariadb KB, some applications using the DB will lock a table or record and then the ONLY method of shutting the DB down is with either the kill command or that admin shutdown.

I have not seen any of these in my installs, but I am primarily using Unifi Controllers or very simple DB apps.
Yes, that's correct, and that's init-script and systemd service to stop are doing:

Code: Select all

sudo service mariadb stop
is doing
look here into the init scrpt:

Code: Select all

grep shutdown /etc/init.d/mariadb 
    shutdown_out=`$MYADMIN shutdown 2>&1`; r=$?
      [ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out"

Re: MariaDB - I cannot stop the service

Posted: Sun Nov 10, 2024 1:27 pm
by CharlesV
it would seem so.. but it appears something is a little different between the two.