tmux - connect failed: Connection refused - tmux

I want to use tmux on rhel 7. I do not have root rights on this machine, so I build it from sources by following the procedure here: https://jdhao.github.io/2018/10/16/tmux_build_without_root_priviledge/.
I have built and installed locally libevent 2.1.8, ncurses 6.1 and tmux 2.8. They are all installed in ~/local.
When I launch tmux, it does not start. the message I get is:
[exited]
I started again with the option -vv and I get the logs.
On server side, I get:
1552914150.215313 server started (1698): version 2.8, socket /tmp/tmux-130772/default, protocol 8
1552914150.215360 on Linux 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015; libevent 2.1.8-stable (poll)
1552914150.224069 bind-key: argv[0]=bind
...
1552914150.293655 cmd_find_from_session_window: s=$0 0
1552914150.293661 cmd_find_from_session_window: wl=0 1 w=#0 ksh
1552914150.293666 cmd_find_from_session_window: wp=none
1552914150.293671 cmd_find_from_session_window: idx=0
1552914150.293677 session_add_ref: 0 notify_add, now 4
1552914150.293682 window_add_ref: #0 notify_add, now 3
1552914150.293687 session_add_ref: 0 notify_add, now 5
1552914150.293694 window_remove_ref: #0 winlink_remove, now 2
1552914150.293700 session 0 destroyed (session_detach)
1552914150.293706 cmd_find_best_session: 0 sessions to try
1552914150.293712 session_add_ref: 0 notify_add, now 6
1552914150.293719 session_remove_ref: 0 session_destroy, now 5
1552914150.293731 cmdq_next <global>: enter
1552914150.293744 cmdq_next <global>: callback[notify_callback] (1), flags 0
1552914150.293750 notify_callback: pane-exited
1552914150.293756 cmd_find_best_session: 0 sessions to try
1552914150.293761 session_remove_ref: 0 notify_callback, now 4
1552914150.293768 cmdq_next <global>: callback[notify_callback] (1), flags 0
1552914150.293773 notify_callback: window-layout-changed
1552914150.293779 cmd_find_best_session: 0 sessions to try
1552914150.293784 window_remove_ref: #0 notify_callback, now 1
1552914150.293790 session_remove_ref: 0 notify_callback, now 3
1552914150.293795 cmdq_next <global>: callback[notify_callback] (1), flags 0
1552914150.293800 notify_callback: window-unlinked
1552914150.293806 cmd_find_best_session: 0 sessions to try
1552914150.293811 session_remove_ref: 0 notify_callback, now 2
1552914150.293817 window_remove_ref: #0 notify_callback, now 0
1552914150.293822 window #0 destroyed (0 references)
1552914150.293828 session_remove_ref: 0 notify_callback, now 1
1552914150.293834 cmdq_next <global>: callback[notify_callback] (1), flags 0
1552914150.293839 notify_callback: session-closed
1552914150.293845 cmd_find_best_session: 0 sessions to try
1552914150.293851 session_remove_ref: 0 notify_callback, now 0
1552914150.293859 cmdq_next <global>: exit (empty)
1552914150.293865 cmdq_next <0x2363520>: empty
1552914150.293870 cmdq_next <global>: empty
1552914150.293875 cmdq_next <0x2363520>: empty
1552914150.293881 cmd_find_best_session: 0 sessions to try
1552914150.293889 sending message 203 to peer 0x2363d60 (4 bytes)
1552914150.293903 session 0 freed (0 references)
1552914150.293922 cmdq_next <global>: enter
1552914150.293930 cmdq_next <global>: callback[notify_callback] (1), flags 0
1552914150.293935 notify_callback: client-detached
1552914150.293941 cmd_find_best_session: 0 sessions to try
1552914150.293947 unref client 0x2363520 (2 references)
1552914150.293952 cmdq_next <global>: exit (empty)
1552914150.293957 cmdq_next <0x2363520>: empty
1552914150.293962 cmdq_next <global>: empty
1552914150.293967 cmdq_next <0x2363520>: empty
1552914150.302142 peer 0x2363d60 message 205
1552914150.302286 sending message 204 to peer 0x2363d60 (0 bytes)
1552914150.302301 cmdq_next <global>: empty
1552914150.302308 cmdq_next <0x2363520>: empty
1552914150.302333 cmdq_next <global>: empty
1552914150.302340 cmdq_next <0x2363520>: empty
1552914150.311857 lost client 0x2363520
1552914150.311902 remove peer 0x2363d60
1552914150.311935 unref client 0x2363520 (1 references)
1552914150.311975 free client 0x2363520 (0 references)
1552914150.311988 cmdq_next <global>: empty
1552914150.312000 server loop exit
On clients side:
1552914150.208220 client started (1696): version 2.8, socket /tmp/tmux-130772/default, protocol 8
1552914150.208308 on Linux 3.10.0-327.el7.x86_64 #1 SMP Thu Oct 29 17:29:29 EDT 2015; libevent 2.1.8-stable (poll)
1552914150.208351 socket is /tmp/tmux-130772/default
1552914150.208370 trying connect
1552914150.208401 connect failed: Connection refused
1552914150.208419 lock file is /tmp/tmux-130772/default.lock
1552914150.208478 flock succeeded
1552914150.208486 got lock (6)
1552914150.208495 trying connect
1552914150.208509 connect failed: Connection refused
1552914150.208779 add peer 0x23302e0: 7 ((nil))
...
The only thing I can see is that the client cannot connect the socket. I did not notice any error on server side.
I would know to understand what prevents tmux from starting normally.

