title: Vagrant execute command line user level
body: <p>Would you assist me in executing commands at the user-level when building a VM using vagrant? Specifically, I'm trying to update the "launcher icons" on the left side of Ubuntu's screen. In the below vagrantfile, I've attempted this in both the inline shell and an inline script. I would appreciate any assistance you can provide.</p>
  
  <pre><code>$script = &lt;&lt;SCRIPT
      echo "Configuring Launcher Icons..."
      gsettings set com.canonical.Unity.Launcher favorites "['application://org.gnome.Nautilus.desktop', 'application://chromium-browser.desktop', 'unity://running-apps', 'application://terminator.desktop', 'unity://expo-icon', 'unity://devices']"
      service lightdm restart
  SCRIPT
  
  Vagrant.configure(2) do |config|
      config.vm.box = "box-cutter/ubuntu1604-desktop"
  
      config.vm.provider "virtualbox" do |vb|
          # Display the VirtualBox GUI when booting the machine
          vb.gui = true
          vb.name = "UpdateLauncherIcons"
  
          # Customize the amount of memory on the VM:
          vb.memory = "4096"
      end
  
      config.vm.provision "shell", inline: &lt;&lt;-SHELL
          # Update OS
          apt-get update
          apt-get upgrade
          apt-get --yes install git
          apt-get --yes install terminator
          apt-get --yes install chromium-browser
  
          gsettings set com.canonical.Unity.Launcher favorites "['application://org.gnome.Nautilus.desktop', 'application://chromium-browser.desktop', 'unity://running-apps', 'application://terminator.desktop', 'unity://expo-icon', 'unity://devices']"
          service lightdm restart
  
      SHELL
  
      config.vm.provision "shell", inline: $script
  
  end
  </code></pre>
  
  <p>Note, vagrant does provide an error message when the inline script is executed:</p>
  
  <pre><code>==&gt; default: Running provisioner: shell...
  default: Running: inline script
  ==&gt; default: Configuring Launcher Icons...
  ==&gt; default:
  ==&gt; default: (process:6221): dconf-WARNING **: failed to commit changes to dconf: Cannot autolaunch D-Bus without X11 $DISPLAY
  </code></pre>
  
  <p>Further testing confirms that the below command work well when executed in the guest machine within a terminal window. Again, the challenge is getting this command to work from the vagrantfile executed on the host.</p>
  
  <pre><code>gsettings set com.canonical.Unity.Launcher favorites "['application://org.gnome.Nautilus.desktop', 'application://chromium-browser.desktop', 'unity://running-apps', 'application://terminator.desktop', 'unity://expo-icon', 'unity://devices']"
  </code></pre>