Vagrant systemctl control failed with failed to connect to bus (updated)

I have a service that I’ve moved on to the VM, and I would like to start it. However, I’m getting a Failed to connect to bus: Operation not permitted. I haven’t been able to find a way around this.

Vagrantfile

# -*- mode: ruby -*-

# vi: set ft=ruby :

$script = <<-SCRIPT

echo "================================"

systemctl --user daemon-reload

systemctl --user start portal.service

echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"

SCRIPT

Vagrant.configure("2") do |config|

  config.vm.define "test-inst" do |dcop|

    test.vm.box = "test"

    test.vm.network "public_network", bridge: "eno1"

    test.vm.synced_folder "./bin", "/home/vagrant/bin"

    test.vm.provision "file", source: "./test.service", destination: "/home/vagrant/.config/systemd/user/test.service"

    test.vm.provision "shell", run: "always" do |cmd|

      cmd.inline = $script

    end

  end

end

The service I’ve written is stored in /etc/systemd/user/test.service

the above results in this

image

One of my first thoughts was that there was an issue with the service itself. Nope. if i log onto the guest machine, I can execute the reload and start commands just fine. Somethings up within Vagrant.

Any thoughts?

UPDATED:
so if I use it as a system service, it works just fine. For some reason if I use it as a user service Vagrant isn’t able to access the user system controls.