Installing Guest Additions in VirtualBox for an Ubuntu Server Guest

本文详细介绍了如何在Ubuntu Server 10.04上安装VirtualBox Guest Additions,包括所需的步骤和遇到的问题解决方法。文章还讨论了在不安装X.Org库的情况下安装Guest Additions的可能性。

Installing VirtualBox's "Guest Additions" is not as straight forward as I'd like it to be for an Ubuntu Server Guest but I figured out the solution.

In this tutorial I am using:

  • Host: Windows XP Professional
  • VirtualBox: 3.1.6
  • Guest: Ubuntu Server 10.04 (Lucid Lynx )

So say you have a host with VirtualBox installed (I have Windows XP, you have any version of Windows, Mac, Solaris, Linux, etc.) and have an Ubuntu Server installed as a guest. If you want to install "Guest Additions" for added features (such as seemless mode, copy and paste support, or shared folders in my case), you're supposed to click Devices > Install Guest Additions... but when I clicked the button, nothing popped up. Why doesn't anything pop-up? Did it download? Was there an error?

Unbeknown to me, VirtualBox actually downloaded an image called VBoxGuestAdditions.iso, all without telling me. Great,  it's downloaded, but how do I mount and install it?

First off, let's grab some libraries we need for Guest Additions to install
sudo apt-get install build-essential linux-headers-`uname -r`
Then mount it
sudo mount /dev/cdrom1 /mnt

Then run the proper executable (make sure you look for the correct one for your machine)
sudo bash /mnt/VBoxLinuxAdditions-x86.run

There will be an error that states the not all features could be installed

Installing the Window System drivers ...fail!
(Could not find the X.org or XFree86 Window System.)

But this is okay. VirtualBox's Guest Additions installs some features that we don't need on a server (seemless mode, copy and paste, etc.) If you want these features, you'll have to install 67MB+ of X.Org libraries
sudo apt-get install xserver-xorg xserver-xorg-core

So it's up to you: GuestAdditions with 67MB+ of X.Org libraries or let these drivers fail and enjoy shared folders.

Verifying archive integrity... 100% MD5 checksums are OK. All good. Uncompressing VirtualBox 7.0.18 Guest Additions for Linux 100% VirtualBox Guest Additions installer VBoxControl: error: Could not contact the host system. Make sure that you are running this VBoxControl: error: application inside a VirtualBox guest system, and that you have sufficient VBoxControl: error: user permissions. This system appears to have a version of the VirtualBox Guest Additions already installed. If it is part of the operating system and kept up-to-date, there is most likely no need to replace it. If it is not up-to-date, you should get a notification when you start the system. If you wish to replace it with this version, please do not continue with this installation now, but instead remove the current version first, following the instructions for the operating system. If your system simply has the remains of a version of the Additions you could not remove you should probably continue now, and these will be removed during installation. Do you wish to continue? [yes or no] yes Copying additional installer modules ….. Installing additional modules ….. VirtualBox Guest Additions: Starting. VirtualBox Guest Additions: Setting up modules VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while. VirtualBox Guest Additions: To build modules for other installed kernels, run VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup <version> VirtualBox Guest Additions: or VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all VirtualBox Guest Additions: Building the modules for kernel 6.14.0-27-generic. VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what went wrongVirtualBox Guest Additions: Running kernel modules will not be replaced until the system is restarted or 'rcvboxadd reload' triggered VirtualBox Guest Additions: reloading kernel modules and services VirtualBox Guest Additions: cannot reload kernel modules: one or more module(s) VirtualBox Guest Additions: kernel modules and services were not reloaded The log file /var/log/vboxadd-setup.log may contain further information. Press Return to close this window... is still in use
08-01
<think>根据用户问题,用户在使用VirtualBox 7.0.18安装Guest Additions时遇到了内核模块无法重新加载的问题。需要参考提供的引用资料,结合常见解决方法,给出解决方案。 引用资料中提到了安装Guest Additions的基本步骤(引用[1][2])以及处理内核相关依赖的方法(引用[3])。针对内核模块问题,重点应放在内核头文件和编译工具的安装上。 解决步骤: 1. 确保系统已更新,并安装了正确版本的内核头文件和编译工具(gcc, make等)。 2. 检查当前运行的内核版本与安装的内核头文件是否一致。 3. 尝试手动重新编译内核模块。 具体操作如下:</think>### VirtualBox Guest Additions安装时内核模块无法重新加载的解决方法 当在VirtualBox 7.0.18中安装Guest Additions时遇到内核模块无法重新加载的问题,可能是由内核版本不匹配、依赖缺失或配置错误导致。以下是系统性的解决方案: #### 1. **验证内核头文件和编译工具** ```bash sudo apt update sudo apt install -y build-essential dkms linux-headers-$(uname -r) ``` 确保安装的内核头文件版本与当前运行内核完全匹配(通过`uname -r`查看)。若版本不一致,需重启并选择正确内核启动[^3]。 #### 2. **手动重新编译内核模块** 卸载现有模块并强制重装: ```bash sudo /opt/VBoxGuestAdditions-7.0.18/uninstall.sh # 卸载旧版本 sudo rm -rf /opt/VBoxGuestAdditions-* # 清除残留文件 sudo mount /dev/cdrom /mnt # 挂载增强功能镜像 cd /mnt sudo ./VBoxLinuxAdditions.run --force # 强制重装 ``` #### 3. **检查内核日志定位错误** ```bash dmesg | grep -i vboxguest journalctl -b | grep -i vbox ``` 常见错误及修复: - **签名验证失败**:禁用Secure Boot(BIOS设置) - **符号未找到**:更新内核后重启主机和虚拟机 - **编译错误**:确保`gcc`和`make`版本兼容(需`gcc-12`对应内核6.x) #### 4. **关闭SELinux/AppArmor(临时测试)** ```bash sudo setenforce 0 # 关闭SELinux sudo systemctl stop apparmor # 停止AppArmor ``` 若此步骤解决,需永久调整安全策略[^3]。 #### 5. **降级内核(极端情况)** 若新内核不兼容: ```bash sudo apt install linux-image-5.15.0-xx-generic # 安装旧内核 sudo reboot ``` #### 6. **手动加载模块** 安装后尝试手动加载: ```bash sudo modprobe vboxguest sudo modprobe vboxsf sudo systemctl restart virtualbox-guest-utils ``` > **关键提示**:VirtualBox 7.x要求主机和客户机均为64位系统,且需在虚拟机设置中启用**嵌套虚拟化**(Nested VT-x/AMD-V)[^1][^2]。
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值