编程技术分享 - 默认分类
type: channel
link: http://blog.x-fee.com/index.php/category/default/
description: 只是一个默认分类
items: alpine 一些可执行程序运行不了
items: bcdedit 挂载 boot.wim重装系统
items: alpine fstab swap 不起作用
items: win eval 换正式版
items: debian换alpine
items: ipxe 装 alpine 再装 win
items: docker Daemon 代理
items: bcdedit 启动 win10pe
items: windows 更新时间
items: hyper添加nvdia虚拟显卡

alpine 一些可执行程序运行不了
type: item
date: 2026-07-15T15:24:00+00:00
description: 根本原因和解决方案Alpine Linux 使用 musl libc 而非标准的 glibc，而大多数预编译的 Linux 二进制文件都是针对 glibc 编译的。这就是问题所在。解决方案：安装 glibc 兼容层（推荐）# 安装 gcompat（Alpine 的 glibc 兼容层） apk add --no-cache gcompat

bcdedit 挂载 boot.wim重装系统
type: item
date: 2026-07-02T16:11:00+00:00
description: 给boot.wim打补丁创建临时目录New-Item -Path "C:\temp_pe" -ItemType Directory -Force挂载 boot.wim# 查看 boot.wim 有几个映像 Get-WindowsImage -ImagePath "D:\win2025\sources\boot.wim"# 一般有 2 个，Index 1 是普通 PE，Index 2 是setup # 挂载 Index 2 Mount-WindowsImage -ImagePath "D:\win2025\sources\boot.wim" -Index 1 -Path "C:\mount_pe"创建自动启动命令行的脚本# 创建 Winpeshl.ini，它会替代默认的 setup.exe 启动 @" [LaunchApps] %SYSTEMROOT%\System32\cmd.exe "@ | Out-File -FilePath "C:\mount_pe\Windows\System32\winpeshl.ini" -Encoding ascii打驱动# 打磁盘驱动 dism /Image:"C:\mount_pe" /Add-Driver /Driver:"D:\virtio\viostor\2k25\amd64\viostor.inf"保存修改后的 boot.wim# 卸载并保存 Dismount-WindowsImage -Path "C:\mount_pe" -Save将index2保存为单独的wimdism /Export-Image /SourceImageFile:"D:\win2025\sources\boot.wim" /SourceIndex:2 /DestinationImageFile:"D:\win2025\sources\boot_setup.wim" bcdedit 添加启动菜单# 1. 设置 ramdisk 选项 $null = cmd /c bcdedit /create "{ramdiskoptions}" /d "Ramdisk 选项" 2>&1 cmd /c bcdedit /set "{ramdiskoptions}" ramdisksdidevice partition=D: cmd /c bcdedit /set "{ramdiskoptions}" ramdisksdipath \win2025\boot\boot.sdi # 2. 创建新启动项并捕获 GUID $output = cmd /c bcdedit /copy "{current}" /d "Windows PE 恢复环境" $guid = ($output | Select-String '{[^}]+}').Matches.Value Write-Host "新启动项 GUID: $guid" -ForegroundColor Green # 3. 配置启动项 cmd /c bcdedit /set $guid device "ramdisk=[D:]\win2025\sources\boot_setup.wim,{ramdiskoptions}" cmd /c bcdedit /set $guid osdevice "ramdisk=[D:]\win2025\sources\boot_setup.wim,{ramdiskoptions}" cmd /c bcdedit /set $guid winpe yes cmd /c bcdedit /set $guid detecthal yes cmd /c bcdedit /set $guid systemroot \Windows # 4. 显示启动菜单 cmd /c bcdedit /set "{bootmgr}" displaybootmenu yes cmd /c bcdedit /set "{bootmgr}" timeout 5 Write-Host "`n设置完成！重启后选择 'Windows PE 恢复环境' 即可进入。" -ForegroundColor Yellow

alpine fstab swap 不起作用
type: item
date: 2026-03-03T03:12:49+00:00
description: Alpine 的 swap 服务位于 /etc/init.d/swap，需将其加入默认运行级别：rc-update add swap default

win eval 换正式版
type: item
date: 2026-02-07T12:18:12+00:00
description: DISM /online /Set-Edition:ServerDatacenter /ProductKey:D764K-2NDRG-47T6Q-P8T8W-YP6DF /AcceptEula

