Can not start service

you need to add libuuid1 to your stage-packages …

There is something clearly wrong with this binary, was it compiled on a 16.04 system ? (a guess here would be that it links against the wrong libc version and thus runs into a segfault, but i can only wildly guess without knowing how that binary was created)

After when I added libuuid1 and reinstal snap, command sudo snap restart veeam I see such a result

сен 01 14:17:59 blin-System-Product-Name sudo[23008]:     blin : TTY=pts/1 ; PWD=/home/blin ; USER=root ; COMMAND=/usr/bin/snap restart veeam
сен 01 14:17:59 blin-System-Product-Name sudo[23008]: pam_unix(sudo:session): session opened for user root by (uid=0)
сен 01 14:17:59 blin-System-Product-Name systemd[1]: Started Service for snap application veeam.veeamservice.
сен 01 14:17:59 blin-System-Product-Name kernel: show_signal_msg: 18 callbacks suppressed
сен 01 14:17:59 blin-System-Product-Name kernel: veeamservice[23023]: segfault at 0 ip 0000000000000000 sp 00007ffca374aec8 error 14 in veeamservice[400000+1288000]
сен 01 14:17:59 blin-System-Product-Name sudo[23008]: pam_unix(sudo:session): session closed for user root
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Main process exited, code=dumped, status=11/SEGV
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'core-dump'.
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Service hold-off time over, scheduling restart.
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Scheduled restart job, restart counter is at 1.
сен 01 14:18:00 blin-System-Product-Name systemd[1]: Stopped Service for snap application veeam.veeamservice.
сен 01 14:18:00 blin-System-Product-Name systemd[1]: Started Service for snap application veeam.veeamservice.
сен 01 14:18:00 blin-System-Product-Name kernel: veeamservice[23039]: segfault at 0 ip 0000000000000000 sp 00007fff8189f038 error 14 in veeamservice[400000+1288000]
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Main process exited, code=dumped, status=11/SEGV
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'core-dump'.
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Service hold-off time over, scheduling restart.
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Scheduled restart job, restart counter is at 2.
сен 01 14:18:00 blin-System-Product-Name systemd[1]: Stopped Service for snap application veeam.veeamservice.
сен 01 14:18:00 blin-System-Product-Name systemd[1]: Started Service for snap application veeam.veeamservice.
сен 01 14:18:00 blin-System-Product-Name kernel: veeamservice[23054]: segfault at 0 ip 0000000000000000 sp 00007ffde807c778 error 14 in veeamservice[400000+1288000]
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Main process exited, code=dumped, status=11/SEGV
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'core-dump'.
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Service hold-off time over, scheduling restart.
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Scheduled restart job, restart counter is at 3.
сен 01 14:18:00 blin-System-Product-Name systemd[1]: Stopped Service for snap application veeam.veeamservice.
сен 01 14:18:00 blin-System-Product-Name systemd[1]: Started Service for snap application veeam.veeamservice.
сен 01 14:18:00 blin-System-Product-Name kernel: veeamservice[23071]: segfault at 0 ip 0000000000000000 sp 00007ffc9d921b28 error 14 in veeamservice[400000+1288000]
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Main process exited, code=dumped, status=11/SEGV
сен 01 14:18:00 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'core-dump'.
сен 01 14:18:01 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Service hold-off time over, scheduling restart.
сен 01 14:18:01 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Scheduled restart job, restart counter is at 4.
сен 01 14:18:01 blin-System-Product-Name systemd[1]: Stopped Service for snap application veeam.veeamservice.
сен 01 14:18:01 blin-System-Product-Name systemd[1]: Started Service for snap application veeam.veeamservice.
сен 01 14:18:01 blin-System-Product-Name kernel: veeamservice[23088]: segfault at 0 ip 0000000000000000 sp 00007ffc22fd4608 error 14 in veeamservice[400000+1288000]
сен 01 14:18:01 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Main process exited, code=dumped, status=11/SEGV
сен 01 14:18:01 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'core-dump'.
сен 01 14:18:01 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Service hold-off time over, scheduling restart.
сен 01 14:18:01 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Scheduled restart job, restart counter is at 5.
сен 01 14:18:01 blin-System-Product-Name systemd[1]: Stopped Service for snap application veeam.veeamservice.
сен 01 14:18:01 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Start request repeated too quickly.
сен 01 14:18:01 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'core-dump'.
сен 01 14:18:01 blin-System-Product-Name systemd[1]: Failed to start Service for snap application veeam.veeamservice.

