[{"data":1,"prerenderedAt":189},["ShallowReactive",2],{"content:\u002F2024\u002Fboot-management":3,"surround:\u002F2024\u002Fboot-management":177},{"id":4,"title":5,"body":6,"categories":150,"date":152,"description":153,"draft":154,"extension":155,"image":156,"meta":157,"navigation":159,"path":160,"permalink":161,"published":161,"readingTime":162,"recommend":161,"references":161,"seo":167,"sitemap":168,"stem":169,"tags":170,"type":174,"updated":175,"__hash__":176},"content\u002Fposts\u002F2024\u002Fboot-management.md","系统引导配置分享",{"type":7,"value":8,"toc":135},"minimark",[9,13,17,20,23,27,32,37,40,51,58,62,71,74,78,81,84,87,93,96,99,103,113,116,119,125,132],[10,11,12],"h2",{"id":12},"前置知识",[14,15,16],"p",{},"一般来说，系统引导方式有 Legacy 引导和 UEFI 引导。其中 Legacy 引导方式较为古老，不在本篇文章的讨论范围内。",[14,18,19],{},"UEFI 引导中，可以有多个启动项，比如 Windows Boot Manager、Linux Boot Manager、Grub、网络启动、USB设备启动等。",[14,21,22],{},"而在诸如 Windows Boot Manager、Linux Boot Manager、Grub 这些启动项管理器中，也可以设置多个启动项。如果安装了多个 Windows 系统，Windows Boot Manager 中会显示多个 Windows 启动项；如果安装了 Linux 系统， Grub 中会显示 Linux 系统、Linux 系统(高级启动)，以及可能会有 Windows Boot Manager 的启动项。",[10,24,26],{"id":25},"windows-下使用脚本重启到其他系统","Windows 下使用脚本重启到其他系统",[28,29,31],"h3",{"id":30},"列出-efi-启动项","列出 EFI 启动项",[33,34],"copy",{"code":35,"prompt":36},"bcdedit \u002Fenum ALL","PS(管理员)>",[14,38,39],{},"执行此命令，你会看到类似以下内容：",[41,42,47],"pre",{"className":43,"code":45,"language":46},[44],"language-text","固件启动管理器\n---------------------\n标识符                  {fwbootmgr}\ndisplayorder            {bootmgr}\n                        {77a0d197-59c5-11ee-b0be-c8cb9e630a73}\n                        {9dda157b-7ef3-11ee-b143-806e6f6e6963}\n                        {f0506e71-9c73-11ed-adf2-806e6f6e6963}\n\nWindows 启动管理器\n--------------------\n标识符                  {bootmgr}\ndevice                  partition=\\Device\\HarddiskVolume1\npath                    \\EFI\\Microsoft\\Boot\\bootmgfw.efi\ndescription             Windows Boot Manager\n\n固件应用程序(101fffff)\n-------------------------------\n标识符                  {77a0d197-59c5-11ee-b0be-c8cb9e630a73}\ndevice                  partition=\\Device\\HarddiskVolume1\npath                    \\EFI\\systemd\\systemd-bootx64.efi\ndescription             Linux Boot Manager\n\n固件应用程序(101fffff)\n-------------------------------\n标识符                  {9dda157b-7ef3-11ee-b143-806e6f6e6963}\ndevice                  partition=\\Device\\HarddiskVolume6\npath                    \\EFI\\Microsoft\\Boot\\bootmgfw.efi\ndescription             Windows Boot Manager\n\n固件应用程序(101fffff)\n-------------------------------\n标识符                  {f0506e71-9c73-11ed-adf2-806e6f6e6963}\ndescription             EFI USB Device\n\nWindows 启动加载器\n-------------------\n标识符                  {current}\ndevice                  partition=C:\npath                    \\WINDOWS\\system32\\winload.efi\ndescription             Windows 11\n\n……\n","text",[48,49,45],"code",{"__ignoreMap":50},"",[14,52,53,54,57],{},"记住你需要重启到的、形如 ",[48,55,56],{"code":56},"{77a0d197-59c5-11ee-b0be-c8cb9e630a73}"," 的 UUID，就可以编写脚本了。",[28,59,61],{"id":60},"重启到指定-efi-启动项","重启到指定 EFI 启动项",[41,63,69],{"className":64,"code":66,"filename":67,"language":68,"meta":50},[65],"language-bat","rem 使用管理员权限运行此脚本\n%1 mshta vbscript:CreateObject(\"Shell.Application\").ShellExecute(\"cmd\",\"\u002Fc %~s0 ::\",\"\",\"runas\",1)(window.close) && exit\nrem 将 Linux Boot Manager 设置为下次启动项\nbcdedit \u002Fset \"{fwbootmgr}\" bootsequence \"{77a0d197-59c5-11ee-b0be-c8cb9e630a73}\" \u002Faddfirst\nrem 重启\nshutdown -r -t 0\n","reboot-to-some-entry.bat","bat",[48,70,66],{"__ignoreMap":50},[14,72,73],{},"推荐将脚本放在用户文件夹下，因为这是终端启动、SSH连接时的默认目录，输入文件名即可运行。",[10,75,77],{"id":76},"在-linux-下重启到其他系统","在 Linux 下重启到其他系统",[28,79,80],{"id":80},"列出启动项",[33,82],{"code":83},"efibootmgr",[14,85,86],{},"执行此命令后，会得到如下所示的 EFI 启动项列表：",[41,88,91],{"className":89,"code":90,"language":46},[44],"BootCurrent: 0005\nBootOrder: 0001,0005,0004,2001\nBoot0001* Windows Boot Manager  HD(1,GPT,04f43acd-5a75-4946-b8eb-8c2b4aa000c3,0x800,0x100000)\u002F\\EFI\\Microsoft\\Boot\\bootmgfw.efi\nBoot0004* Windows Boot Manager  HD(1,GPT,3f296803-1e98-4d7f-b76b-263785c2dcef,0x28,0x100000)\u002F\\EFI\\Microsoft\\Boot\\bootmgfw.efi\nBoot0005* Linux Boot Manager    HD(1,GPT,04f43acd-5a75-4946-b8eb-8c2b4aa000c3,0x800,0x100000)\u002F\\EFI\\systemd\\systemd-bootx64.efi\nBoot2001* EFI USB Device        RC\n",[48,92,90],{"__ignoreMap":50},[28,94,61],{"id":95},"重启到指定-efi-启动项-1",[33,97],{"code":98},"sudo efibootmgr -n 四位数序号",[28,100,102],{"id":101},"修改-linux-boot-manager-的下一次启动项默认启动项","修改 Linux Boot Manager 的下一次启动项\u002F默认启动项",[104,105,106],"blockquote",{},[14,107,108,109,112],{},"仅适用于使用 ",[48,110,111],{"code":111},"systemd-boot"," 启动的系统，如果你在使用 Grub，请参阅其他教程。",[33,114],{"code":115},"bootctl list",[14,117,118],{},"执行此命令后，可以列出如下所示的启动项列表：",[41,120,123],{"className":121,"code":122,"language":46},[44],"         type: Boot Loader Specification Type #1 (.conf)\n        title: Arch Linux (default) (selected)\n           id: 10-arch.conf\n       source: \u002Fboot\u002F\u002Floader\u002Fentries\u002F10-arch.conf\n        linux: \u002Fboot\u002F\u002Fvmlinuz-linux\n       initrd: \u002Fboot\u002F\u002Famd-ucode.img\n               \u002Fboot\u002F\u002Finitramfs-linux.img\n      options: root=PARTUUID=7227604a-aca1-034d-9bd3-e17d53548a62 rw rootfstype=btrfs\n\n         type: Automatic\n        title: Windows Boot Manager\n           id: auto-windows\n       source: \u002Fsys\u002Ffirmware\u002Fefi\u002Fefivars\u002FLoaderEntries-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f\n\n         type: Automatic\n        title: Reboot Into Firmware Interface\n           id: auto-reboot-to-firmware-setup\n       source: \u002Fsys\u002Ffirmware\u002Fefi\u002Fefivars\u002FLoaderEntries-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f\n",[48,124,122],{"__ignoreMap":50},[14,126,127,128,131],{},"使用此命令可以修改 Linux Boot Manager 的下一次启动项，若想修改默认启动项，请使用 ",[48,129,130],{"code":130},"set-default"," 选项。",[33,133],{"code":134},"sudo bootctl set-oneshot [ID]",{"title":50,"searchDepth":136,"depth":136,"links":137},4,[138,140,145],{"id":12,"depth":139,"text":12},2,{"id":25,"depth":139,"text":26,"children":141},[142,144],{"id":30,"depth":143,"text":31},3,{"id":60,"depth":143,"text":61},{"id":76,"depth":139,"text":77,"children":146},[147,148,149],{"id":80,"depth":143,"text":80},{"id":95,"depth":143,"text":61},{"id":101,"depth":143,"text":102},[151],"技术","2024-03-01 14:06:19","指哪里就启动哪里——在 Windows 和 Linux 系统下实现重启至特定 EFI 引导项。",false,"md","https:\u002F\u002Fassets.zhilu.cyou\u002Fcover3\u002Fboot-management.jpg",{"slots":158},{},true,"\u002F2024\u002Fboot-management",null,{"text":163,"minutes":164,"time":165,"words":166},"4 min read",3.135,188100,627,{"title":5,"description":153},{"loc":160},"posts\u002F2024\u002Fboot-management",[171,172,173],"双系统","引导管理","Arch Linux","tech","2024-03-01 15:17:30","syOIJqgMRyc-1RkmF5761LvKEel-GGfa72JoaVJ1LKI",[178,183],{"title":179,"path":180,"stem":181,"date":182,"type":174,"children":-1},"病毒高占用CPU，三天杀俩","\u002F2024\u002Fvirus-trueupdate","posts\u002F2024\u002Fvirus-trueupdate","2024-02-29 23:54:43",{"title":184,"path":185,"stem":186,"date":187,"type":188,"children":-1},"今日无事，除了一些技术咨询","\u002F2024\u002Fhelping-day","posts\u002F2024\u002Fhelping-day","2024-03-10 21:14:38","story",1782091376259]