Parallels / vagrant-parallels

Vagrant Parallels Provider
https://parallels.github.io/vagrant-parallels
MIT License
996 stars 87 forks source link

Share Linux app with mac, defined shortcuts and clipboard sharing does not work when I install xfce #431

Open zarinfam opened 1 year ago

zarinfam commented 1 year ago

I install the generic/ubuntu2204 box with these configurations:

      v.update_guest_tools = true
      v.linked_clone = true
      v.customize "post-import", ["set", :id, "--nested-virt", "on"]
      v.customize "post-import", ["set", :id, "--sh-app-guest-to-host", "on"]
      v.customize "post-import", ["set", :id, "--sh-app-host-to-guest", "on"]
      v.customize "post-import", ["set", :id, "--smart-mount", "off"]
      v.customize "post-import", ["set", :id, "--shared-profile", "off"]
      v.customize "post-import", ["set", :id, "--shared-cloud", "off"]
      v.customize "post-import", ["set", :id, "--time-sync", "on"]
      v.customize "post-import", ["set", :id, "--keyboard-optimize", "on"]
      v.customize "post-import", ["set", :id, "--tools-autoupdate", "yes"]

and then this provision script installs xfce:

sudo apt install -y slim
sudo apt-get install -y xfce4 xfce4-goodies
sudo sed -i 's/allowed_users=prlctl list --info.*$/allowed_users=anybody/' /etc/X11/Xwrapper.config
sudo apt-get install -y xfce4-whiskermenu-plugin

sudo reboot

Everything is perfect except these important feature does not work for me:

When I install Xubuntu manually from iso, all this feature works perfectly. What is missing?

legal90 commented 1 year ago

Hi @zarinfam ,

I think the root cause of this behaviour is that the Parallels Tools Installer (PTI Agent) does not install X11-specific kernel modules when X11 server is not installed. In order to fix this we should update Parallels Tools after the provisioning step. It could be done by invoking PTI Agent at the end of the provisioning phase.

Please try this:

Vagrant.configure("2") do |config|
  config.vm.box = "generic/ubuntu2204"

  config.vm.provider "parallels" do |prl|
    # prl.update_guest_tools = true  # That is not necessary anymore, Parallels Tools are upgraded during the provisioning.
    prl.linked_clone = true
    prl.customize "post-import", ["set", :id, "--nested-virt", "on"]
    prl.customize "post-import", ["set", :id, "--sh-app-guest-to-host", "on"]
    prl.customize "post-import", ["set", :id, "--sh-app-host-to-guest", "on"]
    prl.customize "post-import", ["set", :id, "--smart-mount", "off"]
    prl.customize "post-import", ["set", :id, "--shared-profile", "off"]
    prl.customize "post-import", ["set", :id, "--shared-cloud", "off"]
    prl.customize "post-import", ["set", :id, "--time-sync", "on"]
    prl.customize "post-import", ["set", :id, "--keyboard-optimize", "on"]
    prl.customize "post-import", ["set", :id, "--tools-autoupdate", "yes"]
  end

  config.vm.provision "shell", inline: <<-SCRIPT
    sudo apt-get update
    sudo apt-get install -y slim
    sudo apt-get install -y xfce4 xfce4-goodies
    sudo sed -i 's/allowed_users=.*$/allowed_users=anybody/' /etc/X11/Xwrapper.config
    sudo apt-get install -y xfce4-whiskermenu-plugin

    # Update Parallels Tools and reinstall their kernel modules after X11 installation
    sudo ptiagent-cmd --install
    sudo reboot
  SCRIPT
end

After that I see both "Clipboard Sharing" and "Share Linux app with Mac" features working.