Sudden 502 messages on Gunicorn - django

My server has been working great for about 18 months. My setup is Nginx, Gunicorn, Django on a Ubuntu server. I will share this next piece of information just for the sake of full disclosure. One of my hard drives died on this same server. It's not the hard drive with any of the data that I'm referring to, but this hard disk did end up getting a new uuid. I feel compelled to share this information because this was when I started having trouble. Could be coincidence, could be related, I dunno. This was last Friday and I've been struggling with it ever since.
I get a 502 error. When I drill down a little bit that shows up as a Gunicorn error. I'll attach all of the information that I can think of below about my setup. But what gets me is that I can start Gunicorn from the command line, but not from the computer boot.
This works from the command line, which tells me that I have something right:
sudo service gunicorn stop
sudo /media/Storage/sales_portal/venv/bin/gunicorn --chdir=/media/Storage/sales_portal --timeout 600 --access-logfile /var/log/gunicorn/access.log --error-logfile /var/log/gunicorn/error.log --log-level debug --workers 3 --bind unix:/run/gunicorn.sock sales_portal.wsgi:application
My gunicorn.service file is:
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
# Type=notify
# the specific user that our service will run as
User=administrator
Group=administrator
# another option for an even more restricted service is
# DynamicUser=yes
# see http://0pointer.net/blog/dynamic-users-with-systemd.html
# RuntimeDirectory=gunicorn
WorkingDirectory=/media/Storage/sales_portal
ExecStart=/media/Storage/sales_portal/venv/bin/gunicorn --chdir=/media/Storage/sales_portal --timeout 600 --access-logfile /var/log/gunicorn/gunicorn.log --error-logfile /var/log/gunicorn/error.log --workers 3 --bind unix:/run/gunicorn.sock sales_portal.wsgi:application
# ExecReload=/bin/kill -s HUP $MAINPID
# KillMode=mixed
# TimeoutStopSec=5
# PrivateTmp=true
[Install]
WantedBy=multi-user.target
my gunicorn.socket information is:
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn.sock
# Our service won't need permissions for the socket, since it
# inherits the file descriptor by socket activation
# only the nginx daemon will need access to the socket
# SocketUser=www-data
# Optionally restrict the socket permissions even more.
# SocketMode=600
[Install]
WantedBy=sockets.target
Trying
sudo service gunicorn start
gives me
A dependency job for gunicorn.service failed. See 'journalctl -xe' for details.
the output of this (or a portion of it, anyway) is:
Nov 20 08:21:11 server systemd[1172]: tracker-miner-fs.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit UNIT has entered the 'failed' state with result 'exit-code'.
Nov 20 08:21:11 server systemd[1172]: Failed to start Tracker file system data miner.
-- Subject: A start job for unit UNIT has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished with a failure.
--
-- The job identifier is 2343 and the job result is failed.
Nov 20 08:21:11 server systemd[1172]: tracker-store.service: Scheduled restart job, restart counter is at 1.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit UNIT has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Nov 20 08:21:11 server systemd[1172]: tracker-miner-fs.service: Scheduled restart job, restart counter is at 54.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit UNIT has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Nov 20 08:21:11 server systemd[1172]: Stopped Tracker file system data miner.
-- Subject: A stop job for unit UNIT has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit UNIT has finished.
--
-- The job identifier is 2388 and the job result is done.
Nov 20 08:21:11 server systemd[1172]: Starting Tracker file system data miner...
-- Subject: A start job for unit UNIT has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has begun execution.
--
-- The job identifier is 2388.
Nov 20 08:21:11 server systemd[1172]: Stopped Tracker metadata database store and lookup manager.
-- Subject: A stop job for unit UNIT has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit UNIT has finished.
--
-- The job identifier is 2373 and the job result is done.
Nov 20 08:21:11 server systemd[1172]: Starting Tracker metadata database store and lookup manager...
-- Subject: A start job for unit UNIT has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has begun execution.
--
-- The job identifier is 2373.
Nov 20 08:21:11 server tracker-miner-f[167517]: Set scheduler policy to SCHED_IDLE
Nov 20 08:21:11 server tracker-miner-f[167517]: Setting priority nice level to 19
Nov 20 08:21:11 server systemd[1172]: Started Tracker metadata database store and lookup manager.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 2373.
Nov 20 08:21:11 server tracker-miner-f[167517]: Unable to get XDG user directory path for special directory &DOCUMENTS. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167517]: Unable to get XDG user directory path for special directory &MUSIC. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167517]: Unable to get XDG user directory path for special directory &PICTURES. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167517]: Unable to get XDG user directory path for special directory &VIDEOS. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167517]: Unable to get XDG user directory path for special directory &DOWNLOAD. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167517]: Unable to get XDG user directory path for special directory &DOCUMENTS. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167517]: Unable to get XDG user directory path for special directory &MUSIC. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167517]: Unable to get XDG user directory path for special directory &PICTURES. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167517]: Unable to get XDG user directory path for special directory &VIDEOS. Ignoring this location.
Nov 20 08:21:11 server unknown[167518]: Cannot initialize database: tracker data directory does not exist and could not be created: Permission denied
Nov 20 08:21:11 server systemd[1172]: tracker-store.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit UNIT has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Nov 20 08:21:11 server systemd[1172]: tracker-store.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit UNIT has entered the 'failed' state with result 'exit-code'.
Nov 20 08:21:11 server dbus-daemon[1215]: [session uid=1000 pid=1215] Activating via systemd: service name='org.freedesktop.Tracker1' unit='tracker-store.service' requested by ':1.114' (uid=1000 pid=167517 comm="/usr/libexec/tracker-miner-fs " label="unconfined")
Nov 20 08:21:11 server systemd[1172]: tracker-store.service: Scheduled restart job, restart counter is at 2.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit UNIT has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Nov 20 08:21:11 server systemd[1172]: Stopped Tracker metadata database store and lookup manager.
-- Subject: A stop job for unit UNIT has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit UNIT has finished.
--
-- The job identifier is 2403 and the job result is done.
Nov 20 08:21:11 server systemd[1172]: Starting Tracker metadata database store and lookup manager...
-- Subject: A start job for unit UNIT has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has begun execution.
--
-- The job identifier is 2403.
Nov 20 08:21:11 server dbus-daemon[1215]: [session uid=1000 pid=1215] Successfully activated service 'org.freedesktop.Tracker1'
Nov 20 08:21:11 server systemd[1172]: Started Tracker metadata database store and lookup manager.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 2403.
Nov 20 08:21:11 server tracker-store[167527]: Cannot initialize database: tracker data directory does not exist and could not be created: Permission denied
Nov 20 08:21:11 server systemd[1172]: tracker-store.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit UNIT has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Nov 20 08:21:11 server systemd[1172]: tracker-store.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit UNIT has entered the 'failed' state with result 'exit-code'.
Nov 20 08:21:11 server tracker-miner-f[167517]: Couldn't create new Files miner: 'Failed to load SPARQL backend: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying'
Nov 20 08:21:11 server systemd[1172]: tracker-miner-fs.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit UNIT has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Nov 20 08:21:11 server systemd[1172]: tracker-miner-fs.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit UNIT has entered the 'failed' state with result 'exit-code'.
Nov 20 08:21:11 server systemd[1172]: Failed to start Tracker file system data miner.
-- Subject: A start job for unit UNIT has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished with a failure.
--
-- The job identifier is 2388 and the job result is failed.
Nov 20 08:21:11 server systemd[1172]: tracker-store.service: Scheduled restart job, restart counter is at 3.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit UNIT has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Nov 20 08:21:11 server systemd[1172]: tracker-miner-fs.service: Scheduled restart job, restart counter is at 55.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit UNIT has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Nov 20 08:21:11 server systemd[1172]: Stopped Tracker file system data miner.
-- Subject: A stop job for unit UNIT has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit UNIT has finished.
--
-- The job identifier is 2448 and the job result is done.
Nov 20 08:21:11 server systemd[1172]: Starting Tracker file system data miner...
-- Subject: A start job for unit UNIT has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has begun execution.
--
-- The job identifier is 2448.
Nov 20 08:21:11 server systemd[1172]: Stopped Tracker metadata database store and lookup manager.
-- Subject: A stop job for unit UNIT has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit UNIT has finished.
--
-- The job identifier is 2433 and the job result is done.
Nov 20 08:21:11 server systemd[1172]: Starting Tracker metadata database store and lookup manager...
-- Subject: A start job for unit UNIT has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has begun execution.
--
-- The job identifier is 2433.
Nov 20 08:21:11 server tracker-miner-f[167532]: Set scheduler policy to SCHED_IDLE
Nov 20 08:21:11 server tracker-miner-f[167532]: Setting priority nice level to 19
Nov 20 08:21:11 server systemd[1172]: Started Tracker metadata database store and lookup manager.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 2433.
Nov 20 08:21:11 server tracker-miner-f[167532]: Unable to get XDG user directory path for special directory &DOCUMENTS. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167532]: Unable to get XDG user directory path for special directory &MUSIC. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167532]: Unable to get XDG user directory path for special directory &PICTURES. Ignoring this location.
Nov 20 08:21:11 server tracker-store[167533]: Cannot initialize database: tracker data directory does not exist and could not be created: Permission denied
Nov 20 08:21:11 server tracker-miner-f[167532]: Unable to get XDG user directory path for special directory &VIDEOS. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167532]: Unable to get XDG user directory path for special directory &DOWNLOAD. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167532]: Unable to get XDG user directory path for special directory &DOCUMENTS. Ignoring this location.
Nov 20 08:21:11 server systemd[1172]: tracker-store.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit UNIT has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Nov 20 08:21:11 server tracker-miner-f[167532]: Unable to get XDG user directory path for special directory &MUSIC. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167532]: Unable to get XDG user directory path for special directory &PICTURES. Ignoring this location.
Nov 20 08:21:11 server tracker-miner-f[167532]: Unable to get XDG user directory path for special directory &VIDEOS. Ignoring this location.
Nov 20 08:21:11 server systemd[1172]: tracker-store.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit UNIT has entered the 'failed' state with result 'exit-code'.
Nov 20 08:21:11 server dbus-daemon[1215]: [session uid=1000 pid=1215] Activating via systemd: service name='org.freedesktop.Tracker1' unit='tracker-store.service' requested by ':1.117' (uid=1000 pid=167532 comm="/usr/libexec/tracker-miner-fs " label="unconfined")
Nov 20 08:21:12 server systemd[1172]: tracker-store.service: Scheduled restart job, restart counter is at 4.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit UNIT has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Nov 20 08:21:12 server systemd[1172]: Stopped Tracker metadata database store and lookup manager.
-- Subject: A stop job for unit UNIT has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit UNIT has finished.
--
-- The job identifier is 2463 and the job result is done.
Nov 20 08:21:12 server systemd[1172]: Starting Tracker metadata database store and lookup manager...
-- Subject: A start job for unit UNIT has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has begun execution.
--
-- The job identifier is 2463.
Nov 20 08:21:12 server dbus-daemon[1215]: [session uid=1000 pid=1215] Successfully activated service 'org.freedesktop.Tracker1'
Nov 20 08:21:12 server systemd[1172]: Started Tracker metadata database store and lookup manager.
-- Subject: A start job for unit UNIT has finished successfully
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished successfully.
--
-- The job identifier is 2463.
Nov 20 08:21:12 server tracker-store[167542]: Cannot initialize database: tracker data directory does not exist and could not be created: Permission denied
Nov 20 08:21:12 server systemd[1172]: tracker-store.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit UNIT has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Nov 20 08:21:12 server systemd[1172]: tracker-store.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit UNIT has entered the 'failed' state with result 'exit-code'.
Nov 20 08:21:12 server tracker-miner-f[167532]: Couldn't create new Files miner: 'Failed to load SPARQL backend: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying'
Nov 20 08:21:12 server systemd[1172]: tracker-miner-fs.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit UNIT has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Nov 20 08:21:12 server systemd[1172]: tracker-miner-fs.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit UNIT has entered the 'failed' state with result 'exit-code'.
Nov 20 08:21:12 server systemd[1172]: Failed to start Tracker file system data miner.
-- Subject: A start job for unit UNIT has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished with a failure.
--
-- The job identifier is 2448 and the job result is failed.
Nov 20 08:21:12 server systemd[1172]: tracker-store.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit UNIT has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Nov 20 08:21:12 server systemd[1172]: tracker-miner-fs.service: Scheduled restart job, restart counter is at 56.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Automatic restarting of the unit UNIT has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Nov 20 08:21:12 server systemd[1172]: Stopped Tracker file system data miner.
-- Subject: A stop job for unit UNIT has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit UNIT has finished.
--
-- The job identifier is 2508 and the job result is done.
Nov 20 08:21:12 server systemd[1172]: Starting Tracker file system data miner...
-- Subject: A start job for unit UNIT has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has begun execution.
--
-- The job identifier is 2508.
Nov 20 08:21:12 server systemd[1172]: Stopped Tracker metadata database store and lookup manager.
-- Subject: A stop job for unit UNIT has finished
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A stop job for unit UNIT has finished.
--
-- The job identifier is 2493 and the job result is done.
Nov 20 08:21:12 server systemd[1172]: tracker-store.service: Start request repeated too quickly.
Nov 20 08:21:12 server systemd[1172]: tracker-store.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit UNIT has entered the 'failed' state with result 'exit-code'.
Nov 20 08:21:12 server systemd[1172]: Failed to start Tracker metadata database store and lookup manager.
-- Subject: A start job for unit UNIT has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished with a failure.
--
-- The job identifier is 2493 and the job result is failed.
Nov 20 08:21:12 server tracker-miner-f[167547]: Set scheduler policy to SCHED_IDLE
Nov 20 08:21:12 server tracker-miner-f[167547]: Setting priority nice level to 19
Nov 20 08:21:12 server tracker-miner-f[167547]: Unable to get XDG user directory path for special directory &DOCUMENTS. Ignoring this location.
Nov 20 08:21:12 server tracker-miner-f[167547]: Unable to get XDG user directory path for special directory &MUSIC. Ignoring this location.
Nov 20 08:21:12 server tracker-miner-f[167547]: Unable to get XDG user directory path for special directory &PICTURES. Ignoring this location.
Nov 20 08:21:12 server tracker-miner-f[167547]: Unable to get XDG user directory path for special directory &VIDEOS. Ignoring this location.
Nov 20 08:21:12 server tracker-miner-f[167547]: Unable to get XDG user directory path for special directory &DOWNLOAD. Ignoring this location.
Nov 20 08:21:12 server tracker-miner-f[167547]: Unable to get XDG user directory path for special directory &DOCUMENTS. Ignoring this location.
Nov 20 08:21:12 server tracker-miner-f[167547]: Unable to get XDG user directory path for special directory &MUSIC. Ignoring this location.
Nov 20 08:21:12 server tracker-miner-f[167547]: Unable to get XDG user directory path for special directory &PICTURES. Ignoring this location.
Nov 20 08:21:12 server tracker-miner-f[167547]: Unable to get XDG user directory path for special directory &VIDEOS. Ignoring this location.
Nov 20 08:21:12 server dbus-daemon[1215]: [session uid=1000 pid=1215] Activating via systemd: service name='org.freedesktop.Tracker1' unit='tracker-store.service' requested by ':1.119' (uid=1000 pid=167547 comm="/usr/libexec/tracker-miner-fs " label="unconfined")
Nov 20 08:21:12 server systemd[1172]: tracker-store.service: Start request repeated too quickly.
Nov 20 08:21:12 server systemd[1172]: tracker-store.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit UNIT has entered the 'failed' state with result 'exit-code'.
Nov 20 08:21:12 server systemd[1172]: Failed to start Tracker metadata database store and lookup manager.
-- Subject: A start job for unit UNIT has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit UNIT has finished with a failure.
--
-- The job identifier is 2523 and the job result is failed.
Nov 20 08:21:48 server sudo[167559]: administrator : TTY=pts/0 ; PWD=/home/administrator ; USER=root ; COMMAND=/bin/journalctl -xe
Nov 20 08:21:48 server sudo[167559]: pam_unix(sudo:session): session opened for user root by administrator(uid=0)
the error log that this gives me is
[2020-11-20 08:23:30 -0600] [167639] [DEBUG] Current configuration:
config: None
bind: ['unix:/run/gunicorn.sock']
backlog: 2048
workers: 3
worker_class: sync
threads: 1
worker_connections: 1000
max_requests: 0
max_requests_jitter: 0
timeout: 600
graceful_timeout: 30
keepalive: 2
limit_request_line: 4094
limit_request_fields: 100
limit_request_field_size: 8190
reload: False
reload_engine: auto
reload_extra_files: []
spew: False
check_config: False
preload_app: False
sendfile: None
reuse_port: False
chdir: /media/Storage/sales_portal
daemon: False
raw_env: []
pidfile: None
worker_tmp_dir: None
user: 0
group: 0
umask: 0
initgroups: False
tmp_upload_dir: None
secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
forwarded_allow_ips: ['127.0.0.1']
accesslog: /var/log/gunicorn/access.log
disable_redirect_access_to_syslog: False
access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
errorlog: /var/log/gunicorn/error.log
loglevel: debug
capture_output: False
logger_class: gunicorn.glogging.Logger
logconfig: None
logconfig_dict: {}
syslog_addr: udp://localhost:514
syslog: False
syslog_prefix: None
syslog_facility: user
enable_stdio_inheritance: False
statsd_host: None
dogstatsd_tags:
statsd_prefix:
proc_name: None
default_proc_name: sales_portal.wsgi:application
pythonpath: None
paste: None
on_starting: <function OnStarting.on_starting at 0x7fd62efa18b0>
on_reload: <function OnReload.on_reload at 0x7fd62efa19d0>
when_ready: <function WhenReady.when_ready at 0x7fd62efa1af0>
pre_fork: <function Prefork.pre_fork at 0x7fd62efa1c10>
post_fork: <function Postfork.post_fork at 0x7fd62efa1d30>
post_worker_init: <function PostWorkerInit.post_worker_init at 0x7fd62efa1e50>
worker_int: <function WorkerInt.worker_int at 0x7fd62efa1f70>
worker_abort: <function WorkerAbort.worker_abort at 0x7fd62efb20d0>
pre_exec: <function PreExec.pre_exec at 0x7fd62efb21f0>
pre_request: <function PreRequest.pre_request at 0x7fd62efb2310>
post_request: <function PostRequest.post_request at 0x7fd62efb23a0>
child_exit: <function ChildExit.child_exit at 0x7fd62efb24c0>
worker_exit: <function WorkerExit.worker_exit at 0x7fd62efb25e0>
nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7fd62efb2700>
on_exit: <function OnExit.on_exit at 0x7fd62efb2820>
proxy_protocol: False
proxy_allow_ips: ['127.0.0.1']
keyfile: None
certfile: None
ssl_version: 2
cert_reqs: 0
ca_certs: None
suppress_ragged_eofs: True
do_handshake_on_connect: False
ciphers: None
raw_paste_global_conf: []
strip_header_spaces: False
[2020-11-20 08:23:30 -0600] [167639] [INFO] Starting gunicorn 20.0.4
[2020-11-20 08:23:30 -0600] [167639] [DEBUG] Arbiter booted
[2020-11-20 08:23:30 -0600] [167639] [INFO] Listening at: unix:/run/gunicorn.sock (167639)
[2020-11-20 08:23:30 -0600] [167639] [INFO] Using worker: sync
[2020-11-20 08:23:30 -0600] [167641] [INFO] Booting worker with pid: 167641
[2020-11-20 08:23:30 -0600] [167642] [INFO] Booting worker with pid: 167642
[2020-11-20 08:23:30 -0600] [167643] [INFO] Booting worker with pid: 167643
[2020-11-20 08:23:30 -0600] [167639] [DEBUG] 3 workers
[2020-11-20 14:23:38 +0000] [167643] [DEBUG] GET /opportunities/products/
That's all the information that I can think to include. If you think anything else would be helpful, just let me know. Just to reiterate, this exact setup was working until last Friday. I didn't change anything last Friday to make it stop working, that I know of. I changed a uuid in my fstab file for an unrelated hard disk, in my opinion, that should not have resulted in this behavior. Any help is appreciated. Hopefully I'm overlooking something simple.
Thanks,
Jonathan

