Parallels / vagrant-parallels

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

Failed to install Parallels Tools on first boot with Bento Ubuntu 22.04 image #458

Closed mpdude closed 1 year ago

mpdude commented 1 year ago

Hey there,

I have a problem to bring up a box with the following Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = "bento/ubuntu-22.04"
  config.vm.box_version = "202303.13.0"
  config.vm.provider "parallels" do |prl|
    prl.update_guest_tools = true
  end
end

The box_version is given for stability/reproducibility. It's this one.

Here is the abbreviated result from vagrant up:

Bringing machine 'default' up with 'parallels' provider...
==> default: Registering VM image from the base box 'bento/ubuntu-22.04'...
...
==> default: Checking if box 'bento/ubuntu-22.04' version '202303.13.0' is up to date...
...
==> default: Machine booted and ready!
==> default: Checking for Parallels Tools installed on the VM...
==> default: Parallels Tools installed on this VM are outdated! In most cases
==> default: this is fine but in rare cases it can cause things such as shared
==> default: folders to not work properly. If you see shared folder errors,
==> default: please update Parallels Tools within the virtual machine and
==> default: reload your VM.
==> default: Installing the proper version of Parallels Tools. This may take a few minutes...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

ptiagent-cmd --install

Stdout from the command:

ptiagent-cmd progress 3
ptiagent-cmd progress 15
Started installation of Parallels Guest Tools version '19.0.0.54570'
Hit:1 http://us.archive.ubuntu.com/ubuntu jammy InRelease
[... lots of usual apt-get update / apt-get install output ...]
E: Package 'linux-headers-5.15.0-67-generic' has no installation candidate
m linux-headers-5.15.0-67-generic
o dkms
o libelf-dev
Error: failed to install mandatory packages.
Error: failed to install or upgrade Parallels Guest Tools!

Stderr from the command:

This is the kernel currently running in the VM:

vagrant@vagrant:~$ uname -a
Linux vagrant 5.15.0-67-generic #74-Ubuntu SMP Wed Feb 22 14:14:39 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Also, a manual install attempt fails:

vagrant@vagrant:~$ sudo /mnt/install --install-unattended-with-deps --verbose
Started installation of Parallels Guest Tools version '19.0.0.54570'
Hit:1 http://us.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu jammy-security InRelease
Reading package lists...
Return code from apt-get update is 0
E: Package 'linux-headers-5.15.0-67-generic' has no installation candidate
m linux-headers-5.15.0-67-generic
o dkms
o libelf-dev
Error: failed to install mandatory packages.
Error: failed to install or upgrade Parallels Guest Tools!

My guess is that this base image was built with a kernel version that is not the one of the original Ubuntu 22.04 distribution, but rather from an intermediate (security?) update. However, the linux-headers package is no longer available in a matching version. I don't know for sure, but maybe the Ubuntu "security" APT repositories provide only current versions of updated packages?

When I run a full apt-get -y dist-upgrade, the 5.15.0-79-generic kernel version will be installed, the current security version as of today. And upon vagrant reload, the installation of Parallels Tools will proceed.

The problem is that there is no clean vagrant up way of bringing up this box: Before installing Parallels Tools, we'd need to install the latest updated kernel package and reboot – and that would be necessary as part of the initial bootstrap process.

Is there anything we can do about this from the vagrant-parallels side of things?

Is this something that needs to be addressed by the box providers, e. g. bento? Would they need to provide a base image with a (possibly very outdated) kernel version that always has a linux-headers version available?

mpdude commented 1 year ago

When I set prl.update_guest_tools = off, the inital boot works. But, as soon as the updated kernel gets installed, the next reboot will be stuck since the prl_fs filesystem type is unknown (no matching kernel module for new kernel version?). I cannot even use a provisioning script to re-build the tools, since the boot process aborts before that is run.

When I set prl.update_guest_tools = on, the initial boot fails since there is no linux-headers package matching the kernel version used by the base image.

cjlapao commented 1 year ago

@mpdude This image seems to be running a very old version of the QEMU hypervisor, you could try to build your own vagrant box using this packer recipe found here https://github.com/Parallels/packer-examples/tree/main

We are in the process of creating our own vagrant images in VagrantCould, meanwhile, you can also join our Discord Server to discuss any doubts or check when this will be released

mpdude commented 1 year ago

Fixed in https://github.com/chef/bento/pull/1526