debian换alpine
type: item
date: 2026-02-06T14:58:00+00:00
description: ﻿set timeout=1 menuentry "Linux lts" { linux (hd0,msdos2)/boot/vmlinuz-lts modules=loop,squashfs,sd-mod,usb-storage quiet initrd (hd0,msdos2)/boot/initramfs-lts } rm /etc/initramfs-tools/hooks/resize2fs rm /etc/initramfs-tools/hooks/resize2fs cat > /etc/initramfs-tools/hooks/resize2fs <<"EOF" #!/bin/sh PREREQ="" prereqs() { echo "$PREREQ" } case "$1" in prereqs) prereqs exit 0 ;; esac . /usr/share/initramfs-tools/hook-functions copy_exec /sbin/findfs /sbin copy_exec /sbin/e2fsck /sbin copy_exec /sbin/resize2fs /sbin copy_exec /sbin/fdisk /sbin copy_exec /sbin/sfdisk /sbin copy_exec /sbin/parted /sbin copy_exec /bin/bash /sbin EOF chmod +x /etc/initramfs-tools/hooks/resize2fs cat > /etc/initramfs-tools/scripts/init-premount/resize <<"EOF" #!/bin/sh PREREQ="" prereqs() { echo "$PREREQ" } case "$1" in prereqs) prereqs exit 0 ;; esac /sbin/bash EOF chmod +x /etc/initramfs-tools/scripts/init-premount/resize update-initramfs -v -u 顺序 e2fsck -f /dev/vda1 resize2fs -f /dev/vda1 35G fdisk /dev/vda a 1 resize2fs /dev/vda1 exit http://mirrors.ustc.edu.cn/alpine/v3.16/releases/x86_64/alpine-virt-3.16.2-x86_64.iso wget http://mirrors.ustc.edu.cn/alpine/v3.16/releases/x86_64/alpine-standard-3.16.2-x86_64.iso mkfs.ext4 /dev/vda2 mount -t ext4 /dev/vda2 /mnt mkdir /cd mount -o loop alpine-standard-3.16.2-x86_64.iso /cd cd /cd cp -r * /mnt mv /root/alpine-standard-3.16.2-x86_64.iso /mnt 84857599 13106700 9175040 insmod ext2 set root=(hd0,msdos1) set isofile='/alpine.iso' loopback loop ${isofile} linux (loop)/boot/vmlinuz-virt modules=loop,squashfs,sd-mod,usb-storage quiet initrd (loop)/boot/initramfs-virt linux (hd0,msdos1)/boot/vmlinuz-lts modules=loop,squashfs,sd-mod,usb-storage quiet initrd (hd0,msdos1)/boot/initramfs-lts boot #禁用ipv6 vi /etc/sysctl.conf net.ipv6.conf.all.disable_ipv6 = 1 sudo sysctl -p #格式化 apk add e2fsprogs mkfs.ext4 -O ^has_journal /dev/vda1 mount -t ext4 /dev/vda1 /mnti #如果启动时认不出，就用ext2格式 cd /media/vda2 mount -o loop -t iso9660 alpine-standard-3.16.2-x86_64.i…

ipxe 装 alpine 再装 win
type: item
date: 2026-02-06T14:57:00+00:00
description: 1.ipxe启动 netbootset net0/ip <ip> set net0/netmask <netmask> set net0/gateway <gateway> set dns <nameserver> ifopen net0 chain --autofree http://boot.netboot.xyz 2.禁用ipv6echo 1 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6 3.alpine安装setup-alpine setup-disk -s 0 /dev/vda 4.分区调整apk add e2fsprogs-extra apk add ntfs-3g-progs apk add cfdisk 一定要先e2fsck -f /dev/vda2 resize2fs -f /dev/vda2 35G再用cfdisk5.换grub启动apk del syslinux apk add grub grub-bios grub-install /dev/vda blkid cat <<EOF >> /etc/grub.d/40_custom menuentry "Alpine Linux" { set root=(hd0,1) linux /boot/vmlinuz root=UUID=caff7641-b9d3-435a-8282-fc3b15ae8b3a modules=sd-mod,usb-storage4,ext3 quiet initrd /boot/initramfs-vanilla } EOFUUID为blkid显示的vda2grub-mkconfig -o /boot/grub/grub.cfg 6.把memdisk复制到/boot,启动grub时按clinux16 (hd0,msdos1)/boot/memdisk iso rawinitrd16 (hd0,msdos2)/win10.isoboot

docker Daemon 代理
type: item
date: 2025-10-20T16:56:16+00:00
description: sudo mkdir -p /etc/systemd/system/docker.service.d sudo tee /etc/systemd/system/docker.service.d/http-proxy.conf <<-'EOF' [Service] Environment="HTTP_PROXY=http://proxy.example.com:8080" Environment="HTTPS_PROXY=http://proxy.example.com:8080" Environment="NO_PROXY=localhost,127.0.0.1,.example.com" EOF