Related

Failed to start Zabbix Agent for every 10 seconds

I am using centos 7.
How did I check the log.
journalctl -xe
What I got from the log.(I saw the same log every 10 seconds.)
Oct 02 10:19:51 lp01.localdomain systemd[1]: zabbix-agent.service holdoff time over, scheduling restart.
Oct 02 10:19:51 lp01.localdomain systemd[1]: Starting Zabbix Agent...
-- Subject: Unit zabbix-agent.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit zabbix-agent.service has begun starting up.
Oct 02 10:19:51 lp01.localdomain zabbix_agentd[8985]: zabbix_agentd [8987]: cannot open "/var/log/zabbix/zabbix_agentd.log": [13] Permission denied
Oct 02 10:19:51 lp01.localdomain systemd[1]: PID file /run/zabbix/zabbix_agentd.pid not readable (yet?) after start.
Oct 02 10:19:51 lp01.localdomain systemd[1]: zabbix-agent.service never wrote its PID file. Failing.
Oct 02 10:19:51 lp01.localdomain systemd[1]: Failed to start Zabbix Agent.
-- Subject: Unit zabbix-agent.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit zabbix-agent.service has failed.
--
-- The result is failed.
Oct 02 10:19:51 lp01.localdomain systemd[1]: Unit zabbix-agent.service entered failed state.
Oct 02 10:19:51 lp01.localdomain systemd[1]: zabbix-agent.service failed.
So I checked "/var/log/zabbix/zabbix_agentd.log" file first.
ll /var/log/zabbix/zabbix_agentd.log
But it said No such file or directory.
ls: cannot access /var/log/zabbix/zabbix_agentd.log: No such file or directory
and then I checked "/run/zabbix/zabbix_agentd.pid" file.
ll /run/zabbix/zabbix_agentd.pid
It also said No such file or directory.
ls: cannot access /run/zabbix/zabbix_agentd.pid: No such file or directory
You have new mail in /var/spool/mail/root
I checked if Selinux is running.
getenforce
and it said Selinux is Disabled..
My questions are
How can I start zabbix?
If I can't start zabbix, can I stop zabbix from starting-failing every 10 seconds?
Thank you.
add permission to the directory - /var/log/zabbix/ & /var/log/zabbix-agent/
chmod 707 /var/log/zabbix/
chmod 707 /var/log/zabbix-agent/
or
change owner of the directory?
chown zabbix:zabbix /var/log/zabbix/
chown zabbix:zabbix /var/log/zabbix-agent/
And then, would stop service zabbix?
systemctl stop zabbix-agent

