Installing Arch Linux in VMware - ArchWiki

# Installing Arch Linux in VMware

Related articles

- VMware
- Installing VMWare vCLI

This article is about installing Arch Linux in a VMware product, such as Player (Plus), Fusion or Workstation.

## In-kernel drivers

- `vmw_balloon` - The physical memory management driver. It acts like a "balloon" that can be inflated to reclaim physical pages by reserving them in the guest and invalidating them in the monitor, freeing up the underlying machine pages so they can be allocated to other guests. It can also be deflated to allow the guest to use more physical memory. Deallocated Virtual Machine memory can be reused in the host without terminating the guest.
- `vmw_pvscsi` - For VMware's Paravirtual SCSI (PVSCSI) HBA.
- `vmw_vmci` - The Virtual Machine Communication Interface. It enables high-speed communication between host and guest in a virtual environment via the VMCI virtual device.
- `vsock` - The Virtual Socket Protocol. It is similar to the TCP/IP socket protocol, allowing communication between Virtual Machines and hypervisor or host.
- `vmw_vsock_vmci_transport` - Implements a VMCI transport for Virtual Sockets.
- `vmwgfx` - For 3D acceleration. This is a KMS enabled DRM driver for the VMware SVGA2 virtual hardware.
- `vmxnet3` - For VMware's vmxnet3 virtual ethernet NIC.

## VMware Tools versus Open-VM-Tools

In 2007, VMware released large partitions of the VMware Tools under the LGPL as Open-VM-Tools. The official Tools are not available separately for Arch Linux.

Originally, VMware Tools provided the best drivers for network and storage, combined with the functionality for other features such as time synchronization. However, for quite a while now the drivers for the network/SCSI adapter are part of the Linux kernel, and VMware Tools is only needed for extra features.

## Open-VM-Tools

### Modules

The open-vm-tools-dkms package comes with the following modules:

- `vmblock` - Filesystem driver. Enables drag & drop functionality between host and guest (superseded by the `vmware-vmblock-fuse` utility).
- `vmci` - High performance communication interface between host and guest.
- `vmhgfs` - Filesystem driver. Enables sharing between host and guest.
- `vsock` - VMCI sockets.
- `vmsync` - Experimental filesystem sync driver. Enables filesystem quiescing when creating backups and snapshots.
- `vmxnet` - for the old VMXNET network adapter.

### Utilities

The open-vm-tools package comes namely with the following utilities:

- `vmtoolsd` - Service responsible for the Virtual Machine status report.
- `vmware-checkvm` - Tool to check whether a program is running in the guest.
- `vmware-toolbox-cmd` - Tool to obtain Virtual Machine information of the host.
- `vmware-user-suid-wrapper` - Tool to enable clipboard sharing (copy/paste) between host and guest.
- `vmware-vmblock-fuse` - Filesystem utility. Enables drag & drop functionality between host and guest through FUSE (Filesystem in Userspace).
- `vmware-xferlogs` - Dumps logging/debugging information to the Virtual Machine logfile.

### Installation

Install open-vm-tools from the official repositories and open-vm-tools-dkms from the AUR.

Open-VM-Tools reads version information from `/etc/arch-release`, which is empty:

    # cat /proc/version > /etc/arch-release

Start `vmtoolsd.service` and enable it on boot, if desired.

Note: There is a bug in `vmtoolsd`, where the service is not able to properly shut down and hangs for 60 seconds. A quick workaround is described in the forums.

## Official VMware Tools

### Modules

- `vmblock` - Filesystem driver. Enables drag & drop functionality between host and guest (superseded by the `vmware-vmblock-fuse` utility).
- `vmci` - High performance communication interface between host and guest.
- `vmmon` - Virtual Machine Monitor.
- `vmnet` - Networking driver.
- `vsock` - VMCI sockets.

### Installation (from guest)

Install the dependencies: base-devel (for building), net-tools (for `ifconfig`, used by the installer) and linux-headers (for kernel headers).

Then, create bogus init directories for the installer:

    # for x in {0..6}; do mkdir -p /etc/init.d/rc$x.d; done

The installer can then be mounted:

    # mount /dev/cdrom /mnt