A detailed analysis showed that the default shell used by tmux was exiting with an error on my environment.
I solved issue by forcing the use of another shell. I put this in .tmux.conf: set-option -g default-shell /bin/zsh.

Related

ceph cluster installed in K8S admin password is incorrect

I've installed ceph cluster in K8S using Rook, the service is running fine and PV/PVC is working as expected.
I was able to login to the dashboard once, but after a while the password is incorrect.
I used the command to display the password but it is still incorrect.
kubectl -n kubernetes-dashboard get secret $(kubectl -n kubernetes-dashboard get sa/admin-user -o jsonpath="{.secrets[0].name}") -o go-template="{{.data.token | base64decode}}"
No obvious error message from the pod
k logs -n rook-ceph rook-ceph-mgr-a-547f75956-c5f9t
debug 2022-02-05T00:09:14.144+0000 ffff58661400 0 log_channel(cluster) log [DBG] : pgmap v367973: 96 pgs: 45 active+undersized+degraded, 51 active+undersized; 649 MiB data, 2.8 GiB used, 197 GiB / 200 GiB avail; 767 B/s rd, 1 op/s; 239/717 objects degraded (33.333%)
debug 2022-02-05T00:09:16.144+0000 ffff58661400 0 log_channel(cluster) log [DBG] : pgmap v367974: 96 pgs: 45 active+undersized+degraded, 51 active+undersized; 649 MiB data, 2.8 GiB used, 197 GiB / 200 GiB avail; 1.2 KiB/s rd, 2 op/s; 239/717 objects degraded (33.333%)
debug 2022-02-05T00:09:16.784+0000 ffff53657400 0 [progress INFO root] Processing OSDMap change 83..83
debug 2022-02-05T00:09:17.684+0000 ffff44bba400 0 [volumes INFO mgr_util] scanning for idle connections..
debug 2022-02-05T00:09:17.684+0000 ffff44bba400 0 [volumes INFO mgr_util] cleaning up connections: []
debug 2022-02-05T00:09:17.860+0000 ffff3da6c400 0 [volumes INFO mgr_util] scanning for idle connections..
debug 2022-02-05T00:09:17.860+0000 ffff3da6c400 0 [volumes INFO mgr_util] cleaning up connections: []
debug 2022-02-05T00:09:17.988+0000 ffff40b72400 0 [volumes INFO mgr_util] scanning for idle connections..
debug 2022-02-05T00:09:17.988+0000 ffff40b72400 0 [volumes INFO mgr_util] cleaning up connections: []
debug 2022-02-05T00:09:18.148+0000 ffff58661400 0 log_channel(cluster) log [DBG] : pgmap v367975: 96 pgs: 45 active+undersized+degraded, 51 active+undersized; 649 MiB data, 2.8 GiB used, 197 GiB / 200 GiB avail; 767 B/s rd, 1 op/s; 239/717 objects degraded (33.333%)
debug 2022-02-05T00:09:20.148+0000 ffff58661400 0 log_channel(cluster) log [DBG] : pgmap v367976: 96 pgs: 45 active+undersized+degraded, 51 active+undersized; 649 MiB data, 2.8 GiB used, 197 GiB / 200 GiB avail; 1.2 KiB/s rd, 2 op/s; 239/717 objects degraded (33.333%)
debug 2022-02-05T00:09:21.788+0000 ffff53657400 0 [progress INFO root] Processing OSDMap change 83..83
debug 2022-02-05T00:09:22.144+0000 ffff58661400 0 log_channel(cluster) log [DBG] : pgmap v367977: 96 pgs: 45 active+undersized+degraded, 51 active+undersized; 649 MiB data, 2.8 GiB used, 197 GiB / 200 GiB avail; 853 B/s rd, 1 op/s; 239/717 objects degraded (33.333%)
debug 2022-02-05T00:09:23.188+0000 ffff5765f400 0 [balancer INFO root] Optimize plan auto_2022-02-05_00:09:23
debug 2022-02-05T00:09:23.188+0000 ffff5765f400 0 [balancer INFO root] Mode upmap, max misplaced 0.050000
debug 2022-02-05T00:09:23.188+0000 ffff5765f400 0 [balancer INFO root] Some objects (0.333333) are degraded; try again later
ubuntu#:~$
No events from the namespace
ubuntu#df1:~$ k get events -n rook-ceph
No resources found in rook-ceph namespace.
It seems like one can use the cephadm command to reset the password, but how can I login to the pod as a root user?
ceph dashboard ac-user-set-password USERNAME PASSWORD
This cephadm command can't be executed as non-root user:
ubuntu#:~$ k exec -it rook-ceph-tools-7884798859-7vcnz -n rook-ceph -- bash
[rook#rook-ceph-tools-7884798859-7vcnz /]$ cephadm
ERROR: cephadm should be run as root
[rook#rook-ceph-tools-7884798859-7vcnz /]$
I just ran "ceph dashboard ac-user-set-password admin -i 'File with password'" and my password changed.
I dont think cephadm works when execing into the pod.

Permissions error in WordPress setup with Mariadb + NGINX and custom php-fpm Dockerfile

I'm trying to configure a WordPress installation based on docker-compose and with official docker images and a custom Dockerfile based image for the php-fpm part.
The docker-compose is like follows:
docker-compose.yml:
-------------------
# MariaDB - MySQL Database
mariadb:
container_name: mariadb
image: linuxserver/mariadb:latest
restart: always
security_opt:
- no-new-privileges:true
ports:
- "3306:3306"
secrets:
- mysql_root_password
volumes:
- /home/docker/mariadb/data:/config
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
healthcheck:
test: mysqladmin ping -h localhost -p$$MYSQL_ROOT_PASSWORD && test '0' -eq $$(ps aux | awk '{print $$11}' | grep -c -e '^mysql$$')
environment:
- PUID=1000
- PGID=998
- TZ=Europe/Madrid
- MYSQL_ALLOW_EMPTY_PASSWORD=no
- FILE__MYSQL_ROOT_PASSWORD=/run/secrets/mysql_root_password
- MYSQL_USER=wordpress
- MYSQL_PASSWORD=wordpress
- MYSQL_DATABASE=wordpress
secrets:
- mysql_root_password
# Nginx - Web Server
nginx:
container_name: nginx
image: nginx:1.18
restart: unless-stopped
depends_on:
- php7
healthcheck:
test: pidof nginx
networks:
- t2_proxy
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- /var/log/nginx:/var/log/nginx
- /home/docker/nginx:/etc/nginx
- /home/docker/shared/.htpasswd:/shared/.htpasswd
- /home/docker/sites/wordpress/html:/var/www/html/wordpress
labels:
- "traefik.enable=true"
## HTTP Routers (WordPress) Auth
- "traefik.http.routers.nginx-wordpress-auth-rtr.entrypoints=https"
- "traefik.http.routers.nginx-wordpress-auth-rtr.rule=Host(`example.com`) && Path(`/wp-login.php`)"
- "traefik.http.routers.nginx-wordpress-rtr.tls=true"
- "traefik.http.routers.nginx-wordpress-auth-rtr.priority=100"
## HTTP Routers (WordPress) Bypass
- "traefik.http.routers.nginx-wordpress-rtr.entrypoints=https"
- "traefik.http.routers.nginx-wordpress-rtr.rule=Host(`example.com`) || Host(`www.example.com`)"
- "traefik.http.routers.nginx-wordpress-rtr.priority=99"
# Redirect wordpress non-www to www middleware
- "traefik.http.middlewares.wordpress-redirect.redirectregex.regex=^https?://www.example.com/(.*)"
- "traefik.http.middlewares.wordpress-redirect.redirectregex.replacement=https://example.com/$${1}"
- "traefik.http.middlewares.wordpress-redirect.redirectregex.permanent=true"
## Middlewares
- "traefik.http.routers.nginx-wordpress-rtr.middlewares=wordpress-redirect,chain-no-auth-wp#file"
- "traefik.http.routers.nginx-wordpress-auth-rtr.middlewares=wordpress-redirect,chain-authelia#file"
# PHP - Hypertext Preprocessor
php7:
container_name: php7
image: php:7.4-fpm-custom
build:
context: /home/docker/custom/
dockerfile: Dockerfile-php7
restart: unless-stopped
healthcheck:
test: pidof php-fpm
user: 1000:998 # allows upgrading WP and plugins
networks:
- t2_proxy
volumes:
- /home/docker/sites/wordpress/html:/var/www/html/wordpress
- /home/docker/php/php7:/usr/local/etc/php
The Dockerfile used in the 'php7' container is based on official Wordpress php-fpm image:
Dockerfile-php7:
FROM php:7.4-fpm
# persistent dependencies
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
# Ghostscript is required for rendering PDF previews
ghostscript \
; \
rm -rf /var/lib/apt/lists/*
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libfreetype6-dev \
libjpeg-dev \
libmagickwand-dev \
libpng-dev \
libwebp-dev \
libzip-dev \
; \
\
docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
; \
docker-php-ext-install -j "$(nproc)" \
bcmath \
exif \
gd \
mysqli \
zip \
; \
# https://pecl.php.net/package/imagick
pecl install imagick-3.5.0; \
docker-php-ext-enable imagick; \
rm -r /tmp/pear; \
\
# https://pecl.php.net/package/redis
pecl install redis; \
docker-php-ext-enable redis; \
rm -r /tmp/pear; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN set -eux; \
docker-php-ext-enable opcache; \
{ \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=2'; \
echo 'opcache.fast_shutdown=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
# https://wordpress.org/support/article/editing-wp-config-php/#configure-error-logging
RUN { \
# https://www.php.net/manual/en/errorfunc.constants.php
# https://github.com/docker-library/wordpress/issues/420#issuecomment-517839670
echo 'error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_RECOVERABLE_ERROR'; \
echo 'display_errors = Off'; \
echo 'display_startup_errors = Off'; \
echo 'log_errors = On'; \
echo 'error_log = /dev/stderr'; \
echo 'log_errors_max_len = 1024'; \
echo 'ignore_repeated_errors = On'; \
echo 'ignore_repeated_source = Off'; \
echo 'html_errors = Off'; \
} > /usr/local/etc/php/conf.d/error-logging.ini
I ensure that all Wordpress files are in the correct folder:
root#ubuntu:/home/docker# ls -l sites/wordpress/html/
total 220
-rw-r----- 1 1000 998 405 Feb 6 2020 index.php
-rw-r----- 1 1000 998 19915 Jan 1 2021 license.txt
-rw-r----- 1 1000 998 7346 Jul 6 12:23 readme.html
-rw-r----- 1 1000 998 7165 Jan 21 2021 wp-activate.php
drwxr-x--- 9 1000 998 4096 Sep 9 02:20 wp-admin
-rw-r----- 1 1000 998 351 Feb 6 2020 wp-blog-header.php
-rw-r----- 1 1000 998 2328 Feb 17 2021 wp-comments-post.php
-rw-r----- 1 1000 998 3004 May 21 10:40 wp-config-sample.php
-rw-r--r-- 1 1000 998 3153 Oct 5 05:47 wp-config.php
drwxr-x--- 4 1000 998 4096 Sep 9 02:20 wp-content
-rw-r----- 1 1000 998 3939 Jul 30 2020 wp-cron.php
drwxr-x--- 25 1000 998 16384 Sep 9 02:20 wp-includes
-rw-r----- 1 1000 998 2496 Feb 6 2020 wp-links-opml.php
-rw-r----- 1 1000 998 3900 May 15 17:38 wp-load.php
-rw-r----- 1 1000 998 45463 Apr 6 18:39 wp-login.php
-rw-r----- 1 1000 998 8509 Apr 14 2020 wp-mail.php
-rw-r----- 1 1000 998 22297 Jun 1 23:09 wp-settings.php
-rw-r----- 1 1000 998 31693 May 7 20:16 wp-signup.php
-rw-r----- 1 1000 998 4747 Oct 8 2020 wp-trackback.php
-rw-r----- 1 1000 998 3236 Jun 8 2020 xmlrpc.php
And the wp-config is pointing to the correct database:
wp-config.php
-------------
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );
/** MySQL database username */
define( 'DB_USER', 'wordpress' );
/** MySQL database password */
define( 'DB_PASSWORD', 'wordpress' );
/** MySQL hostname */
define( 'DB_HOST', 'mariadb' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
/** Filesystem access **/
define('FS_METHOD', 'direct');
With this setup, when I reach https://example.com I got a "File not found" error.
If I changed the ownership of the Wordpress files folder (/home/docker/sites/wordpress/html/) to 'docker' user I'm able to see the Wordpress app running, but and "Error establishing a database connection"
docker ps -a:
docker logs mariadb:
root#ubuntu-s-1vcpu-1gb-intel-ams3-01:/home/docker# docker logs mariadb
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing...
[env-init] MYSQL_ROOT_PASSWORD set from FILE__MYSQL_ROOT_PASSWORD
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing...
-------------------------------------
_ ()
| | ___ _ __
| | / __| | | / \
| | \__ \ | | | () |
|_| |___/ |_| \__/
Brought to you by linuxserver.io
-------------------------------------
To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------
User uid: 1000
User gid: 998
-------------------------------------
[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 30-config: executing...
[cont-init.d] 30-config: exited 0.
[cont-init.d] 40-initialise-db: executing...
Setting Up Initial Databases
Installing MariaDB/MySQL system tables in '/config/databases' ...
2021-10-05 7:53:00 1 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1017: Can't find file: './mysql/' (errno: 2 "No such file or directory")
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following command:
'/usr/bin/mysql_secure_installation'
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the MariaDB Knowledgebase at https://mariadb.com/kb or the
MySQL manual for more instructions.
You can start the MariaDB daemon with:
cd '/usr' ; /usr/bin/mysqld_safe --datadir='/config/databases'
You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/mysql-test' ; perl mysql-test-run.pl
Please report any problems at https://mariadb.org/jira
The latest information about MariaDB is available at https://mariadb.org/.
You can find additional information about the MySQL part at:
https://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/
2021-10-05 7:53:01 0 [Note] mysqld (mysqld 10.5.12-MariaDB-log) starting as process 306 ...
2021-10-05 7:53:02 0 [Note] InnoDB: Uses event mutexes
2021-10-05 7:53:02 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-10-05 7:53:02 0 [Note] InnoDB: Number of pools: 1
2021-10-05 7:53:02 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2021-10-05 7:53:02 0 [Note] mysqld: O_TMPFILE is not supported on /var/tmp (disabling future attempts)
2021-10-05 7:53:02 0 [Note] InnoDB: Using Linux native AIO
2021-10-05 7:53:02 0 [Note] InnoDB: Initializing buffer pool, total size = 268435456, chunk size = 134217728
2021-10-05 7:53:02 0 [Note] InnoDB: Completed initialization of buffer pool
2021-10-05 7:53:02 0 [Note] InnoDB: 128 rollback segments are active.
2021-10-05 7:53:02 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-10-05 7:53:02 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-10-05 7:53:02 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-10-05 7:53:02 0 [Note] InnoDB: 10.5.12 started; log sequence number 45094; transaction id 20
2021-10-05 7:53:02 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-10-05 7:53:02 0 [Note] InnoDB: Loading buffer pool(s) from /config/databases/ib_buffer_pool
2021-10-05 7:53:02 0 [Note] InnoDB: Buffer pool(s) load completed at 211005 7:53:02
2021-10-05 7:53:02 0 [Note] Server socket created on IP: '::'.
2021-10-05 7:53:02 0 [Note] Reading of all Master_info entries succeeded
2021-10-05 7:53:02 0 [Note] Added new Master_info '' to hash table
2021-10-05 7:53:02 0 [Note] mysqld: ready for connections.
Version: '10.5.12-MariaDB-log' socket: '/run/mysqld/mysqld.sock' port: 3306 MariaDB Server
2021-10-05 7:53:03 0 [Note] mysqld (initiated by: root[root] # localhost []): Normal shutdown
2021-10-05 7:53:03 0 [Note] Event Scheduler: Purging the queue. 0 events
2021-10-05 7:53:03 0 [Note] InnoDB: FTS optimize thread exiting.
2021-10-05 7:53:03 0 [Note] InnoDB: Starting shutdown...
2021-10-05 7:53:03 0 [Note] InnoDB: Dumping buffer pool(s) to /config/databases/ib_buffer_pool
2021-10-05 7:53:03 0 [Note] InnoDB: Buffer pool(s) dump completed at 211005 7:53:03
2021-10-05 7:53:04 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2021-10-05 7:53:04 0 [Note] InnoDB: Shutdown completed; log sequence number 45106; transaction id 23
2021-10-05 7:53:04 0 [Note] mysqld: Shutdown complete
Database Setup Completed
[cont-init.d] 40-initialise-db: exited 0.
[cont-init.d] 90-custom-folders: executing...
[cont-init.d] 90-custom-folders: exited 0.
[cont-init.d] 99-custom-files: executing...
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
211005 07:53:05 mysqld_safe Logging to '/config/databases/1e14f4ec3953.err'.
211005 07:53:05 mysqld_safe Starting mariadbd daemon with databases from /config/databases
docker logs php7:
[05-Oct-2021 05:52:57] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pdo_mysql (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/pdo_mysql: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pdo_mysql.so (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/pdo_mysql.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[05-Oct-2021 05:52:57] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'mcrypt' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/mcrypt (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/mcrypt: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/mcrypt.so (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/mcrypt.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[05-Oct-2021 05:52:57] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'pspell' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pspell (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/pspell: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/pspell.so (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/pspell.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[05-Oct-2021 05:52:57] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'sockets' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/sockets (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/sockets: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/sockets.so (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/sockets.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[05-Oct-2021 05:52:57] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'ssh2' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/ssh2 (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/ssh2: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/ssh2.so (/usr/local/lib/php/extensions/no-debug-non-zts-20190902/ssh2.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[05-Oct-2021 05:52:58] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[05-Oct-2021 05:52:58] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[05-Oct-2021 05:52:58] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[05-Oct-2021 05:52:58] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[05-Oct-2021 05:52:58] NOTICE: fpm is running, pid 1
[05-Oct-2021 05:52:58] NOTICE: ready to handle connections
192.168.90.10 - 05/Oct/2021:05:57:30 +0000 "GET /index.php" 404
192.168.90.10 - 05/Oct/2021:05:57:32 +0000 "GET /index.php" 404
192.168.90.10 - 05/Oct/2021:05:59:02 +0000 "GET /index.php" 404
192.168.90.10 - 05/Oct/2021:06:00:00 +0000 "GET /index.php" 404
192.168.90.10 - 05/Oct/2021:06:23:19 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:23:20 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:23:21 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:25:23 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:25:24 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:25:24 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:26:39 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:26:40 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:27:22 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:29:30 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:29:31 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:29:31 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:29:31 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:29:32 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:29:32 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:29:32 +0000 "GET /index.php" 500
192.168.90.10 - 05/Oct/2021:06:29:41 +0000 "GET /wp-admin/index.php" 500
192.168.90.10 - 05/Oct/2021:06:29:42 +0000 "GET /wp-admin/index.php" 500
192.168.90.10 - 05/Oct/2021:06:29:43 +0000 "GET /wp-admin/index.php" 500
192.168.90.10 - 05/Oct/2021:06:31:36 +0000 "GET /wp-admin/index.php" 500
I think my problem is something with the PUID/PGID and users, but I can't get it work. Hope someone could point me in the right direction.
Thank you all in advance!
It's because of the complicated and so strict that your file permission configured. I think that you are trying to config your php-fpm to use user 1000 and group 998. But it is a wrong way because php-fpm also need to access to /usr/local/lib/php/* to load php extensions. Php-fpm has it owned mechanism to to switch to another user to serve client request while using root (or other power user to load PHP/system configurations). Because you are not using root to start php-fpm so it does not have permission to switch to another user, so you see the logs:
[05-Oct-2021 05:52:58] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[05-Oct-2021 05:52:58] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
[05-Oct-2021 05:52:58] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
[05-Oct-2021 05:52:58] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
There are many ways to resolve your problems. If you still expect to use too strict the file permission like that, you will have to keep running php-fpm as root but on the php-fpm configuration (usually at etc/php-fpm.d/*.conf), you set user to 1000 and group to 998, so php-fpm will use that user and group to serve your client request and that user will be able to read your current source code files. However, I think you will have to make sure that user 1000 and 998 are existed in the image.
Secondly, I think your permission model is too strict and not necessary. I will grant +r for public to the source code files and start php-fpm as root (by default it will use www user to serve clients).

NGINX Amazon EC2 keeps loading but shows nothing

I'm kinda new on setting up a production machine and I don't get why I'm not seeing the default index page for nginx on my EC2 machine. It's installed and running on my server, but when I try to access, it keeps loading and shows nothing, keeps on a blank page. I'm trying to access through the public ip (35.160.22.104) and through public dns(ec2-35-160-22-104.us-west-2.compute.amazonaws.com). Both does the same. What I'm doing wrong?
UPDATE:
I realized that when restarting nginx service, it didn't showed the "ok" message. So I took a look at error.log:
[ 2016-12-12 17:16:11.2439 709/7f3eebc93780 age/Cor/CoreMain.cpp:967 ]: Passenger core shutdown finished
2016/12/12 17:16:12 [info] 782#782: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:71
[ 2016-12-12 17:16:12.2742 791/7fb0c37a0780 age/Wat/WatchdogMain.cpp:1291 ]: Starting Passenger watchdog...
[ 2016-12-12 17:16:12.2820 794/7fe4d238b780 age/Cor/CoreMain.cpp:982 ]: Starting Passenger core...
[ 2016-12-12 17:16:12.2820 794/7fe4d238b780 age/Cor/CoreMain.cpp:235 ]: Passenger core running in multi-application mode.
[ 2016-12-12 17:16:12.2832 794/7fe4d238b780 age/Cor/CoreMain.cpp:732 ]: Passenger core online, PID 794
[ 2016-12-12 17:16:12.2911 799/7f06bb50a780 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2016-12-12 17:16:12.2916 799/7f06bb50a780 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 799
Anyway, it doesn't looks like an error, but a usual log.
UPDATE 2:
Nginx is running:
root 810 1 0 17:16 ? 00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data 815 810 0 17:16 ? 00:00:00 nginx: worker process
ubuntu 853 32300 0 17:44 pts/0 00:00:00 grep --color=auto nginx
And when I try do curl localhost, it returns the HTML as expected!
UPDATE3:
When I run systemctl status nginx, I get the following error:
Dec 12 17:54:48 ip-172-31-40-156 systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
Trying to figure out what it is
UPDATE4:
Ran the command nmap 35.160.22.104 -Pn PORT STATE SERVICE 22/tcpand got the output:
Starting Nmap 7.01 ( https://nmap.org ) at 2016-12-12 18:05 UTC
Failed to resolve "PORT".
Failed to resolve "STATE".
Failed to resolve "SERVICE".
Unable to split netmask from target expression: "22/tcp"
Nmap scan report for ec2-35-160-22-104.us-west-2.compute.amazonaws.com (35.160.22.104)
Host is up (0.0015s latency).
Not shown: 999 filtered ports
PORT STATE SERVICE
22/tcp open ssh
UPDATE5:
Output for netstat -tuanp | grep 80:
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
tcp6 0 0 :::80 :::* LISTEN -
Your ec2 instance have a security group associated.
You should go to AWS console EC2 -> Instances -> Click on your instance -> On the bottom 'Description' -> Security Group. Click on the name and you will be redirect to EC2-> Network and Security. Click on 'Edit inbound rules' Add a rule:
Type: HTTP
Save. And that should be fine!

How to find a working directory of running process(HPUX/Solaris/Linux/AIX)

Trying to get the home directory of running process.
For Linux, I learned that I could use /proc/PID/exe information, but I think there is no that information in other OS.
Assuming that there is no file information $PATH, can you let me know how I can get the home directory of the running process?
I just need to assume that OS utilities usage is very limited in OS, meaning that I should use very common command.
Condition:
No special utility such as lsof.
Added
The process I am referring is the process a 3rd-party application runs.
Thanks in advance.
The first column for ps -ef (the most common useful-options, in POSIX) give you the process owner, usually a name (sometimes only the uid number). For
example
UID PID PPID C STIME TTY TIME CMD
statd 1935 1 0 04:00 ? 00:00:00 /sbin/rpc.statd
101 2329 1 0 04:00 ? 00:00:00 /usr/bin/dbus-daemon --system
daemon 2511 1 0 04:00 ? 00:00:00 /usr/sbin/atd
avahi 2540 1 0 04:01 ? 00:00:00 avahi-daemon: running [vmw-de>
avahi 2541 2540 0 04:01 ? 00:00:00 avahi-daemon: chroot helper
bind 2593 1 0 04:01 ? 00:00:00 /usr/sbin/named -u bind
kdm 2781 2780 0 04:01 ? 00:00:01 /usr/lib/kde4/libexec/kdm_gre>
www-data 2903 2782 0 04:01 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2904 2782 0 04:01 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2905 2782 0 04:01 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2906 2782 0 04:01 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 2908 2782 0 04:01 ? 00:00:00 /usr/sbin/apache2 -k start
ntp 2989 1 0 04:01 ? 00:00:00 /usr/sbin/ntpd -p /var/run/nt>
postgres 3059 1 0 04:01 ? 00:00:00 /usr/lib/postgresql/9.1/bin/p>
postgres 3063 3059 0 04:01 ? 00:00:00 postgres: writer process >
postgres 3064 3059 0 04:01 ? 00:00:00 postgres: wal writer process >
postgres 3065 3059 0 04:01 ? 00:00:00 postgres: autovacuum launcher>
postgres 3066 3059 0 04:01 ? 00:00:00 postgres: stats collector pro>
104 3555 1 0 04:01 ? 00:00:00 /usr/sbin/exim4 -bd -q30m
gitlog 3677 3676 0 04:01 ? 00:00:00 svlogd -tt /var/log/git-daemon
116 3679 3676 0 04:01 ? 00:00:00 /usr/lib/git-core/git-daemon
The process owner name (or uid number) are in /etc/passwd as the first column (for the name) or the third column (uid number). Columns in /etc/passwd are delimited by colons (:). For example:
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
messagebus:x:101:105::/var/run/dbus:/bin/false
colord:x:102:106:colord colour management daemon,,,:/var/lib/colord:/bin/false
usbmux:x:103:46:usbmux daemon,,,:/home/usbmux:/bin/false
Debian-exim:x:104:111::/var/spool/exim4:/bin/false
statd:x:105:65534::/var/lib/nfs:/bin/false
avahi:x:106:114:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false
In this example, statd is
statd:x:105:65534::/var/lib/nfs:/bin/false
The next-to-last column of /etc/passwd is the home directory of the process, e.g., /var/lib/nfs for the statd process.
Some system processes have no home directory, e.g., you may see /usr/sbin on Linux systems, or some other directory that several processes share.
Further reading:
POSIX ps shows the options of POSIX ps, implemented in these systems:
HPUX ps
Solaris ps
Linux ps
AIX ps
passwd(5) shows the file-format of /etc/passwd
OP amended question to indicate that the current directory (rather than home-directory) is wanted. Systems using a proc-filesystem can provide this information. Those are Solaris, AIX and Linux.
However, HPUX does not (see for example /proc on HP-UX?, which says the pstat system-call can be used). I do not see a possibility, reading its manual page, but the link below says pstat_getpathname will work.
AIX supports it, according to IBM documentation.
Look for the cwd "file" for the working directory of a given process in systems with a proc-filesystem.
Further reading:
Find out current working directory of a running process?
current working directory of process
Get full path of executable of running process on HPUX
A sample of a program that can find itself (getcwd getenv)

Error establishing a database connection EC2 Amazon

I hope you can help me. I can not stand having to keep restarting my ec2 instance on Amazon.
I have two wordpress sites hosted there. My sites have always worked well until two months ago, one of them started having this problem. I tried all ways pack up, and the only solution was to reconfigure.
Now that all was right with the two. The second site started the same problem. I think Amazon is clowning me.
I am using a free micro instance. If anyone knows what the problem is, please help me!
Your issue will be the limited memory that is allocated to the T1 Micro instances in EC2. I'm assuming you are using ANI Linux in this case and if an alternate version of Linux is used then you may have different locations for your log and config files.
Make sure you are the root user.
Have a look at your MySQL logs in the following location:
/var/log/mysqld.log
If you see repeated instances of the following it's pretty certain that the 0.6GB of memory allocated to the micro instance is not cutting it.
150714 22:13:33 InnoDB: Initializing buffer pool, size = 12.0M
InnoDB: mmap(12877824 bytes) failed; errno 12
150714 22:13:33 InnoDB: Completed initialization of buffer pool
150714 22:13:33 InnoDB: Fatal error: cannot allocate memory for the buffer pool
150714 22:13:33 [ERROR] Plugin 'InnoDB' init function returned error.
150714 22:13:33 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
150714 22:13:33 [ERROR] Unknown/unsupported storage engine: InnoDB
150714 22:13:33 [ERROR] Aborting
You will notice in the log excerpt above that my buffer pool size is set to 12MB. This can be configured by adding the line innodb_buffer_pool_size = 12M to your MySQL config file /etc/my.cnf.
A pretty good way to deal with InnoDB chewing up your memory is to create a swap file.
Start by checking the status of your memory:
free -m
You will most probably see that your swap is not doing much:
total used free shared buffers cached
Mem: 592 574 17 0 15 235
-/+ buffers/cache: 323 268
Swap: 0 0 0
To start ensure you are logged in as the root user and run the following command:
dd if=/dev/zero of=/swapfile bs=1M count=1024
Wait for a bit as the command is not verbose but you should see the following response after about 15 seconds when the process is complete:
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 31.505 s, 34.1 MB/s
Next set up the swapspace with:
mkswap /swapfile
Now set up the swap event:
swapon /swapfile
If you get a permissions response you can ignore it or address the swap file by changing the permissions to 600 with the chmod command.
chmod 600 /swapfile
Now add the following line to /etc/fstab to create the swap spaces on server start:
/swapfile swap swap defaults 0 0
Restart your MySQL instance:
service mysqld restart
Finally check to see if your swap file is working correctly with the free -m command.
You should see something like:
total used free shared buffers cached
Mem: 592 575 16 0 16 235
-/+ buffers/cache: 323 269
Swap: 1023 0 1023
Hope this helps.

Resources