Failed to start Apache after configuring ssl on Amazon Linux2

I'm trying to install ssl certificate on aws ec2(Amazon Linux2). Apache can start properly until I configure ssl following "Step 1: Enable TLS on the server" in https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SSL-on-amazon-linux-ami.html
After I make those changes, apache even can not start:
Job for httpd.service failed because the control process exited with error code
I got the following log by typing "journalctl -xe":
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-26.scope has begun starting up.
Jan 27 04:30:01 ip-172-31-18-58.ap-southeast-2.compute.internal CROND[10239]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jan 27 04:30:01 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Removed slice User Slice of root.
-- Subject: Unit user-0.slice has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has finished shutting down.
Jan 27 04:30:01 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Stopping User Slice of root.
-- Subject: Unit user-0.slice has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has begun shutting down.
Jan 27 04:30:47 ip-172-31-18-58.ap-southeast-2.compute.internal sshd[10245]: Received disconnect from 221.181.185.135 port 21146:11: [preauth]
Jan 27 04:30:47 ip-172-31-18-58.ap-southeast-2.compute.internal sshd[10245]: Disconnected from 221.181.185.135 port 21146 [preauth]
Jan 27 04:31:22 ip-172-31-18-58.ap-southeast-2.compute.internal dhclient[2893]: XMT: Solicit on eth0, interval 120170ms.
Jan 27 04:33:22 ip-172-31-18-58.ap-southeast-2.compute.internal dhclient[2893]: XMT: Solicit on eth0, interval 119290ms.
Jan 27 04:34:55 ip-172-31-18-58.ap-southeast-2.compute.internal sshd[10251]: Received disconnect from 218.93.208.150 port 29589:11: [preauth]
Jan 27 04:34:55 ip-172-31-18-58.ap-southeast-2.compute.internal sshd[10251]: Disconnected from 218.93.208.150 port 29589 [preauth]
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal sudo[10253]: ec2-user : TTY=pts/2 ; PWD=/etc/pki/tls/certs ; USER=root ; COMMAND=/bin/systemct
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal sudo[10253]: pam_unix(sudo:session): session opened for user root by ec2-user(uid=0)
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Unit httpd.service entered failed state.
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: httpd.service failed.
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal sudo[10253]: pam_unix(sudo:session): session closed for user root
Jan 27 04:35:22 ip-172-31-18-58.ap-southeast-2.compute.internal dhclient[2893]: XMT: Solicit on eth0, interval 130780ms.
I get stuck here for a long time. Anyone can help me please? Thank you in advance.