@ogra
And I also noticed when building snap package here is such a message, I do not know how much it can influence

Files from the build host were migrated into the snap to satisfy dependencies that would otherwise not be met. This feature will be removed in a future release. If these libraries are needed in the final snap, ensure that the following are either satisfied by a stage-packages entry or through a part:
usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
The GLIBC version of the targeted core is 2.23. A newer libc will be required for the following files:
- /media/free/SNAP/Veeam/prime/lib/x86_64-linux-gnu/libbsd.so.0.8.7 (requires GLIBC 2.25)
- /media/free/SNAP/Veeam/prime/lib/x86_64-linux-gnu/libexpat.so.1.6.7 (requires GLIBC 2.25)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/dri/virtio_gpu_dri.so (requires GLIBC 2.27)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/dri/nouveau_dri.so (requires GLIBC 2.27)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/dri/i915_dri.so (requires GLIBC 2.27)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/dri/vmwgfx_dri.so (requires GLIBC 2.27)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/libxshmfence.so.1.0.0 (requires GLIBC 2.27)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/libgnutls.so.30.14.10 (requires GLIBC 2.25)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/dri/r200_dri.so (requires GLIBC 2.27)
- /media/free/SNAP/Veeam/prime/lib/x86_64-linux-gnu/libuuid.so.1.3.0 (requires GLIBC 2.25)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/libp11-kit.so.0.3.0 (requires GLIBC 2.26)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/dri/radeon_dri.so (requires GLIBC 2.27)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/dri/r300_dri.so (requires GLIBC 2.27)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/dri/swrast_dri.so (requires GLIBC 2.27)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/dri/kms_swrast_dri.so (requires GLIBC 2.27)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/dri/radeonsi_dri.so (requires GLIBC 2.27)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/libexpatw.so.1.6.7 (requires GLIBC 2.25)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/dri/i965_dri.so (requires GLIBC 2.27)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/dri/r600_dri.so (requires GLIBC 2.27)
- /media/free/SNAP/Veeam/prime/lib/x86_64-linux-gnu/libcrypt-2.27.so (requires GLIBC 2.25)
- /media/free/SNAP/Veeam/prime/lib/x86_64-linux-gnu/libblkid.so.1.1.0 (requires GLIBC 2.25)
- /media/free/SNAP/Veeam/prime/usr/lib/x86_64-linux-gnu/dri/nouveau_vieux_dri.so (requires GLIBC 2.27)

you seem to not be using a xenial (16.04) host when building nor do you seem to build with snapcraft cleanbuild … either will be fine to fix this issue …

Yes, you are right, this application is going to another version of the debian. But when there is a package installation with this application, then the dependencies are installed in the system such packages
Depends: libfuse2, libacl1, libattr1, libstdc++6, libgcc1, lvm2, libc6, libblkid1, libncurses5, veeamsnap (= 3.0.0.486), libmagic1
and after already the application can be used. There are no problems.
What is the problem then?

snap packages are executed on top of the core snap which ships glibc, the binaries you are using need to be built against this glibc … the default core snap is currently 16.04 (xenial) based so your binaries need to be built against this libc.

you should always use snapcraft cleanbuild or the right host version (16.04/xenial) when not using cleanbuild to produce a snap, since this will make sure that the binary versions match.

indeed the same also applies to the app you are snapping, its binaries need to be linked against the right libraries … this is btw pretty basic stuff that has nothing to do with snaps, library versions you link a binary against at build time need to match the runtime binary versions of the libraries (this is even true on windows :wink: ).

just make sure you use snapcraft cleanbuild when building your snap and make sure your veeam binaries were compiled against the correct library versions, then your segfaults will go away.

Maybe this is a stupid question, but what does command snapcraft cleanbuild do?))
If I build a snap package then I always just did snapcraft.
Thx

It builds your snap inside a clean lxd container and makes sure the library versions match the used core snap.

see:

snapcraft cleanbuild --help

Could you briefly describe the steps for building a snap this way?
lxd I installed
sudo snap install lxd
lxd 3.4 from Canonical✓ installed