Extracted (e.g. to `/root`):

    # tar xf /mnt/VMwareTools*.tar.gz -C /root

And started:

    # perl /root/vmware-tools-distrib/vmware-install.pl

You can safely ignore the following build failures:

- VMNEXT 3 virtual network card
- "Warning: This script could not find mkinitrd or update-initramfs and cannot remake the initrd file!"

Reboot the Virtual Machine:

    # systemctl reboot

Log in and start the VMware Tools:

    # /etc/init.d/rc6.d/K99vmware-tools start

Tip: There is also a project in GitHub trying to automate all this.

## Xorg configuration

Note: To use Xorg in a Virtual Machine, a minimum of 32MB VGA memory is needed.

Install the dependencies: xf86-input-vmmouse, xf86-video-vmware, and mesa.

If booting into a `graphical target` you're almost done. `/etc/xdg/autostart/vmware-user.desktop` will get started which will setup most of the things needed to work with the Virtual Machine.

However, if booting into `multi-user.target` or using an uncommon setup (e.g. multiple monitors), then `vmtoolsd.service` needs to be enabled. In addition to this, edit:

    /etc/X11/Xwrapper.config

    needs_root_rights=yes

to give permission for loading drivers.

## Tips and tricks

### Shared Folders

Note: This functionality is only available in VMware Workstation and Fusion

Shared a folder by selecting Edit virtual machine settings > Options > Shared Folders > Always enabled, and creating a new share.

Now, you should be able to see the shared folders by running vmware-hgfsclient command:

    $ vmware-hgfsclient

Add a rule for each share:

    /etc/fstab

    .host:/<shared_folder> /home/user1/shares vmhgfs defaults 0 0

Create and mount the Shared Folders:

    # mkdir /home/user1/shares
    # mount /home/user1/shares

Temporary mounts are also possible:

    # mount -t vmhgfs .host:/<shared_folder> /home/user1/shares

Note: You may see "Error: cannot mount filesystem: No such device" if the vmhgfs module was not added to the Linux Kernel yet before you try to mount the folders.

This can be temporarily resolved by running the "modprobe vmhgfs" command, but to make it loaded automatically during boots time, you need to add the vmhgfs module to mkinitcpio.conf, and then run "mkinitcpio -p linux" to update the ramdisk.

#### Enable at boot

For shared folders to be working you need to have loaded the `vmhgfs` driver. Simply create the following `.service`s:

    /etc/systemd/system/mnt-hgfs.mount

    [Unit]
    Description=Load VMware shared folders
    ConditionPathExists=.host:/<shared_folder>
    ConditionVirtualization=vmware

    [Mount]
    What=.host:/<shared_folder>
    Where=/home/user1/shares
    Type=vmhgfs
    Options=defaults,noatime

    [Install]
    WantedBy=multi-user.target

    /etc/systemd/system/mnt-hgfs.automount

    [Unit]
    Description=Load VMware shared folders
    ConditionPathExists=.host:/<shared_folder>
    ConditionVirtualization=vmware

    [Automount]
    Where=/home/user1/shares

    [Install]
    WantedBy=multi-user.target

Enable the mount target with:

    # systemctl enable mnt-hgfs.automount

#### Prune mlocate DB

When using mlocate, it's useless to index the shared directories in the `locate DB`. Therefore, add the directories to `PRUNEPATHS` in `/etc/updatedb`.

### 3D Acceleration

If not selected at guest creation time, 3D Acceleration can be enabled in: Edit virtual machine settings > Hardware > Display > Accelerate 3D graphics.

### Time synchronization

Configuring time synchronization in a Virtual Machine is important; fluctuations are bound to occur more easily in a guest, compared to a physical host. This is mostly due to the CPU being shared by more than one guest.

There are 2 options to set up time synchronization: the host or an external source.

#### Host machine as time source

To use the host as a time source:

    # vmware-toolbox-cmd timesync enable

To synchronize the guest after suspending the host:

    # hwclock --hctosys --localtime

#### External server as time source

See NTP.

### Paravirtual SCSI adapter