starting celery workers as daemons

I am trying to set up celery to run in production. I have been following the instructions here:
https://www.linode.com/docs/development/python/task-queue-celery-rabbitmq/#start-the-workers-as-daemons
I am currently up to step #7, i.e. 'sudo systemctl start celeryd'. When I am running this I am being told celeryd.service has failed. I have run 'journalctl -xe' to find the log details, which I have copied in below.
I'm very new to celery so I'm finding difficulty in interpreting the log file to figure out what's going wrong, so any help would be much appreciated. If more information is needed then please ask and i'll do my best to provide it.
Apr 05 10:44:47 user-admin systemd[6477]: celeryd.service: Failed to determine user credentials: No such process
Apr 05 10:44:47 user-admin systemd[6477]: celeryd.service: Failed at step USER spawning /bin/sh: No such process
-- Subject: Process /bin/sh could not be executed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The process /bin/sh could not be executed and failed.
--
-- The error number returned by this process is 3.
Apr 05 10:44:47 user-admin systemd[1]: celeryd.service: Control process exited, code=exited status=217
Apr 05 10:44:47 user-admin systemd[1]: celeryd.service: Failed with result 'exit-code'.
Apr 05 10:44:47 user-admin systemd[1]: Failed to start Celery Service.
-- Subject: Unit celeryd.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit celeryd.service has failed.
--
-- The result is RESULT.
Apr 05 10:44:47 user-admin sudo[6472]: pam_unix(sudo:session): session closed for user root
Apr 05 10:45:01 user-admin CRON[6481]: pam_unix(cron:session): session opened for user root by (uid=0)
Apr 05 10:45:01 user-admin CRON[6482]: (root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
Apr 05 10:45:01 user-admin CRON[6481]: pam_unix(cron:session): session closed for user root
Apr 05 10:45:05 user-admin sudo[6485]: djangoadmin : TTY=pts/1 ; PWD=/var/log/celery ; USER=root ; COMMAND=/bin/journalctl -xe
Remove the /bin/sh -c from ExecStart, ExecStop and ExecRestart (in your celeryd.service).
Assuming you have a virtual environment in /home/celery/venv, and Celery installed in this environment, then your ExecStart (and other Exec* lines) should look like:
ExecStart=/home/celery/venv/bin/celery multi start ${CELERYD_NODES} \
-A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
--logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL}
${CELERYD_OPTS}'
To create virtual environment do something like: python3 -m venv /home/celery/venv
If the celery user is created in a different path, then change the /home/celery in the code above to the appropriate "home" of the celery user...
UPDATE: If you used the same config file as on the Linode page, then you may use ExecStart=${CELERY_BIN} multi start...