sudo adduser $USER lxd

log out and back in to make the new group take effect

sudo lxd init

just hit enter and accept all defaults

… like it is described in the pages linked from snapcraft cleanbuild --help …

then you can just use snapcraft cleanbuild

After I did snapcraft cleanbuild and installed the snap package, I did restart sudo snap restart veeam and saw this message

сен 02 22:03:56 blin-System-Product-Name sudo[3345]:     blin : TTY=pts/1 ; PWD=/home/blin ; USER=root ; COMMAND=/usr/bin/snap restart veeam
сен 02 22:03:56 blin-System-Product-Name sudo[3345]: pam_unix(sudo:session): session opened for user root by (uid=0)
сен 02 22:03:56 blin-System-Product-Name systemd[1]: Started Service for snap application veeam.veeamservice.
сен 02 22:03:56 blin-System-Product-Name audit[3372]: AVC apparmor="ALLOWED" operation="chmod" profile="snap.veeam.veeamservice" name="/var/log/veeam/config/" pid=3372 comm="veeamservice" requested_mask="w" denied_mask="w" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name audit[3372]: AVC apparmor="ALLOWED" operation="open" profile="snap.veeam.veeamservice" name="/var/log/veeam/veeamsvc.log" pid=3372 comm="veeamservice" requested_mask="wrc" denied_mask="wrc" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name audit[3372]: AVC apparmor="ALLOWED" operation="open" profile="snap.veeam.veeamservice" name="/var/log/veeam/veeamsvc.log" pid=3372 comm="veeamservice" requested_mask="wrc" denied_mask="wrc" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name audit[3372]: AVC apparmor="ALLOWED" operation="file_lock" profile="snap.veeam.veeamservice" name="/var/log/veeam/veeamsvc.log" pid=3372 comm="veeamservice" requested_mask="wk" denied_mask="wk" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name kernel: kauditd_printk_skb: 30 callbacks suppressed
сен 02 22:03:56 blin-System-Product-Name kernel: audit: type=1400 audit(1535918636.712:201): apparmor="ALLOWED" operation="chmod" profile="snap.veeam.veeamservice" name="/var/log/veeam/config/" pid=3372 comm="veeamservice" requested_mask="w" denied_mask="w" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name kernel: audit: type=1400 audit(1535918636.712:202): apparmor="ALLOWED" operation="open" profile="snap.veeam.veeamservice" name="/var/log/veeam/veeamsvc.log" pid=3372 comm="veeamservice" requested_mask="wrc" denied_mask="wrc" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name kernel: audit: type=1400 audit(1535918636.712:203): apparmor="ALLOWED" operation="open" profile="snap.veeam.veeamservice" name="/var/log/veeam/veeamsvc.log" pid=3372 comm="veeamservice" requested_mask="wrc" denied_mask="wrc" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name kernel: audit: type=1400 audit(1535918636.712:204): apparmor="ALLOWED" operation="file_lock" profile="snap.veeam.veeamservice" name="/var/log/veeam/veeamsvc.log" pid=3372 comm="veeamservice" requested_mask="wk" denied_mask="wk" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name audit[3372]: AVC apparmor="ALLOWED" operation="open" profile="snap.veeam.veeamservice" name="/var/lib/veeam/svclock" pid=3372 comm="veeamservice" requested_mask="wrc" denied_mask="wrc" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name audit[3372]: AVC apparmor="ALLOWED" operation="file_lock" profile="snap.veeam.veeamservice" name="/var/lib/veeam/svclock" pid=3372 comm="veeamservice" requested_mask="wk" denied_mask="wk" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name audit[3372]: AVC apparmor="ALLOWED" operation="truncate" profile="snap.veeam.veeamservice" name="/var/lib/veeam/svclock" pid=3372 comm="veeamservice" requested_mask="w" denied_mask="w" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name audit[3372]: AVC apparmor="ALLOWED" operation="chmod" profile="snap.veeam.veeamservice" name="/var/lib/veeam/veeam_db.sqlite" pid=3372 comm="veeamservice" requested_mask="w" denied_mask="w" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name veeam.veeamservice[3372]: File /usr/share/veeam/lpb_upgrade_scheme.sql was not found.
сен 02 22:03:56 blin-System-Product-Name veeam.veeamservice[3372]: --tr:Failed to load SQL upgrade script '/usr/share/veeam/lpb_upgrade_scheme.sql'.
сен 02 22:03:56 blin-System-Product-Name veeam.veeamservice[3372]: --tr:Unable upgrade db: /var/lib/veeam/veeam_db.sqlite.
сен 02 22:03:56 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Main process exited, code=exited, status=1/FAILURE
сен 02 22:03:56 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'exit-code'.
сен 02 22:03:56 blin-System-Product-Name kernel: audit: type=1400 audit(1535918636.740:205): apparmor="ALLOWED" operation="open" profile="snap.veeam.veeamservice" name="/var/lib/veeam/svclock" pid=3372 comm="veeamservice" requested_mask="wrc" denied_mask="wrc" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name kernel: audit: type=1400 audit(1535918636.740:206): apparmor="ALLOWED" operation="file_lock" profile="snap.veeam.veeamservice" name="/var/lib/veeam/svclock" pid=3372 comm="veeamservice" requested_mask="wk" denied_mask="wk" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name kernel: audit: type=1400 audit(1535918636.740:207): apparmor="ALLOWED" operation="truncate" profile="snap.veeam.veeamservice" name="/var/lib/veeam/svclock" pid=3372 comm="veeamservice" requested_mask="w" denied_mask="w" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name kernel: audit: type=1400 audit(1535918636.740:208): apparmor="ALLOWED" operation="chmod" profile="snap.veeam.veeamservice" name="/var/lib/veeam/veeam_db.sqlite" pid=3372 comm="veeamservice" requested_mask="w" denied_mask="w" fsuid=0 ouid=0
сен 02 22:03:56 blin-System-Product-Name sudo[3345]: pam_unix(sudo:session): session closed for user root
сен 02 22:03:56 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Service hold-off time over, scheduling restart.
сен 02 22:03:56 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Scheduled restart job, restart counter is at 1.
сен 02 22:03:56 blin-System-Product-Name systemd[1]: Stopped Service for snap application veeam.veeamservice.
сен 02 22:03:56 blin-System-Product-Name systemd[1]: Started Service for snap application veeam.veeamservice.

