0

I am trying to execute service but result is "Failed to locate executable /usr/sbin/myservice: No such file or directory".

Service runs under chroot.

Service contains:

[Service]
RootDirectory=/chroot/myservice
RootDirectoryStartOnly=true
.
.
ExecStart=/usr/sbin/myservice -n -f /etc/rsyslog.d/myservice.conf
.
.

File is available in the path

ls -l /chroot/myservice/usr/sbin/myservice
lrwxrwxrwx 1 root root 18 Oct 28 14:52 /chroot/myservice/usr/sbin/myservice -> /usr/sbin/rsyslogd

ls -l /chroot/myservice/usr/sbin/rsyslogd
-rwxr-xr-x 1 root root 785600 May  2 20:45 /chroot/myservice/usr/sbin/rsyslogd

Systemd version

systemd 249 (249.11-0ubuntu3.6)
+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY -P11KIT -QRENCODE +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified

Service works fine under Debian10 or Ubuntu20 but cannot start it under Ubuntu 22.

I compared services where it run and doesn't with systemctl show command so I fixed some issues but I am stuck now.

JozefSK
  • 36
  • 2
  • Most probably it's SELINUX preventing you from executing the file, see [this post](https://unix.stackexchange.com/a/679879/512694). – eDonkey Dec 15 '22 at 11:25

0 Answers0