Issue with awslogs service and CloudWatch Logs Agent on Ubuntu 16.04

On one of my AWS ec2 instances running Ubuntu 16.04, I'm getting the following errors filled up in my /var/syslog.
Jul 17 18:11:21 Mysql-Slave systemd[1]: Stopped The CloudWatch Logs agent.
Jul 17 18:11:21 Mysql-Slave systemd[1]: Started The CloudWatch Logs agent.
Jul 17 18:11:26 Mysql-Slave systemd[1]: awslogs.service: Main process exited, code=exited, status=255/n/a
Jul 17 18:11:26 Mysql-Slave systemd[1]: awslogs.service: Unit entered failed state.
Jul 17 18:11:26 Mysql-Slave systemd[1]: awslogs.service: Failed with result 'exit-code'.
Jul 17 18:11:26 Mysql-Slave systemd[1]: awslogs.service: Service hold-off time over, scheduling restart.
Jul 17 18:11:26 Mysql-Slave systemd[1]: Stopped The CloudWatch Logs agent.
Jul 17 18:11:26 Mysql-Slave systemd[1]: Started The CloudWatch Logs agent.
Jul 17 18:11:32 Mysql-Slave systemd[1]: awslogs.service: Main process exited, code=exited, status=255/n/a
Jul 17 18:11:32 Mysql-Slave systemd[1]: awslogs.service: Unit entered failed state.
Jul 17 18:11:32 Mysql-Slave systemd[1]: awslogs.service: Failed with result 'exit-code'.
Jul 17 18:11:32 Mysql-Slave systemd[1]: awslogs.service: Service hold-off time over, scheduling restart.
Jul 17 18:11:32 Mysql-Slave systemd[1]: Stopped The CloudWatch Logs agent.
Jul 17 18:11:32 Mysql-Slave systemd[1]: Started The CloudWatch Logs agent.
The /var/log/awslogs.log contains these messages:
database is locked
2018-07-17 20:59:01,055 - cwlogs.push - INFO - 27074 - MainThread - Missing or invalid value for use_gzip_http_content_encoding config. Defaulting to using gzip encoding.
2018-07-17 20:59:01,055 - cwlogs.push - INFO - 27074 - MainThread - Using default logging configuration.
database is locked
2018-07-17 20:59:06,549 - cwlogs.push - INFO - 27104 - MainThread - Missing or invalid value for use_gzip_http_content_encoding config. Defaulting to using gzip encoding.
2018-07-17 20:59:06,549 - cwlogs.push - INFO - 27104 - MainThread - Using default logging configuration.
database is locked
2018-07-17 20:59:12,054 - cwlogs.push - INFO - 27110 - MainThread - Missing or invalid value for use_gzip_http_content_encoding config. Defaulting to using gzip encoding.
2018-07-17 20:59:12,054 - cwlogs.push - INFO - 27110 - MainThread - Using default logging configuration.
Any pointers in troubleshooting this will be of great help.
A similar issue was posted in the following link - https://forums.aws.amazon.com/thread.jspa?threadID=165134
I did the following:
a) Stopped the awslogs service
$ service awslogs stop ## Amazon Linux
OR
$ service awslogsd stop ## Amazon Linux 2
b) Deleted the agent-state file in /var/awslogs/state/ (I renamed it in my case)
$ mv agent-state agent-state.old ## Amazon Linux
OR
$ cd /var/lib/awslogs; mv agent-stat agent-stat.old ## Amazon Linux 2
c) Restarted the awslogs service
$ service awslogs start ## Amazon Linux
OR
$ sudo systemctl start awslogsd ## Amazon Linux 2
A new agent-state file was created as a result and the errors mentioned my post disappeared after this.
Please try the following commands based on your Linux version
sudo service awslogs start
If you are running Amazon Linux 2, try the below command
sudo systemctl start awslogsd
took me 2 hours to figure this out
In my case, I found duplicate entries for some properties in /etc/awslogs/awslogs.conf file.
(Not all were duplicates, as some of the properties were commented, and I uncommented them to set values.)
It didn't work. Then I scrolled till the bottom of the file.
I found following entries. Set the values to these properties and it worked.
[/var/log/messages]
datetime_format = %b %d %H:%M:%S
file = /home/ec2-user/application.log
buffer_duration = 5000
log_stream_name = {instance_id}
initial_position = start_of_file
log_group_name = MyProject