This shows you are now past the segfault error but that your app needs a lot of changes to not search in /var and /usr but instead in $SNAP/var and $SNAP/usr …

recompile the app with the correct paths set or find a config file where you can set them (if the app provides one) or, if the app suports this, use environment variables you set in the apps: section of your snapcraft.yaml

to get proper hints about the errors, you can again open two terminals, install snappy-debug:

sudo snap install snappy-debug

and run:

snappy-debug.security scanlog veeam

…in one of them

then run sudo snap restart veeam in the other and look at the output with suggestions that snappy-debug prints in the first terminal. try to adjust your app according to the suggestions and you should be good.

I would like to clarify about these lines:

veeam.veeamservice[3372]: File /usr/share/veeam/lpb_upgrade_scheme.sql was not found.
veeam.veeamservice[3372]: --tr:Failed to load SQL upgrade script '/usr/share/veeam/lpb_upgrade_scheme.sql'.
veeam.veeamservice[3372]: --tr:Unable upgrade db: /var/lib/veeam/veeam_db.sqlite.

And the second moment
These lines

apparmor="ALLOWED" operation="chmod" profile="snap.veeam.veeamservice" name="/var/log/veeam/config/" pid=3372 comm="veeamservice" requested_mask="w" denied_mask="w" fsuid=0 ouid=0
apparmor="ALLOWED" operation="open" profile="snap.veeam.veeamservice" name="/var/log/veeam/veeamsvc.log" pid=3372 comm="veeamservice" requested_mask="wrc" denied_mask="wrc" fsuid=0 ouid=0
apparmor="ALLOWED" operation="open" profile="snap.veeam.veeamservice" name="/var/log/veeam/veeamsvc.log" pid=3372 comm="veeamservice" requested_mask="wrc" denied_mask="wrc" fsuid=0 ouid=0
 apparmor="ALLOWED" operation="file_lock" profile="snap.veeam.veeamservice" name="/var/log/veeam/veeamsvc.log" pid=3372 comm="veeamservice" requested_mask="wk" denied_mask="wk" fsuid=0 ouid=0

