/usr/lib/systemd/systemd --system failed to start User Manager because Failed to allocate manager object: Permission denied - systemd

running exec /usr/lib/systemd/systemd --system on ubuntu20.04 container ,After starting the system logging services and creating user slice . it failed to start manager service for the user.
server-ubuntu-20_04-1 | [ OK ] Started System Logging Service.
server-ubuntu-20_04-1 | [ OK ] Created slice system-modprobe.slice.
server-ubuntu-20_04-1 | [ OK ] Created slice User and Session Slice.
server-ubuntu-20_04-1 | Starting Login Service...
server-ubuntu-20_04-1 | [ OK ] Started Login Service.
server-ubuntu-20_04-1 | [ OK ] Created slice User Slice of UID 109.
server-ubuntu-20_04-1 | Starting User Runtime Directory /run/user/109...
server-ubuntu-20_04-1 | [ OK ] Finished User Runtime Directory /run/user/109.
server-ubuntu-20_04-1 | Starting User Manager for UID 109...
server-ubuntu-20_04-1 | [FAILED] Failed to start User Manager for UID 109.
root#server-ubuntu-2004-1:/# systemctl status user#109.service
it is showing failed to allocate manager object: permission denied
● user#109.service - User Manager for UID 109
Loaded: loaded (/lib/systemd/system/user#.service; static; vendor preset: enabled)
Drop-In: /usr/lib/systemd/system/user#.service.d
└─timeout.conf
Active: failed (Result: exit-code) since Mon 2021-03-01 12:24:26 UTC; 3min 36s ago
Docs: man:user#.service(5)
Process: 21190 ExecStart=/lib/systemd/systemd --user (code=exited, status=1/FAILURE)
Main PID: 21190 (code=exited, status=1/FAILURE)
CGroup: /docker/8b7b069bf5f393997a45a292ac3c29c7b2a4aa85406fdb5506a7ae498fe61150/user.slice/user-
109.slice/user#109.service
Mar 01 12:24:26 server-ubuntu-2004-1 systemd[1]: Starting User Manager for UID 109...
Mar 01 12:24:26 server-ubuntu-2004-1 systemd[21190]: pam_unix(systemd-user:session): session opened
for user smmsp by (uid=0)Mar 01 12:24:26 server-ubuntu-2004-1 systemd[21190]: Failed to allocate manager object: Permission denied
Mar 01 12:24:26 server-ubuntu-2004-1 systemd[1]: user#109.service: Main process exited, code=exited, status=1/FAILURE
Mar 01 12:24:26 server-ubuntu-2004-1 systemd[1]: user#109.service: Failed with result 'exit-code'.
Mar 01 12:24:26 server-ubuntu-2004-1 systemd[1]: Failed to start User Manager for UID 109.
Installed systemd packages
libnss-systemd/focal-updates,now 245.4-4ubuntu3.4 amd64 [installed,automatic]
libpam-systemd/focal-updates,now 245.4-4ubuntu3.4 amd64 [installed,automatic]
libsystemd0/focal-updates,now 245.4-4ubuntu3.4 amd64 [installed]
systemd-sysv/focal-updates,now 245.4-4ubuntu3.4 amd64 [installed]
systemd-timesyncd/focal-updates,now 245.4-4ubuntu3.4 amd64 [installed,automatic]
systemd/focal-updates,now 245.4-4ubuntu3.4 amd64 [installed]
root#server-ubuntu-2004-1:/# systemctl list-units
UNIT LOAD ACTIVE SUB DESCRIPTION
dev-mapper-centos\x2dhome.device loaded activating tentative /dev/mapper/centos-home
dev-mapper-centos\x2droot.device loaded activating tentative /dev/mapper/centos-root
-.mount loaded active mounted Root Mount
dev-mqueue.mount loaded active mounted POSIX Message Queue File System
etc-hostname.mount loaded active mounted /etc/hostname
etc-hosts.mount loaded active mounted /etc/hosts
etc-resolv.conf.mount loaded active mounted /etc/resolv.conf
logs.mount loaded active mounted /logs
pbssrc.mount loaded active mounted /pbssrc
run-user-109.mount loaded active mounted /run/user/109
src.mount loaded active mounted /src
workspace-etc.mount loaded active mounted /workspace/etc
init.scope loaded active running System and Service Manager
session-c1.scope loaded active abandoned Session c1 of user smmsp
ci-script-wrapper.service loaded active exited Run ci docker entrypoint script at startup after all systemd services are loaded
console-getty.service loaded active running Console Getty
dbus.service loaded active running D-Bus System Message Bus
getty#tty1.service loaded active running Getty on tty1
rsyslog.service loaded active running System Logging Service
sendmail.service loaded active running LSB: powerful, efficient, and scalable Mail Transport Agent
ssh.service loaded active running OpenBSD Secure Shell server
systemd-journald.service loaded active running Journal Service
systemd-logind.service loaded active running Login Service
systemd-remount-fs.service loaded active exited Remount Root and Kernel File Systems
systemd-tmpfiles-setup-dev.service loaded active exited Create Static Device Nodes in /dev
systemd-tmpfiles-setup.service loaded active exited Create Volatile Files and Directories
systemd-user-sessions.service loaded active exited Permit User Sessions
user-runtime-dir#109.service loaded active exited User Runtime Directory /run/user/109
● user#109.service loaded failed failed User Manager for UID 109
-.slice loaded active active Root Slice
system-getty.slice loaded active active system-getty.slice
system-modprobe.slice loaded active active system-modprobe.slice
system.slice loaded active active System Slice
user-109.slice loaded active active User Slice of UID 109
user.slice loaded active active User and Session Slice
dbus.socket loaded active running D-Bus System Message Bus Socket
syslog.socket loaded active running Syslog Socket
systemd-journald-dev-log.socket loaded active running Journal Socket (/dev/log)
systemd-journald.socket loaded active running Journal Socket
systemd-networkd.socket loaded active listening Network Service Netlink Socket
basic.target loaded active active Basic System
getty.target loaded active active Login Prompts
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
multi-user.target loaded active active Multi-User System
network-online.target loaded active active Network is Online
paths.target loaded active active Paths
slices.target loaded active active Slices
sockets.target loaded active active Sockets
swap.target loaded active active Swap
sysinit.target loaded active active System Initialization
timers.target loaded active active Timers
systemd-tmpfiles-clean.timer loaded active waiting Daily Cleanup of Temporary Directories
Linux server-ubuntu-2004-1 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Related

can't start minio server in ubuntu with systemctl start minio

I configured a minio instance server on the ubuntu 18.04 with the guide from https://www.digitalocean.com/community/tutorials/how-to-set-up-an-object-storage-server-using-minio-on-ubuntu-18-04.
after the installation, the server failed to start with the command "sudo systemctl start minio", the error is saying :
root#iZbp1icuzly3aac0dmjz9aZ:~# sudo systemctl status minio
● minio.service - MinIO
Loaded: loaded (/etc/systemd/system/minio.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2021-12-23 17:11:56 CST; 4s ago
Docs: https://docs.min.io
Process: 9085 ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES (code=exited, status=1/FAILURE)
Process: 9084 ExecStartPre=/bin/bash -c if [ -z "${MINIO_VOLUMES}" ]; then echo "Variable MINIO_VOLUMES not set in /etc/default/minio"; exit 1; fi (code=exited, status=0/SUCCESS)
Main PID: 9085 (code=exited, status=1/FAILURE)
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: minio.service: Main process exited, code=exited, status=1/FAILURE
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: minio.service: Failed with result 'exit-code'.
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: minio.service: Service hold-off time over, scheduling restart.
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: minio.service: Scheduled restart job, restart counter is at 5.
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: Stopped MinIO.
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: minio.service: Start request repeated too quickly.
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: minio.service: Failed with result 'exit-code'.
Dec 23 17:11:56 iZbp1icuzly3aac0dmjz9aZ systemd[1]: Failed to start MinIO.
It looks like the reason is the Variable MINIO_VOLUMES not set in /etc/default/minio.
However, I double check the file from /etc/default/minio
MINIO_ACCESS_KEY="minioadmin"
MINIO_VOLUMES="/usr/local/share/minio/"
MINIO_OPTS="-C /etc/minio --address localhost:9001"
MINIO_SECRET_KEY="minioadmin"
I have set the value MINIO_VOLUMES.
I tried to start manually with minio server --address :9001 /usr/local/share/minio/, it works.
now I don't know what goes wrong with starting the minio server by using the systemctl start minio
I'd recommend sticking to the official documentation wherever possible. It's intended for distributed deployments but the only real change is that your MINIO_VOLUMES will be for a single node/drive.
I would recommend trying a combination of things here:
Review minio.service and ensure the user/group exists
Review file path permissions on the MINIO_VOLUMES value
Now for the why:
My guess without seeing further logs (journalctl -u minio would have been helpful here) is that this is a combination of two things:
the minio.service user/group doesn't have rwx permissions on the /usr/local/share/minio path,
you are missing an environment variable we recently introduced to prevent users from pointing at their root drive (this was intended as a safety measure, but somewhat complicates these kinds of smaller setups).
Take a look at these lines in the minio.service file - I'm assuming that is what you are using based on the instructions in the DO guide.
If you ls -al /usr/local/share/minio I would venture it has ROOT permissions for user and group and limited write access if any.
Hope this helps - for further troubleshooting having at least 10-20 lines from journalctl is invaluable, as it would show the actual error and not just the final quit message.

AWS Linux 2 AMI Failed to get D-Bus connection: No such file or directory

I have an AWS Linux 2 AMI EC2 instance.
When running systemctl --user status I get the message:
Failed to get D-Bus connection: No such file or directory
I then ran systemctl start dbus.socket, which gave me this message:
Failed to start dbus.socket: The name org.freedesktop.PolicyKit1 was not provided by any .service files See system logs and 'systemctl status dbus.socket' for details.
I then ran systemctl status dbus.socket -l which returned this:
dbus.socket - D-Bus System Message Bus Socket
Loaded: loaded (/usr/lib/systemd/system/dbus.socket; static; vendor preset: disabled)
Active: active (running) since Thu 2022-03-31 21:26:42 UTC; 14h ago
Listen: /run/dbus/system_bus_socket (Stream)
Mar 31 21:26:42 ip-10-0-0-193.ec2.internal systemd[1]: Listening on D-Bus System Message Bus Socket.
Mar 31 21:26:42 ip-10-0-0-193.ec2.internal systemd[1]: Starting D-Bus System Message Bus Socket.
Running sudo systemctl --user status gives a different error:
Failed to get D-Bus connection: Connection refused
I'm unsure of what to investigate next or what steps to take to resolve the issue.

System Unit File always failed

I need to deploy my Go app to aws (ec2 instance), with Ubuntu 18.04, however I can't manage to make it run using the systemd. Here is my created service (/lib/systemd/system/go.service)
[Unit]
Description=go api
[Service]
Type=simple
Restart=always
RestartSec=5s
ExecStart=/home/ubuntu/go/amutan
[Install]
WantedBy=multi-user.target
Here is the result when I run sudo service go start, sudo service go status
go.service - go api
Loaded: loaded (/lib/systemd/system/go.service; disabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Tue 2020-02-25 05
Process: 7326 ExecStart=/home/ubuntu/go/amutan (code=exited, status=203/EXEC)
Main PID: 7326 (code=exited, status=203/EXEC)
Feb 25 05:22:46 ip-172-31-27-28 systemd[1]: Stopped go api.
Feb 25 05:22:46 ip-172-31-27-28 systemd[1]: Started go api.
Feb 25 05:22:46 ip-172-31-27-28 systemd[1]: go.service: Main process exited, code=exited, status=203/EXEC
Feb 25 05:22:46 ip-172-31-27-28 systemd[1]: go.service: Failed with result 'exit-code'.
My go binary resides in /home/ubuntu/go which is named amutan.
Any ideas?
That error message is in the official documentation as
203 EXIT_EXEC The actual process execution failed (specifically, the
execve(2) system call). Most likely this is caused by a missing or
non-accessible executable file.
So check permissions, the exact path and things like selinux settings

After Tor project installation, I got error

I am installing tor in my ubuntu 18.04 as per link.After completing all the steps, i am getting this error
$ sudo service tor status
● tor.service - Anonymizing overlay network for TCP (multi-instance-master)
Loaded: loaded (/lib/systemd/system/tor.service; enabled; vendor preset: enabled)
Active: active (exited) since Fri 2018-07-06 11:47:19 IST; 13min ago
Main PID: 10894 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 4554)
CGroup: /system.slice/tor.service
Jul 06 11:47:19 aks-Vostro-1550 systemd[1]: Starting Anonymizing overlay network for TCP (multi-instance-master)...
Jul 06 11:47:19 aks-Vostro-1550 systemd[1]: Started Anonymizing overlay network for TCP (multi-instance-master).
My /lib/systemd/system/tor.service file is:
# This service is actually a systemd target,
# but we are using a service since targets cannot be reloaded.
[Unit]
Description=Anonymizing overlay network for TCP (multi-instance-master)
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
ExecReload=/bin/true
[Install]
WantedBy=multi-user.target
I will be thankful for your help and support.
I have solved my problem in Ubuntu 18.04 using the suggestion given by link

Failed to start system service on centos with ansible-playbook

I created a system service called cooltoo_storage on centos. I am able to start/stop/restart the service by running the command "service cooltoo_storage start/stop/restart". Now I want to configure it on ansible playbook. Below is my config for starting this service.
- name: start cooltoo_storage service
sudo: yes
service:
name: cooltoo_storage
state: started
After running the ansible-playbook, I got below error
msg: Job for cooltoo_storage.service failed because the control process exited with error code. See "systemctl status cooltoo_storage.service" and "journalctl -xe" for details.
FATAL: all hosts have already failed -- aborting
Below is the command output of "systemctl status cooltoo_storage.service",
● cooltoo_storage.service - LSB: cooltoo storage provider
Loaded: loaded (/etc/rc.d/init.d/cooltoo_storage)
Active: failed (Result: exit-code) since Mon 2016-05-02 11:39:07 CST; 1min 5s ago
Docs: man:systemd-sysv-generator(8)
Process: 26661 ExecStart=/etc/rc.d/init.d/cooltoo_storage start (code=exited, status=203/EXEC)
May 02 11:39:07 Cool-Too systemd[1]: Starting LSB: cooltoo storage provider...
May 02 11:39:07 Cool-Too systemd[26661]: Failed at step EXEC spawning /etc/rc.d/init.d/cooltoo_storage: Exec format error
May 02 11:39:07 Cool-Too systemd[1]: cooltoo_storage.service: control process exited, code=exited status=203
May 02 11:39:07 Cool-Too systemd[1]: Failed to start LSB: cooltoo storage provider.
May 02 11:39:07 Cool-Too systemd[1]: Unit cooltoo_storage.service entered failed state.
May 02 11:39:07 Cool-Too systemd[1]: cooltoo_storage.service failed.
How should I fix this issue?
The problem is irrelevant to Ansible.
Your service cooltoo_storage failed to start. Just make sure it works:
sudo systemctl restart cooltoo_storage.service
sudo systemctl status cooltoo_storage.service
And if not - fix it. Probably cooltoo_storage custom written service. Start investigating from checking out startup config for this specific service:
systemctl cat cooltoo_storage.service
and contents of: /etc/rc.d/init.d/cooltoo_storage

Resources