docker-machine create with digitalocean driver: ssh command error

I´m using docker tools on windows.
create command was working perfectly last week and I managed to create a number of machines on Digital Ocean. Then I tried today with no success. I repeated the same command with different regions and I always get the same result:
λ docker-machine create -d digitalocean --digitalocean-access-token=MYTOKEN --digitalocean-region=ams2 vmname
Running pre-create checks...
Creating machine...
(fernu) Creating SSH key...
(fernu) Creating Digital Ocean droplet...
(fernu) Waiting for IP address to be assigned to the Droplet...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with ubuntu(systemd)...
Installing Docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Error creating machine: Error running provisioning: ssh command error:
command : sudo systemctl -f start docker
err : exit status 1
output : Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
If I execute the suggested command:
root#fernu:~# systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/docker.service.d
└─10-machine.conf
Active: inactive (dead) (Result: exit-code) since Fri 2017-06-30 20:56:13 UTC; 8min ago
Docs: https://docs.docker.com
Process: 4943 ExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver aufs --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=digitalocean (code=exited, status=1/FAILURE)
Main PID: 4943 (code=exited, status=1/FAILURE)
Jun 30 20:56:13 fernu systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jun 30 20:56:13 fernu systemd[1]: Failed to start Docker Application Container Engine.
Jun 30 20:56:13 fernu systemd[1]: docker.service: Unit entered failed state.
Jun 30 20:56:13 fernu systemd[1]: docker.service: Failed with result 'exit-code'.
Jun 30 20:56:13 fernu systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Jun 30 20:56:13 fernu systemd[1]: Stopped Docker Application Container Engine.
Jun 30 20:56:13 fernu systemd[1]: docker.service: Start request repeated too quickly.
Jun 30 20:56:13 fernu systemd[1]: Failed to start Docker Application Container Engine.
Any help would be appreciated
Update
It´s working with ubuntu 14:
--digitalocean-image=ubuntu-14-04-x64 so it seams like a problem with the default image (ubuntu-16-04-x64)
This seems to be hitting a lot of people. TL;DR: There is a bug in docker-machine v0.12.0 and this issue can be resolved by upgrading.
Logging in to the DigitalOcean instance and running journalctl -xe provides more information:
-- Unit docker.service has begun starting up.
Jul 07 20:03:52 docker-sandbox docker[4930]: `docker daemon` is not supported on Linux. Please run `do
Jul 07 20:03:52 docker-sandbox systemd[1]: docker.service: Main process exited, code=exited, status=1/
Jul 07 20:03:52 docker-sandbox systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
The key here is docker daemon is not supported on Linux. A bug in docker-machine's version comparison code caused an incorrect systemd unit file to be produced (located at /etc/systemd/system/docker.service.d/10-machine.conf) on certain versions of Ubuntu.
A fix has been committed and a new release (v0.12.1) was made.
You can grab the latest release at: https://github.com/docker/machine/releases/tag/v0.12.1