VMware Paravirtual SCSI (PVSCSI) adapters are high-performance storage adapters for VMware ESXi that can result in greater throughput and lower CPU utilization. PVSCSI adapters are best suited for environments, where hardware or applications drive a very high amount of I/O throughput. cpio -p linux

The SCSI adapter type `VMware Paravirtual` is available in the Virtual Machine settings.

## Troubleshooting

### Mouse problems

The following problems may occur with mouse:

- The automatic grab/ungrab feature will not automatically grab input when cursor enters the window
- Input lag
- Clicks are not registered in some applications

VMware attempts to automatically optimize mouse for gaming. If experiencing problems, disabling it is recommended: Edit > Preferences > Input > Optimize mouse for games: Never

Alternatively, attempting to disable the `catchall` event in `10-evdev.conf` may be needed:

    /etc/X11/xorg.conf.d/10-evdev.conf

    #Section "InputClass"
    #        Identifier "evdev pointer catchall"
    #        MatchIsPointer "on"
    #        MatchDevicePath "/dev/input/event*"
    #        Driver "evdev"
    #EndSection

#### Missing buttons

If not by default, all mouse buttons should be working after adding `mouse.vusb.useBasicMouse = "FALSE"` to the `.vmx`.

    ~/vmware/<Virtual Machine name>/<Virtual Machine name>.vmx

    mouse.vusb.useBasicMouse = "FALSE"

### Boot problems

#### Slow boot time

You may see the following errors if VMWare's memory hot-add feature is enabled.

- add_memory failed
- acpi_memory_enable_device() error

Disable the memory hot-add feature by setting `mem.hotadd = "FALSE"` to the `.vmx`.

    ~/vmware/<Virtual Machine name>/<Virtual Machine name>.vmx

    mem.hotadd = "FALSE"

#### Shutdown/Reboot hangs

Adjust the timeout for the vmtoolsd service (defaults to 90 seconds).

    /etc/systemd/system/vmtoolsd.service.d/timeout.conf

    [Service]
    TimeoutStopSec=1

### Autofit problems

If VMWare is stretching instead of changing the resolution even with the system service enabled, you may need to add the modules to mkinitcpio.conf.

    /etc/mkinitcpio.conf

    MODULES="vsock vmw_vsock_vmci_transport vmw_balloon vmw_vmci vmwgfx"

Don't forget to run:

    # mkinitcpio -p linux

### Drag and drop, copy/paste

The open-vm-tools doesn't have a systemd service definition for the vmware-vmblock-fuse service, as documented in FS#43158. To automatically start `vmblock-fuse`, create the following service file:

    /etc/systemd/system/vmware-vmblock-fuse.service

    [Unit]
    Description=vmware-vmblock-fuse

    [Service]
    ExecStart=/usr/bin/vmware-vmblock-fuse.sh start
    ExecStop=/usr/bin/vmware-vmblock-fuse.sh stop
    PIDFile=/var/lock/subsys/vmware-vmblock-fuse
    TimeoutSec=0
    RemainAfterExit=yes

    [Install]
    WantedBy=multi-user.target

The script being invoked by the above is as follows:

    /usr/bin/vmware-vmblock-fuse.sh

    #!/bin/bash
    if [ $# -ne 1 ]
    then
        exit
    fi
    if [ "$1" == "start" ]
    then
        if [ ! -d /var/run/vmblock-fuse ]
        then
            mkdir /var/run/vmblock-fuse
        fi
        /usr/bin/vmware-vmblock-fuse -o subtype=vmware-vmblock,default_permissions,allow_other /var/run/vmblock-fuse
    fi
    if [ "$1" == "stop" ]
    then
        killall vmware-vmblock-fuse
    fi

Also, `/etc/xdg/autostart/vmware-user.desktop` may try to start vmware-user-suid-wrapper properly when you log in, but there's there's an unspecified relationship between it and gtkmm that causes it to silently fail. This is documented in FS#43159.

### Problems when running as a shared VM on Workstation 11

Workstation 11 has a bug where vmware-hostd crashes if an Arch guest is running as a shared VM and vmtoolsd is running in the guest. A patch to open-vm-tools to work around the bug is here.

Categories:

- Getting and installing Arch
- Virtualization