Use VMware Workstation with the latest Linux Kernel
Tags: vmware, linux, kernel, virtualization
Published: 2022-05-06 23:51:27

Azul,
This is my first article, this my Hello World in dev.to community, I am here to help people as I got and still get helped from those online articles, but, to encourage people from my community to write and share their knowledge !

I am Abdenour ALIANE, [Aicignaw Consulting](https://aicignaw.com/) founder, and teacher (and of course a student), I will write about computer (sure, since I am here), focusing on Cloud Computing (Google Cloud and on-premise solutions) and Linux, and everything related to those two big topics, and I will always try to break the topic to something anyone could understand (I suppose that I am a newbie that comes and read this article because I searched for a keyword on Google, and of course we never stop learning, so I am still a newbie, that's the key to learn ! so sorry if my articles will seem basic, and if you dont understand, please let me know in the comments section)

Today, I will start with this simple way on how to use VMWare Workstation on Linux distribution with a new kernel (since [hypervisors](https://en.wikipedia.org/wiki/Hypervisor) and [virtualization](https://en.wikipedia.org/wiki/Virtualization) is important to explain how cloud works), if you know the basics, just scroll down to the yawning cat picture ^_^

Well, first, let's break down what I said :

[Linux](https://en.wikipedia.org/wiki/Linux) is a [Kernel](https://www.kernel.org/), a kernel is that part who manages the electricity flaw (those 1 and 0 signals), so if we try to understand using what [most of people use on Desktop](https://gs.statcounter.com/os-market-share): Microsoft Windows :

- When we install a driver, we are installing some 'code' that will work with our hardware to tell them how to behave; so when we find a driver compatible with Windows 8.1, that means, it works with the [Windows kernel of this version](https://en.wikipedia.org/wiki/Architecture_of_Windows_NT), so chances that it could work with Windows 10, but Windows XP drivers could break for Windows 10 even if it's the same [architecture](https://en.wikipedia.org/wiki/X86-64)  as the two kernels have lot of differences  

- When Windows starts, the kernel is the part that protects the hardware from being broken by something a user or a program could do, which means, a virus for example (which is a program but does something a user will not like ...) [will not burn the hardware by sending too much electricity to it](https://en.wikipedia.org/wiki/Protection_ring) (we will see that concept a lot with virtualization in next articles),

Linux is named after the guy who made it, [Linus Torvalds](https://en.wikipedia.org/wiki/Linus_Torvalds), you can even check [his git repo](https://github.com/torvalds/linux), or [download it from the official website](https://www.kernel.org/), but you need then to compile it to your own distribution, you can [Google](https://www.google.com/search?q=upgrade+linux+kernel) for it, I will make a topic on this later.
So now that we understood what is a kernel, what we use are [Distributions](https://en.wikipedia.org/wiki/List_of_Linux_distributions) and there are [a LOT](https://upload.wikimedia.org/wikipedia/commons/b/b5/Linux_Distribution_Timeline_21_10_2021.svg) !

The good part of using a Linux distribution, is its modularity; we can install [Ubuntu](https://ubuntu.com/download/desktop) for example, change its user [interface](https://itsfoss.com/best-linux-desktop-environments/), and update its kernel to try some new features and bring some new hardware compatibility, without even touching the distribution version !

**Important notice :**
In computer world, there are two kind of people :

1. Users who like to test and try new stuff, if it breaks, even if there is a loss, but there is time to repair,

2. Professionals using machines as servers, [no time to lose](https://en.wikipedia.org/wiki/Downtime) : 

- Here, the most important is stability over new stuff, they only do security patches and important updates, that's why some distributions offer what is called an [Long Term Support (LTS)](https://en.wikipedia.org/wiki/Long-term_support)

- Those servers are [headeless](https://en.wikipedia.org/wiki/Headless_computer), that's why we avoid installing graphical interface on those Linux distributions, so, headeless keyword is also used in Linux to say they dont have [GUI](https://en.wikipedia.org/wiki/Graphical_user_interface)
_* Headeless Linux means [less security holes](https://www.cyberciti.biz/tips/linux-security.html)_

- That is said, **DONT TRY THIS AT ... SERVER** 

![tired cat](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iathedqn2jhxt3i5dl4d.png)

So, since you decided to change the kernel to the latest stable version, here is what happens, and how to solve the problem :

For this, I will give you my own experience :

I use [Pop!_OS 22.04 LTS](https://pop.system76.com/), which is based on Ubuntu 22.04 LTS which is a [Debian based distribution](https://en.wikipedia.org/wiki/List_of_Linux_distributions#Debian-based), I used this version because this is what I personally found good on my laptop with [Nvidia Optimus](https://en.wikipedia.org/wiki/Nvidia_Optimus)

_if you are an Arch user, and want something on top of KDE that supports Optimus, there is the amazing [EndeavourOS](https://discovery.endeavouros.com/category/nvidia/) but that's not our main topic, this is just for people who want to discover the Linux world_

Let's begin :

This is how to get your Linux distribution version :
`cat /etc/os-release`
And this is how to get your kernel version :
`uname -r`

The result

![Kernel version](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t9hkx3zcg1ycxe0irffw.png)

When you run VMWare Workstation, it will ask you to compile some modules for this kernel

![compile kernel](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f26ee57pde1f3mqjqegv.png)

Then it will start building the modules vmmon and vmnet


![vmnet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wayfrhcgck127nmt45f2.png)

And this where it messes and I got the error (unable to install all modules):

![error](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eqyqdml9v14aky1ayvav.png)

The log shows compilation error due to C libraries missing ...

![log](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q3tuyrzwijfmquwf8io7.png)

So here is the solution that worked with me :

The solution is in this [excellent repo](https://github.com/mkubecek/vmware-host-modules), it is described :

> This repository tracks patches needed to build VMware (Player and
Workstation) host modules against recent kernels. As it focuses on recent
kernels (older ones do not need patching), only **vmmon** and **vmnet** modules are
currently handled as the rest has been upstreamed for some time.

First, let's [clone](https://git-scm.com/docs/git-clone) it to our machine
`git clone https://github.com/mkubecek/vmware-host-modules.git`

Git will create a new folder and name it the same name as the git repo, which is **vmware-host-modules**

`cd vmware-host-modules`

The repo appears almost empty, the files we need are in the [branchs](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell), we can check them with 

`git branch -r`

We will find that it contains branchs for Player and Workstation, with their respective versions, I am using **16.2.4**, to get the branch name, we can directly use :

**If you use the latest Worsktation at the time of writing/editing this article, which is `workstation-17.0.0` just replace the version number and you are all set !**


`git branch -r | grep -i 16.2.4`

Then we switch to that branch depending on which version you need :

`git checkout workstation-16.2.4`

![branchs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lsryp7z3pkikgmszaddd.png)

You can avoid all this by directly clone the branch (replace the VMWare version with the one you use) :
`git clone -b workstation-16.2.4 https://github.com/mkubecek/vmware-host-modules.git`

and then once we are there, we just need to compile our modules and install them with the famous :

`make && sudo make install`

it should not take time, and TADA ! 

**Update : Nov 2022**

After upgrading to kernel version 6.xx I got an issue, here is simply how to solve it :

... after doing `make`

`tar -cf vmnet.tar vmnet-only`

`tar -cf vmmon.tar vmmon-only`

`sudo mv vmnet.tar /usr/lib/vmware/modules/source/`

`sudo mv vmmon.tar /usr/lib/vmware/modules/source/`

`sudo vmware-modconfig --console --install-all`

And if you get issues with gcc as incompatible with the one you are using (gcc 11 vs gcc 12) just change the symlink to the newest one :

`gcc --version`

`which gcc`

Then :

`sudo unlink /usr/bin/gcc`

`sudo ln /usr/bin/gcc-12 /usr/bin/gcc`

And check again with 

`gcc --version`

![Tada](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fwk5ce79puhns5d3jgxo.png)