bcdedit 启动 win10pe
type: item
date: 2025-01-01T15:55:44+00:00
description: bcdedit /create {ramdiskoptions} /d "win 10 pe" bcdedit /set {radiopticons} ramdisksdidevice partition=D: bcdedit /set {ramdiskoptions} ramdisksdipath \win10\Boot\boot.sdi Bcdedit /create /d "Boot from Wim" /application osloader 运行完上面会生成guid,替换下面的guidbcdedit /set {acd191c6-69d3-11ed-80cd-c9ce13ba6396} device ramdisk=[D:]\win10\Sources\boot.wim,{ramdiskoptions} bcdedit /set {acd191c6-69d3-11ed-80cd-c9ce13ba6396} osdevice ramdisk=[D:]\win10\Sources\boot.wim,{ramdiskoptions} bcdedit /set {acd191c6-69d3-11ed-80cd-c9ce13ba6396} path \windows\system32\boot\winload.exe bcdedit /set {acd191c6-69d3-11ed-80cd-c9ce13ba6396} systemroot \windows bcdedit /set {acd191c6-69d3-11ed-80cd-c9ce13ba6396} winpe yes bcdedit /set {acd191c6-69d3-11ed-80cd-c9ce13ba6396} detecthal yes bcdedit /displayorder {acd191c6-69d3-11ed-80cd-c9ce13ba6396} /addlast

windows 更新时间
type: item
date: 2024-12-16T14:26:00+00:00
description: https://learn.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-time-service-tools-and-settings?tabs=config1.更新time serverw32tm /config /manualpeerlist:"3.openwrt.pool.ntp.org time.ustc.edu.cn ntp1.aliyun.com" /syncfromflags:manual /update w32tm /config /update /manualpeerlist:"0.pool.ntp.org,0x8 1.pool.ntp.org,0x8 2.pool.ntp.org,0x8 3.pool.ntp.org,0x8" /syncfromflags:manual 2.更新一次时间w32tm /resync

hyper添加nvdia虚拟显卡
type: item
date: 2024-10-26T12:44:00+00:00
description: #如虚拟机名称为win10 Set-VM -Name "win10" -AutomaticStopAction TurnOff Set-VM -GuestControlledCacheTypes $true -VMName "win10" # 设置MMIO，总的io映射内存，我们直接设置为32GB(通用大小)，出现其他问题再扩大即可 Set-VM -LowMemoryMappedIoSpace 1Gb -VMName "win10" Set-VM -HighMemoryMappedIoSpace 32Gb -VMName "win10" # 添加虚拟化， Add-VMGpuPartitionAdapter -VMName "win10" # 指定显卡添加，这个显卡ID通过Get-VMHostPartitionableGpu命令获取到的“Name”字段值 # 注意，低版本的window10是无法使用这个命令指定的 # Add-VMGpuPartitionAdapter -VMName "win10" -InstancePath "显卡ID" # 例如我的显卡ID是：\\?\PCI#VEN_10DE&DEV_1F91&SUBSYS_1AB11043&REV_A1#4&1885b93c&0&0008#{064092b3-625e-43bf-9eb5-dc845897dd59}\GPUPARAV # 添加后，设置自动配置显卡 Set-VMGpuPartitionAdapter -VMName "win10" # 删除虚拟显卡的分配，配置错误可重新来 Remove-VMGpuPartitionAdapter -VMName "win10" 我们先复制物理机系统的C:\Windows\System32\nvapi64.dll放到虚拟机的：C:\Windows\System32\nvapi64.dll再复制物理机中的C:\Windows\System32\DriverStore\FileRepository目录中以nv开头的文件夹到虚拟机中的C:\Windows\System32\HostDriverStore\FileRepository目录下，其中HostDriverStore\FileRepository目录需要自己创建：重启虚拟机即可$vm = "你的虚拟机名称" Remove-VMGpuPartitionAdapter -VMName $vm Add-VMGpuPartitionAdapter -VMName $vm Set-VMGpuPartitionAdapter -VMName $vm -MinPartitionVRAM 1 Set-VMGpuPartitionAdapter -VMName $vm -MaxPartitionVRAM 11 Set-VMGpuPartitionAdapter -VMName $vm -OptimalPartitionVRAM 10 Set-VMGpuPartitionAdapter -VMName $vm -MinPartitionEncode 1 Set-VMGpuPartitionAdapter -VMName $vm -MaxPartitionEncode 11 Set-VMGpuPartitionAdapter -VMName $vm -OptimalPartitionEncode 10 Set-VMGpuPartitionAdapter -VMName $vm -MinPartitionDecode 1 Set-VMGpuPartitionAdapter -VMName $vm -MaxPartitionDecode 11 Set-VMGpuPartitionAdapter -VMName $vm -OptimalPartitionDecode 10 Set-VMGpuPartitionAdapter -VMName $vm -MinPartitionCompute 1 Set-VMGpuPartitionAdapter -VMName $vm -MaxPartitionCompute 11 Set-VMGpuPartitionAdapter -VMName $vm -OptimalPartitionCompute 10 Set-VM -GuestControlledCacheTypes $true -VMName $vm Set-VM -LowMemoryMappedIoSpace 1GB -VMName $vm Set-VM -HighMemoryMappedIoSpace 32GB -VMName $vm Start-VM -Name $vm