These are the log files into which the service itself will write and the applications that will work through this service.
How can this be realized?

Read my last post, you need to adjust the application to use proper paths relative to $SNAP, by either patching it if it has the paths hardcoded, by adjusting them in the config file if it has one, by passing proper cmdline options to the service in the command: line if it allows this or by setting environment variables in the apps: section.

Hello @ogra
The next step in solving the problem with the launch of the service)
I created script for systemd, it’s look like

[Unit]
Description=Veeam Agent for Linux service daemon
After=network.target

[Service]
Environment="PIDFILE=/var/run/veeamservice.pid"
PIDFile=/var/run/veeamservice.pid
Type=forking
ExecStart=/usr/sbin/veeamservice --daemonize --pidfile=${PIDFILE}
TimeoutStopSec=30
KillMode=process

[Install]
WantedBy=multi-user.target

P.S., to work with the service and application need to create a group of veeam in the system and the user was in the group. I did it.
Command journalctl -f when I restarting the service produces such a message

сен 06 21:24:14 blin-System-Product-Name sudo[7952]:     blin : TTY=pts/1 ; PWD=/home/blin ; USER=root ; COMMAND=/bin/systemctl start snap.veeam.veeamservice.service
сен 06 21:24:14 blin-System-Product-Name sudo[7952]: pam_unix(sudo:session): session opened for user root by (uid=0)
сен 06 21:24:14 blin-System-Product-Name systemd[1]: Started Service for snap application veeam.veeamservice.
сен 06 21:24:14 blin-System-Product-Name sudo[7952]: pam_unix(sudo:session): session closed for user root
сен 06 21:24:14 blin-System-Product-Name veeam.veeamservice[7955]: /snap/veeam/x1/command-veeamservice.wrapper: 5: exec: /snap/veeam/x1/etc/systemd/system/veeamservice.service: Permission denied
сен 06 21:24:14 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Main process exited, code=exited, status=126/n/a
сен 06 21:24:14 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'exit-code'.
сен 06 21:24:14 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Service hold-off time over, scheduling restart.
сен 06 21:24:14 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Scheduled restart job, restart counter is at 1.
сен 06 21:24:14 blin-System-Product-Name systemd[1]: Stopped Service for snap application veeam.veeamservice.
сен 06 21:24:14 blin-System-Product-Name systemd[1]: Started Service for snap application veeam.veeamservice.
сен 06 21:24:14 blin-System-Product-Name veeam.veeamservice[7971]: /snap/veeam/x1/command-veeamservice.wrapper: 5: exec: /snap/veeam/x1/etc/systemd/system/veeamservice.service: Permission denied
сен 06 21:24:14 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Main process exited, code=exited, status=126/n/a
сен 06 21:24:14 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'exit-code'.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Service hold-off time over, scheduling restart.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Scheduled restart job, restart counter is at 2.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: Stopped Service for snap application veeam.veeamservice.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: Started Service for snap application veeam.veeamservice.
сен 06 21:24:15 blin-System-Product-Name veeam.veeamservice[7987]: /snap/veeam/x1/command-veeamservice.wrapper: 5: exec: /snap/veeam/x1/etc/systemd/system/veeamservice.service: Permission denied
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Main process exited, code=exited, status=126/n/a
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'exit-code'.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Service hold-off time over, scheduling restart.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Scheduled restart job, restart counter is at 3.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: Stopped Service for snap application veeam.veeamservice.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: Started Service for snap application veeam.veeamservice.
сен 06 21:24:15 blin-System-Product-Name veeam.veeamservice[8003]: /snap/veeam/x1/command-veeamservice.wrapper: 5: exec: /snap/veeam/x1/etc/systemd/system/veeamservice.service: Permission denied
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Main process exited, code=exited, status=126/n/a
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'exit-code'.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Service hold-off time over, scheduling restart.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Scheduled restart job, restart counter is at 4.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: Stopped Service for snap application veeam.veeamservice.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: Started Service for snap application veeam.veeamservice.
сен 06 21:24:15 blin-System-Product-Name veeam.veeamservice[8018]: /snap/veeam/x1/command-veeamservice.wrapper: 5: exec: /snap/veeam/x1/etc/systemd/system/veeamservice.service: Permission denied
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Main process exited, code=exited, status=126/n/a
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'exit-code'.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Service hold-off time over, scheduling restart.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Scheduled restart job, restart counter is at 5.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: Stopped Service for snap application veeam.veeamservice.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Start request repeated too quickly.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: snap.veeam.veeamservice.service: Failed with result 'exit-code'.
сен 06 21:24:15 blin-System-Product-Name systemd[1]: Failed to start Service for snap application veeam.veeamservice.

