Deploy app to VM

Hi all,

I’m struggling a bit to deploy app to a dedicated VM. App build stage is OK, it passes, but the problem that I am facing is when I try to deploy app to the dedicated VM it gives the following error:
ln: failed to create symbolic link ‘/sys/fs/cgroup/systemd/name=systemd’: Operation not permitted

Finding any information on internet it points to the docker storage on the dedicated VM. Currently I am using overlay2 and not sure if this really causing it or not.
Also, I installed and configured runner which is locked to my specific project that I am trying to deploy. From gitlab I see that runner is running, seems all ok with this to me.
So not sure what am I missing or did I correctly setup dedicated VM. Please be aware that I am kind of new to this so if you need additional information to troubleshoot this please let me know.
Thanks in advance.

Hi @gbsistemos

Whereabouts is that ln? Is it in your .gitlab-ci.yml file or is it inside a Dockerfile?

If it’s in your CI config, I’m wondering whether your gitlab-runner user is in the docker group, and has all the right permissions?

If it’s in a Dockerfile, then maybe you need a USER statement somewhere, so that the ln is run by the right user with the right permissions?

Either way, I doubt it’s the overlay2 system, that’s very much an internal Docker thing that should be transparent to your code.

So the full error message looks like this:

ln: failed to create symbolic link ‘/sys/fs/cgroup/systemd/name=systemd’: Operation not permitted

(https://gitlab.com/)$ scp -p $SSH_PRIVATE_KEY -r ./docker-compose.autodeploy.yml user@$DEPLOY_SERVER_IP:~/

(https://gitlab.com/)Host key verification failed.

(https://gitlab.com)lost connection

(https://gitlab.com/)Cleaning up project directory and file based variables

(https://gitlab.com/)ERROR: Job failed: exit code 1

So the user on dedicated VM is created and added to the wheel group. Also private key is configured, I put it in the gitlab.com->Settings->CI/CD variables. Not sure if host key verification is caused by not creating ln or is it really permissions? Because connecting with the same private key from other machines works fine. But again user is in the wheel group.

Oh, so that error looks quite different. It seems that the Host key verification failed. is the important bit here.

Assuming that the DEPLOY_SERVER_IP is correct, I’d guess that the private key isn’t right for that user on that server.

If I were you, I’d start by running that scp command, exactly as it is in the log, from the command line. If the scp doesn’t work, then you know that something is up with the key.

If it does work, I’d check what rights user, and user is definitely in the right groups, I’d try running the deploy script on the server, as that user, to see where you get an error.

HTH