一、移除无效订阅提示

shell中执行如下命令,执行完毕后pve会自动重启,浏览器强制刷新缓存

sed -i_orig "s/data.status === 'Active'/true/g" /usr/share/pve-manager/js/pvemanagerlib.js
sed -i_orig "s/if (res === null || res === undefined || \!res || res/if(/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
sed -i_orig "s/.data.status.toLowerCase() !== 'active'/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
systemctl restart pveproxy

重启成功后,注销账号,再次输入账号密码,无效提示弹窗就消失了!

二、loacl和local-lvm两个分区合二为一

  1. 查询当前local的大小,/dev/mapper/pve-root这个是系统自动给local的空间

    df -h
  2. 移动分区

    lvremove pve/data -y
  1. 将所有系统盘可用空间全部交由local这一个逻辑卷分配

    lvextend -l +100%FREE -r pve/root
  2. 应已经调整大小的逻辑卷

    resize2fs /dev/mapper/pve-root
  1. 查询是否扩容成功

    df -h
  1. 删除local-lvm,点数据中心 ——> 存储 ——> local-lvm ——> 移除 ——> local ——> 编辑 ——> 内容(所有选项全部选上) ——> OK

三、更换国内源

  1. 修改debian源,北方用清华,南方中科大

    # 备份自带源
    cp /etc/apt/sources.list /etc/apt/sources.list_bak
    
    # 编辑sources.list
    nano /etc/apt/sources.list
    
    # 注释官方源
    #deb http://ftp.debian.org/debian bookworm main contrib
    #deb http://ftp.debian.org/debian bookworm-updates main contrib
    #security updates
    #deb http://security.debian.org bookworm-security main contrib
    
    # 中科大源
    deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free
    deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free
    deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free
    deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free
    
    
    # 清华源
    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
    deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
  1. 编辑pve企业源,注释官方企业源,拷贝国内源,北方用清华,南方中科大

    nano /etc/apt/sources.list.d/pve-enterprise.list
    
    # 中科大源
    deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription
    
    # 清华源
    deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian/pve bookworm pve-no-subscriptio
  2. 修复源401错误

    echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription" > /etc/apt/sources.list.d/ceph.list
  3. 更新列表并升级

    apt update && apt dist-upgrade -y
  4. 更换LXC为国内源

    #备份官方LXC源
    cp /usr/share/perl5/PVE/APLInfo.pm /usr/share/perl5/PVE/APLInfo.pm_back
    
    # 更换源
    sed -i 's|http://download.proxmox.com|https://mirrors.tuna.tsinghua.edu.cn/proxmox|g' /usr/share/perl5/PVE/APLInfo.pm
    
    # 重启服务
    systemctl restart pvedaemon.service
  1. 重启PVE后升级更新生效

    reboot

四、硬件直通

  1. 查看PCI设备

lspci
  1. 修改grub

nano /etc/default/grub
  1. 修改GRUB_CMDLINE_LINUX_DEFAULT的内容

nano /etc/default/grub

# Intel CPU
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt initcall_blacklist=sysfb_init"

# AMD CPU
GRUB_CMDLINE_LINUX_DEFAULT="quiet iommu=pt initcall_blacklist=sysfb_init"

参数说明:

intel_iommu=on 开启Intel cpu平台iommu分组,pve8+已经内置了amd参数,老版本需要添加amd_iommu=on

iommu=pt 提高iommu性能

initcall_blacklist=sysfb_init 启动时运行黑名单内添加项,在Intel的机型中,此项非必要添加,但是在amd机型中建议添加,否则会影响核显直通后的性能,比如4K60Hz降低到30Hz。

pcie_acs_override=downstream,multifunction 如果你的pcie设备分组有问题可以加上当前参数对分组拆分

  1. 更新grub,时修改生效

update-grub

检查是否生效

dmesg | grep iommu

find /sys/kernel/iommu_groups/ -type l 
  1. 加载内核模块(Proxmox VE 8及以后的版本中不需要加载vfio_virqfd

nano /etc/modules

vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd #pve8中不需要
  1. 刷新initramfs

update-initramfs -u -k all

重启之后,检查是否生效

lsmod | grep vfio
  1. 编辑设备黑名单,在内核中不加载以下显卡驱动,以便用于显卡直通

nano /etc/modprobe.d/pve-blacklist.conf
  1. 内容如下,需要根据自己的cpu类型自行修改

#屏幕amd显卡驱动
blacklist amdgpu
blacklist radeon

#屏蔽nvidia显卡驱动
blacklist nouveau
blacklist nvidia*

#屏蔽Intel显卡驱动
blacklist i915

options vfio_iommu_type1 allow_unsafe_interrupts=1

验证自己的cpu是否支持中断

dmesg | grep 'remapping'

以下情况都说明支持

  • AMD-Vi: Interrupt remapping enabled

  • DMAR-IR: Enabled IRQ remapping in x2apic mode

  • DMAR-IR: Enabled IRQ remapping in x2apic mode

不支持的话,如果想不安全中中断,可以在/etc/modprobe.d/中以' .conf '结尾的文件中添加以下行

options vfio_iommu_type1 allow_unsafe_interrupts=1

  1. 刷新initramfs

update-initramfs -u -k all
lspci | grep VGA

nano /etc/pve/qemu-server/[虚拟机编号].conf

#例如Windows虚拟机的序号是101
则命令为:
nano /etc/pve/qemu-server/101.conf


五、安装监控工具

  1. 安装git和wget服务

    apt install git wget
  2. git拉取脚本

    git clone https://github.com/KoolCore/Proxmox_VE_Status.git
  3. 进入脚本命令行所在目录

    cd Proxmox_VE_Status
  4. 执行脚本

    bash ./Proxmox_VE_Status_zh.sh
  5. 执行硬件直通脚本

    bash ./passthrough.sh