Why can there be such a message?

snaps generate the service file themselves, you can not manually create one and just ship it … instead make sure that you have a proper apps: entry for the service you want started, like:

apps:
  veeamservice:
    command: usr/sbin/veeamservice
    daemon: simple
    plugs: [ add whatever plugs you need here ... ]

this will create snap.veeam.veeamservice.service at snap install time and give it all the right permissions.

shipping a hand crafted file will be denied execution.

@ogra
Now I have done everything as you advised me.
I’m getting strange errors now

 Copying needed target link from the system /dev/null
Pulling integration 
Pulling veeam 
Building integration 
Building veeam 
Staging integration 
Staging veeam 
Priming integration 
warning: working around a Linux kernel bug by creating a hole of 2220032 bytes in ‘/tmp/tmpu9uozp78’
warning: working around a Linux kernel bug by creating a hole of 2097152 bytes in ‘/tmp/tmpch6plyti’
warning: working around a Linux kernel bug by creating a hole of 2097152 bytes in ‘/tmp/tmphstzcem8’
warning: working around a Linux kernel bug by creating a hole of 2109440 bytes in ‘/tmp/tmpxxhzdk57’
warning: working around a Linux kernel bug by creating a hole of 2101248 bytes in ‘/tmp/tmpjqdpnx4o’
warning: working around a Linux kernel bug by creating a hole of 2076672 bytes in ‘/tmp/tmpdcdesgie’
Priming veeam 
'grade' property not specified: defaulting to 'stable'
Sorry, Snapcraft ran into an error when trying to running through its
lifecycle that generated the following traceback:
Traceback (most recent call last):
  File "/usr/bin/snapcraft", line 9, in <module>
    load_entry_point('snapcraft==2.43', 'console_scripts', 'snapcraft')()
  File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/lifecycle.py", line 136, in snap
    project = _execute(steps.PRIME, parts=[], **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/lifecycle.py", line 35, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 90, in execute
    executor.run(step, part_names)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 196, in run
    self._create_meta(step, processed_part_names)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 359, in _create_meta
    self.config.validator.schema,
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/_snap_packaging.py", line 109, in create_snap_packaging
    packaging.write_snap_yaml()
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/_snap_packaging.py", line 312, in write_snap_yaml
    snap_yaml = self._compose_snap_yaml()
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/_snap_packaging.py", line 468, in _compose_snap_yaml
    snap_yaml["apps"] = self._wrap_apps(self._config_data["apps"])
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/_snap_packaging.py", line 567, in _wrap_apps
    self._wrap_app(app, apps[app])
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/_snap_packaging.py", line 575, in _wrap_app
    app[k] = self._wrap_exe(app[k], "{}-{}".format(k, name))
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/_snap_packaging.py", line 546, in _wrap_exe
    with open(exepath, "rb") as exefile:
FileNotFoundError: [Errno 2] No such file or directory: '/root/build_veeam/prime/usr/bin/veeamservice'
"Submitting this error to the Snapcraft developers is not possible through the CLI
without Raven installed.
If you wish to report this issue, please copy the contents of the previous traceback
and submit manually at https://launchpad.net/snapcraft/+filebug.
Stopping local:snapcraft-mainly-active-zebra

your build step seems to not have put the veeamservice binary into usr/bin/ inside your tree …

you can run find prime/ -name veeamservice in the toplevel of your build tree, to see if it was put somewhere else … since apparently you had a snap before that did actually build, what did you change ?

The error was found and corrected.
At the moment, the error message looks like this:

-- Logs begin at Thu 2018-07-26 21:19:29 CEST. --
сен 09 18:40:11 blin-System-Product-Name audit[15169]: AVC apparmor="ALLOWED" operation="mknod" profile="snap.veeam.veeamservice" name="/var/lib/veeam/veeam_db.sqlite" pid=15169 comm="veeamservice" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
сен 09 18:40:11 blin-System-Product-Name audit[15169]: AVC apparmor="ALLOWED" operation="open" profile="snap.veeam.veeamservice" name="/var/lib/veeam/veeam_db.sqlite" pid=15169 comm="veeamservice" requested_mask="wrc" denied_mask="wrc" fsuid=0 ouid=0
сен 09 18:40:11 blin-System-Product-Name audit[15169]: AVC apparmor="ALLOWED" operation="file_lock" profile="snap.veeam.veeamservice" name="/var/lib/veeam/veeam_db.sqlite" pid=15169 comm="veeamservice" requested_mask="k" denied_mask="k" fsuid=0 ouid=0
сен 09 18:40:11 blin-System-Product-Name audit[15169]: AVC apparmor="ALLOWED" operation="mknod" profile="snap.veeam.veeamservice" name="/var/lib/veeam/veeam_db.sqlite-journal" pid=15169 comm="veeamservice" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
сен 09 18:40:11 blin-System-Product-Name audit[15169]: AVC apparmor="ALLOWED" operation="open" profile="snap.veeam.veeamservice" name="/var/lib/veeam/veeam_db.sqlite-journal" pid=15169 comm="veeamservice" requested_mask="wrc" denied_mask="wrc" fsuid=0 ouid=0
сен 09 18:40:11 blin-System-Product-Name audit[15169]: AVC apparmor="ALLOWED" operation="chown" profile="snap.veeam.veeamservice" name="/var/lib/veeam/veeam_db.sqlite-journal" pid=15169 comm="veeamservice" requested_mask="w" denied_mask="w" fsuid=0 ouid=0
сен 09 18:40:11 blin-System-Product-Name audit[15169]: AVC apparmor="ALLOWED" operation="open" profile="snap.veeam.veeamservice" name="/var/lib/veeam/" pid=15169 comm="veeamservice" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
сен 09 18:40:11 blin-System-Product-Name audit[15169]: AVC apparmor="ALLOWED" operation="unlink" profile="snap.veeam.veeamservice" name="/var/lib/veeam/veeam_db.sqlite-journal" pid=15169 comm="veeamservice" requested_mask="d" denied_mask="d" fsuid=0 ouid=0
сен 09 18:40:11 blin-System-Product-Name veeamservice[15169]: Service has failed. File /usr/share/veeam/lpb_scheme.sql was not found.
                                                                 Unable to load SQL query from [/usr/share/veeam/lpb_scheme.sql].
                                                                 Unable to run SQL script [/usr/share/veeam/lpb_scheme.sql].
                                                                 SQLiteDbAccessor: Unable to create DB scheme.

Together with the application there is a file of veeam.ini, in which there are important variables, it will changes. That is, the file should not be in a snap but should be copied and located in the system itself.
it’s must be in /etc/veeam/veeam.ini
This also applies to some log files.
Question: How to copy it to the system from snap?
Some Important Paths to Files for the Service:

[db]
# Veeam database path
# path= ${SNAP}/var/lib/veeam/veeam_db.sqlite

# Veeam database scheme path
# schemePath= ${SNAP}/usr/share/veeam/lpb_scheme.sql

# Veeam database upgrade scheme path
# schemeUpgradePath= ${SNAP}/usr/share/veeam/lpb_upgrade_scheme.sql

# Logs path
# logsFolder= /var/log/veeam

# Logs rotation period, days
# logsRotateDays= 14

# Temp directory path
# temporaryDirectory= /tmp/veeam

As you can see some log files, some files are the ones that will not change, for example scripts to create a database in the system.

And one more thing, when installing the application from the package, some scripts are used that prepare everything for work.
For example:

#!/bin/sh
set -e

PATH=$PATH:/usr/sbin
GROUP="veeam"

_setup_user()
{
    if ! getent group $GROUP >/dev/null; then
        groupadd --system $GROUP
    fi
}

case "$1" in
    configure)

        _setup_user
        mkdir -p /var/log/veeam/
        mkdir -p -m 2775 /var/log/veeam/config
        chgrp $GROUP /usr/bin/veeamconfig
        chgrp $GROUP /var/log/veeam/config

I’m trying to figure out how this can be used during the snap package installation?