does your service fork? If it does then you need to either find a way for it to not fork or change your configuration to daemon: forking and hope that it works correctly (I’ve seen anecdotal evidence that there may be problems with forking services, but that’s hearsay).
What is mean “service fork”?
I tried what you advised, but it’s not help, error
error: cannot perform the following tasks:
- Start snap "veeam" (unset) services ([start snap.veeam.veeamservice.service] failed with exit status 1: Job for snap.veeam.veeamservice.service failed because the control process exited with error code. See "systemctl status snap.veeam.veeamservice.service" and "journalctl -xe" for details.
)
command result “journalctl -xe”
done.
srp 29 22:38:46 blin-KDENeon sudo[6067]: blin : TTY=pts/0 ; PWD=/media/free/SNAP/Veeam ; USER=root ; COMMAND=/bin/systemctl status snap.veeam.veeamservice.service
srp 29 22:38:46 blin-KDENeon sudo[6067]: pam_unix(sudo:session): session opened for user root by blin(uid=0)
srp 29 22:38:46 blin-KDENeon sudo[6067]: pam_unix(sudo:session): session closed for user root
srp 29 22:38:56 blin-KDENeon sudo[6071]: blin : TTY=pts/0 ; PWD=/media/free/SNAP/Veeam ; USER=root ; COMMAND=/bin/systemctl start snap.veeam.veeamservice.service
srp 29 22:38:56 blin-KDENeon sudo[6071]: pam_unix(sudo:session): session opened for user root by blin(uid=0)
srp 29 22:38:56 blin-KDENeon sudo[6071]: pam_unix(sudo:session): session closed for user root
srp 29 22:45:10 blin-KDENeon sudo[6140]: blin : TTY=pts/0 ; PWD=/media/free/SNAP/Veeam ; USER=root ; COMMAND=/bin/systemctl start snap.veeam.veeamservice.service
srp 29 22:45:10 blin-KDENeon sudo[6140]: pam_unix(sudo:session): session opened for user root by blin(uid=0)
srp 29 22:45:10 blin-KDENeon sudo[6140]: pam_unix(sudo:session): session closed for user root
Most likely I still do not understand how the service works in a snap, but I need to start and stop the service as it is.
Is there another way?
This service is needed for work main program.
it works like any other systemd service, during install snapd creates a service unit for systemd based on teh info you give in snapcraft.yaml …
you can inspect all these unit files for installed snaps with:
ls /etc/systemd/system/*service|grep snap\\.
often the --start and --stop calls are not necessarily needed when you let systemd do the handling, but if you tried and it does not work (because it is originally a sysvinit script or does some other special setup/teardown things due to the options) then … well … it was at least worth a try …
@ogra
When I start the service in normal mode without snap, I do
sudo service veeamservice start
And now I found in /etc/init.d file veeamservice
I have now found in description that the service starts as initd.
How in this case it is necessary to launch service in a snap?
Thx.
Hi.
This is what the file looks like, which is located the way /etc/init.d/veeamservice
# Author: Veeam Software AG <https://www.veeam.com/contacts.html>
# Do NOT "set -e"
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Veeam Agent for Linux service"
NAME=veeamservice
DAEMON=/usr/sbin/$NAME
PIDFILE=/var/run/$NAME.pid
DAEMON_ARGS="--daemonize --pidfile=$PIDFILE"
SCRIPTNAME=/etc/init.d/$NAME
MODULE_NAME="veeamsnap"
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
What should I do? To re-create the script so that it runs the service as a systemd or it is necessary in snapcraft.yaml what to write for the correct start, and run without a script?
Try removing it entirely, just running usr/sbin/veeamservice, with daemon: simple. If you need to keep --daemonize you almost certainly need daemon: forking (but that’s more brittle).
also: did you connect all the interfaces you defined in the plugs section ? not all of them do auto-connect, you will need to manually use snap connect to connect them … specifically serial-port and raw-usb (and for serial-port you will likely need some other snap to actually provide that interface)
sudo systemctl status snap.veeam.veeamservice.service
● snap.veeam.veeamservice.service - Service for snap application veeam.veeamservice
Loaded: loaded (/etc/systemd/system/snap.veeam.veeamservice.service; enabled; vendor preset: enabled)
Active: failed (Result: core-dump) since Sat 2018-09-01 13:32:56 CEST; 5min ago
Process: 11833 ExecStart=/usr/bin/snap run veeam.veeamservice (code=dumped, signal=SEGV)
Main PID: 11833 (code=dumped, signal=SEGV)
сен 01 13:32:56 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Service hold-off time over, scheduling restart.
сен 01 13:32:56 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Scheduled restart job, restart counter is at 5.
сен 01 13:32:56 blin-System-Product-Name systemd[1]: Stopped Service for snap application veeam.veeamservice.
сен 01 13:32:56 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Start request repeated too quickly.
сен 01 13:32:56 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'core-dump'.
сен 01 13:32:56 blin-System-Product-Name systemd[1]: Failed to start Service for snap application veeam.veeamservice.
did you check what errors there are exactly when the serivice tries to start ?
do the following: open two terminals and put them next to each other, run journalctl -f in one of them … i tend to hit enter a few times in that termianl to make sure i can easily find where my logging started.
now run sudo snap restart veeam in the other terminal and look for errors from the veeamservice process but also “audit” and “DENIED” messages.