Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

7
How do I debug which dependency prevented a systemd service unit from starting on boot?
Post Body

I am trying to write a systemd service file for a (Gunicorn) web service on Ubuntu 20.04. My current service file is close in spirit to an example in Gunicorn's documentation:

```` [Unit] Description=gunicorn daemon After=network.target

[Service] User=ubuntu Group=ubuntu WorkingDirectory=/home/ubuntu/application/ ExecStart=/usr/bin/gunicorn application.wsgi ExecReload=/bin/kill -s HUP $MAINPID

[Install] WantedBy=multi-user.target ````

This service file works if I manually start the service with sudo systemctl start gunicorn. But if I reboot the machine, the service doesn't start (even though it has been enabled). When I check the logs, I see the following error:

```` ● gunicorn.service - gunicorn daemon Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled) Active: inactive (dead)

Dec 07 17:00:34 ubuntu-focal systemd[1]: Dependency failed for gunicorn daemon. Dec 07 17:00:34 ubuntu-focal systemd[1]: gunicorn.service: Job gunicorn.service/start failed with result 'dependency'. ````

I tried systemctl list-dependencies gunicorn and I get a long list of things that seem to not explicitly list network.target.

gunicorn.service ● ├─-.mount ● ├─home-vagrant-api.mount ● ├─system.slice ● └─sysinit.target ● ├─apparmor.service ● ├─blk-availability.service ● ├─dev-hugepages.mount ● ├─dev-mqueue.mount ● ├─finalrd.service ● ├─keyboard-setup.service ● ├─kmod-static-nodes.service ● ├─lvm2-lvmpolld.socket ● ├─lvm2-monitor.service ● ├─multipathd.service ● ├─open-iscsi.service ● ├─plymouth-read-write.service ● ├─plymouth-start.service ● ├─proc-sys-fs-binfmt_misc.automount ● ├─setvtrgb.service ● ├─sys-fs-fuse-connections.mount ● ├─sys-kernel-config.mount ● ├─sys-kernel-debug.mount ● ├─sys-kernel-tracing.mount ● ├─systemd-ask-password-console.path ● ├─systemd-binfmt.service ● ├─systemd-boot-system-token.service ● ├─systemd-hwdb-update.service ● ├─systemd-journal-flush.service ● ├─systemd-journald.service ● ├─systemd-machine-id-commit.service ● ├─systemd-modules-load.service ● ├─systemd-pstore.service ● ├─systemd-random-seed.service ● ├─systemd-sysctl.service ● ├─systemd-sysusers.service ● ├─systemd-timesyncd.service ● ├─systemd-tmpfiles-setup-dev.service ● ├─systemd-tmpfiles-setup.service ● ├─systemd-udev-trigger.service ● ├─systemd-udevd.service ● ├─systemd-update-utmp.service ● ├─cryptsetup.target ● ├─local-fs.target ● │ ├─-.mount ● │ ├─home-vagrant-api.mount ● │ ├─systemd-remount-fs.service ● │ └─vagrant.mount ● └─swap.target ● └─swapfile.swap

How do I go about debugging which specific dependency is failing to cause my service from auto-starting on boot?

Author
Account Strength
100%
Account Age
5 years
Verified Email
Yes
Verified Flair
Yes
Total Karma
4,780
Link Karma
2,267
Comment Karma
2,445
Profile updated: 4 hours ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago