「VirtualBox」- Guest Additions

  CREATED BY JENKINSBOT

组件安装

两种方法安装方法:

1)为 VirtualBox 添加 Oracle_VM_VirtualBox_Extension_Pack-5.2.44.vbox-extpack
—- 然后,对虚拟机实例 Insert Guest Additionals CD Images… 操作;
—- 最后,在 Guest 中挂在 CD 并安装其中的 ./VBoxLinuxAdditions.run 程序;

2)或下载 VBoxGuestAdditions.iso 到虚拟机中,并挂载;
—- 然后,在 Guest 中安装其中的 ./VBoxLinuxAdditions.run 程序;

这两种方法都需要 Guest 已经安装:

apt-get install -y gcc make perl

# apt-get install -i linux-headers-5.4.0-84
apt install linux-headers-$(uname -r)

组件卸载

Uninstall VirtualBox Guest Additions on Ubuntu and Windows 7

# Linux
sh /path/to/VBoxLinuxAdditions.run uninstall

常见问题处理

fatal error: linux/smp_lock.h: No such file or directory

在 VirtualBox 5.2.44 且 Guest 为 Ubuntu 20.04.3 中,安装 Gust Additions 扩展遇到该错误。

内核为 5.11.0-27 版本,我们通过降级到 5.4.0-84 解决该问题。

花屏、应用程序显示异常、无法正常渲染

问题描述
在 Ubuntu 20.04 TLS 中,VirtualBox 6.1.32,桌面部分应用程序出现花屏(渲染异常的问题;我们解决该问题后才记录笔记,所以没有截图)。

原因分析
我们猜测与开启 3D 加速有关。

解决方案
# 02/23/2022 在关闭 Display / Screen / Acceleration / Enable 3D Acceleration 功能后,目前桌面能够正常显示 ⇒ 我们不会播放视频,对 3D 加速没有特别严重的需求。

参考文献

Chapter 2. Installation Details/2.3.2. The Oracle VM VirtualBox Kernel Modules
Chapter 4. Guest Additions
https://download.virtualbox.org/virtualbox/
“Install Guest Additions” – nothing happens
How to Install Kernel Headers in Ubuntu and Debian