
考虑到很多人装机时没有软路由等,需要先换源来解决问题
替换前建议先更新下证书,否则可能由于证书不可用导致 https 无法使用,进而无法下载所有软件。
apt install apt-transport-https ca-certificates
先更改
vi /etc/apt/sources.list 原来的注释或全部删除,用下面的代替
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free 如果是pve8用下面的
# 8.0清华源
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
# security updates
deb https://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware 先更改
vi /etc/apt/sources.list.d/pve-enterprise.list 原来的注释或者删除,用下面的代替
deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bullseye pve-no-subscription PVE8用下面的
# 8.0
deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bookworm pve-no-subscription PVE8还需要改一下ceph
vi /etc/apt/sources.list.d/ceph.list 然后添加
deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription
最后更新一下:
apt-get update
首先是建议使用PVE一键优化脚本来做一些简单的优化和辅助设置,非常节省时间,教程参考:https://github.com/ivanhao/pvetools
先删除企业源:
rm /etc/apt/sources.list.d/pve-enterprise.list 安装
export LC_ALL=en_US.UTF-8
apt update && apt -y install git && git clone https://github.com/ivanhao/pvetools.git 启动工具(cd到目录,启动工具)
cd ~/pvetools
./pvetools.sh
有时候发现iommu分组编号是一起的,没法直通
vim /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="rootdelay=10 quiet intel_pstate=disable iommu=pt initcall_blacklist=sysfb_init amd_iommu=on drm.debug=0 kvm_amd.nested=1 kvm.ignore_msrs=1 kvm.report_ignored_msrs=0 pci=assign-busses pcie_acs_override=downstream,multifunction vfio_iommu_type1.allow_unsafe_interrupts=1 video=efifb:off"
update-grub
reboot
如果未生效 添加允许不安全的中断的配置
echo "options vfio_iommu_type1 allow_unsafe_interrupts=1" > /etc/modprobe.d/iommu_unsafe_interrupts.conf
update-initramfs -u
前言:仅适用于AMD核显5600G,与intel核显直通、独显直通不一样,不同情况不要照搬
开启VT 开启IOMMU:在高级的高级/AMD CBS 中 开启CSM
vi /etc/modprobe.d/blacklist.conf
添加内容
# block AMD driver
blacklist radeon
blacklist amdgpu
# block NVIDIA driver
blacklist nouveau
blacklist nvidia
blacklist nvidiafb
# block INTEL driver
blacklist snd_hda_intel
blacklist snd_hda_codec_hdmi
blacklist i915
options vfio_iommu_type1 allow_unsafe_interrupts=1
update-initramfs -u -k all
lspci -D -nnk | grep VGA 得到
0000:0a:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [1002:1638] (rev c9)
记下命令显示的最前面的数字序号为IOMMU分组 0000:0a:00.0;后面中括弧中1002:1638为设备id
vi /etc/modprobe.d/vfio.conf
options vfio-pci ids=1002:1638
options vfio-pci disable_idle_d3=1 解释: 其中1002:1638为核显设备id,如果已经存在其他直通设备,请使用 , 进行分隔填写多个,如: options vfio-pci ids=14c3:7961,1002:1638
update-initramfs -u -k all
reboot
先按照make编译工具
apt-get install make gcc
cd
git clone https://github.com/awilliam/rom-parser
cd rom-parser
make
lspci -D -nnk | grep VGA 得到 0000:0a:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [1002:1638] (rev c9) 记住 0000:0a:00.0
cd /sys/bus/pci/devices/
cd 0000:0a:00.0
导出rom(如果这里报错permission deny之类的,请更新pve,或者pve内核)
echo 1 > rom
cat rom > /tmp/vbios.rom
echo 0 >rom 此时导出的vbios在 /tmp/vbios.rom
之后转移到指定目录即可
mv /tmp/vbios.rom /usr/share/kvm/
其它方法各自各显神通吧,总之上传vbios到pve主机的 /usr/share/kvm 目录中
如图勾选,amd的核显设备很明显 Cezanne
下面才是重点:
vi /etc/pve/qemu-server/105.conf 105是你Windows的虚拟机的编号
添加:
1、在cpu:host后面添加 ,hidden=1
2、hostpci1: 0000:0a:00.0,pcie=1,x-vga=1`后面添加 ,romfile=vbios.rom vbios.rom就是你提取的显卡vbios的名字
完整配置如下:仅供参考,不要直接照抄
1 agent: 1
2 balloon: 0
3 bios: ovmf
4 boot: order=hostpci0;ide2
5 cores: 4
6 cpu: host,hidden=1
7 efidisk0: local-lvm:vm-105-disk-0,efitype=4m,size=4M
8 hostpci0: 0000:07:00,pcie=1
9 hostpci1: 0000:0a:00.0,pcie=1,x-vga=1,romfile=vbios.rom
10 ide2: local:iso/virtio-win-0.1.215.iso,media=cdrom,size=528322K
11 machine: q35
12 memory: 8192
13 meta: creation-qemu=6.1.0,ctime=1672937166
14 name: win10
15 net0: virtio=06:B8:CE:00:DB:63,bridge=vmbr0,firewall=1
16 numa: 0
17 ostype: win10
18 scsihw: virtio-scsi-pci
19 smbios1: uuid=c1f99667-9378-4488-a4b2-0f7803bfb4dc
20 sockets: 1
21 tablet: 0
22 tpmstate0: local-lvm:vm-105-disk-1,size=4M,version=v2.0
23 vga: none
24 vmgenid: 2853a751-8c59-41d6-b1e1-633cd6a42921
如果不小心卡主了,请在pve中移除amd核显,然后先打补丁,之后重新安装显卡并配置即可
不完美解决amd gpu passthrough rest bug
下载RadeonResetBugFixService这个软件0.17版本,下载地址:https://github.com/inga-lovinde/RadeonResetBugFix/releases
下载解压放在c盘根目录,cmd管理员模式下运行RadeonResetBugFixService.exe install
等服务安装完成后,就可以随便关闭win10虚拟机了,关闭后就可以在pve显示里面设置为无 none。设置好后就可以正常开机win10虚拟机了
驱动下载区官网:5600G
在pve管理页面修改windows虚拟机设置,选择显示为
首先看看sata controller的id是什么,因为在pve里添加pci设备时候会没有提示
lspci -D -nnk | grep SATA