> For the complete documentation index, see [llms.txt](https://docs.verge.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verge.io/knowledge-base/zh/virtual-machines/add-tpm-device-to-vm.md).

# 如何向虚拟机添加 TPM 设备

## 概述

本文提供了在 VergeOS 中向虚拟机添加可信平台模块（TPM）设备的分步说明。TPM 设备提供基于硬件的安全功能，包括安全启动、加密密钥管理和证明能力。

{% hint style="info" %}
**要点**

* TPM 设备可启用基于硬件的安全功能
* 需要 UEFI 启动模式才能完全发挥功能
* 添加 TPM 设备后需要重启 VM
* 来宾操作系统可能需要额外配置
  {% endhint %}

## 前提条件

在向 VM 添加 TPM 设备之前，请确保满足以下要求：

* **UEFI 启动模式**：VM 应配置为使用 UEFI 启动，以获得最佳的 TPM 功能
* **受支持的来宾操作系统**：请确保您的来宾操作系统支持 TPM 设备
* **VM 电源状态**：在添加 TPM 设备之前，VM 应已关闭电源
* **适当的权限**：您必须拥有该虚拟机的修改权限

{% hint style="warning" %}
**UEFI 启动要求**

对于需要 TPM 的 Windows VM（例如 Windows 11），UEFI 启动模式是必需的。传统 BIOS 模式不支持 TPM 功能。
{% endhint %}

## 添加 TPM 设备的步骤

### 1. 访问 VM 配置

1. 导航到 **虚拟机仪表板**
   * 前往 **虚拟机** > **列表**
   * 从列表中双击您的目标 VM
2. **关闭 VM 电源** 如果它当前正在运行
   * 点击 **关闭电源** 如果 VM 正在运行，请从左侧菜单中
   * 等待 VM 完全关闭

### 2. 启用 UEFI 启动（如果尚未启用）

1. 从 VM 仪表板中，单击 **编辑** 在左侧菜单中
2. 找到 **UEFI 启动** 选项并启用它
3. 点击 **提交** 以保存更改

{% hint style="success" %}
**UEFI 转换**

如果要将现有 VM 从传统 BIOS 转换为 UEFI，请在进行更改之前创建快照，以便在需要时轻松回滚。
{% endhint %}

### 3. 添加 TPM 设备

1. 从 VM 仪表板中，单击 **设备** 在左侧菜单中
2. 点击 **新建** 从左侧菜单中
3. 配置 TPM 设备设置：
   * **名称**：输入一个描述性名称（例如“TPM-2.0”），或留空以自动生成
   * **类型**：选择 **TPM** 从下拉菜单中
   * **说明** （可选）：添加有关该设备的管理备注
   * **版本**：选择 TPM 版本（现代需求通常为 TPM 2.0）
4. 点击 **提交** 以创建 TPM 设备

### 4. 启动虚拟机

1. 从 VM 仪表板中，单击 **开机** 在左侧菜单中
2. 等待 VM 完全启动
3. 访问 VM 控制台以验证 TPM 功能

## 来宾操作系统配置

### Windows 配置

对于 Windows 来宾（尤其是 Windows 11）：

1. **验证 TPM 检测**
   * 打开 **设备管理器**
   * 查找“安全设备”部分
   * 确认 TPM 设备已列出并正常工作
2. **在 Windows 中启用 TPM**
   * 运行 `tpm.msc` 在“运行”对话框中
   * 验证 TPM 状态显示为“可供使用”
   * 如有提示，请初始化 TPM
3. **配置 BitLocker** （如需要）
   * 前往 **控制面板** > **系统和安全** > **BitLocker 驱动器加密**
   * 按照提示使用 TPM 启用 BitLocker

### Linux 配置

对于 Linux 来宾：

1. **检查 TPM 检测**

   ```bash
   ls /dev/tpm*
   ```
2. **安装 TPM 工具** （如需要）

   ```bash
   # Ubuntu/Debian
   sudo apt-get install tpm2-tools

   # RHEL/CentOS
   sudo yum install tpm2-tools
   ```
3. **验证 TPM 功能**

   ```bash
   tpm2_getcap properties-fixed
   ```

## 故障排除

### 常见问题

1. **来宾操作系统中未检测到 TPM**
   * **解决方案**：验证已启用 UEFI 启动并已重启 VM
   * 检查来宾操作系统是否支持 TPM 驱动程序
2. **Windows 11 安装要求**
   * **解决方案**：安装前请确保已启用 UEFI 启动和 TPM 2.0
   * 使用与 Windows 11 兼容的安装介质
3. **TPM 初始化错误**
   * **解决方案**:
     1. 完全关闭 VM 电源
     2. 移除并重新添加 TPM 设备
     3. 重启 VM 并重试初始化
4. **BitLocker 配置问题**
   * **解决方案**：在配置 BitLocker 之前，请确保 TPM 已正确初始化
   * 在 Windows TPM 管理控制台（tpm.msc）中检查状态

### 性能注意事项

* TPM 设备对 VM 运行的性能影响极小
* 无需额外的 CPU 或内存资源
* TPM 操作由 VergeOS 虚拟机监控程序高效处理

## 最佳实践

1. **更改前备份**
   * 在添加 TPM 设备之前创建 VM 快照
   * 先在开发环境中测试 TPM 功能
2. **安全配置**
   * 将安全启动与 TPM 一起启用，以增强安全性
   * 根据安全要求配置适当的 TPM 策略
3. **文档记录**
   * 记录 TPM 配置，以用于合规和审计目的
   * 保留已启用 TPM 的 VM 记录，以便进行安全跟踪
4. **更新与维护**
   * 保持来宾操作系统 TPM 驱动程序为最新版本
   * 定期监控 TPM 设备状态
   * 将 TPM 配置纳入 VM 文档

## 受支持的功能

启用 TPM 后，您的 VM 可以支持：

* **安全启动**：验证启动完整性并防止未经授权的启动修改
* **BitLocker 驱动器加密**：基于硬件的加密密钥管理
* **Windows Hello**：生物识别身份验证（需额外硬件）
* **设备证明**：验证设备完整性和合规性
* **证书存储**：用于数字证书的安全存储

## 其他资源

* [虚拟机最佳实践](/run-the-platform/virtual-machines/vm-best-practices.md)
* [UEFI 导入指南](/knowledge-base/zh/virtual-machines/importing-windows-server-with-uefi-into-vergeos.md)
* [设备直通概览](/run-the-platform/system-administration/device-pass-overview.md)

***

{% hint style="info" %}
**文档信息**

* 最后更新：2025-07-02
* VergeOS 版本：4.12.6+
* 适用于：所有支持 TPM 的 VergeOS 环境
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.verge.io/knowledge-base/zh/virtual-machines/add-tpm-device-to-vm.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
