wiki/linux.systemd.bootloader.html
2022-07-29 15:41:17 +00:00

41 lines
11 KiB
HTML

<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width"/><meta charSet="utf-8"/><title>systemd-boot</title><script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script><script id="MathJax-script" async="" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script><script type="text/x-mathjax-config">
MathJax = {
tex: {
inlineMath: [ [&#x27;$&#x27;,&#x27;$&#x27;], [&#x27;\(&#x27;,&#x27;\)&#x27;] ],
displayMath: [ [&#x27;$$&#x27;,&#x27;$$&#x27;], [&#x27;[&#x27;,&#x27;]&#x27;] ]
},
options = {
processHtmlClass = &quot;math&quot;
}
}
</script><meta name="next-head-count" content="6"/><link rel="preload" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" as="style"/><link rel="stylesheet" href="/wiki/_next/static/css/52fc2ba29703df73922c.css" data-n-g=""/><noscript data-n-css=""></noscript><link rel="preload" href="/wiki/_next/static/chunks/main-ae4733327bd95c4ac325.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/webpack-50bee04d1dc61f8adf5b.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/framework.9d524150d48315f49e80.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/commons.0e1c3f9aa780c2dfe9f0.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/_app-8e3d0c58a60ec788aa69.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/940643274e605e7596ecea1f2ff8d83317a3fb76.4841a16762f602a59f00.js" as="script"/><link rel="preload" href="/wiki/_next/static/chunks/pages/%5B%5B...slug%5D%5D-1aa198f87ede1cd0e1dc.js" as="script"/></head><body><div id="__next"><main><h1>systemd-boot</h1><section class="post-metadata"><span>Date: <!-- -->2021-08-07 20:08:09 +08:00</span><span>Date modified: <!-- -->2022-05-22 21:24:33 +08:00</span></section><nav class="toc"><ol class="toc-level toc-level-1"></ol></nav><p>systemd also comes with a bootloader aptly named <code class="inline-verbatim">systemd-boot</code> though it only supports UEFI-based firmware.
Just like GRUB, they can be configured through plain-text files.
</p><p>For detailed information about the bootloader, see the manual page <code class="inline-verbatim">systemd-boot.7</code>.
</p><p>With a complete installation, the bootloader config folder may look like the following list.
</p><pre class="src-block"><code>/boot/
`-- loader
|-- entries # (ref:loader-entries)
| `-- arch.conf
|-- loader.conf # (ref:loader-conf)
`-- random-seed
</code></pre><ul><li><p><a href="/wiki/(loader-entries)"><code class="inline-verbatim">loader/entries/</code></a> is a directory containing all of the entries available to be booted.
</p></li><li><p><a href="/wiki/(loader-conf)"><code class="inline-verbatim">loader.conf</code></a> contains the loader configuration.
</p></li></ul><p>Most Linux distros with systemd installed should have a sample config file somewhere. <!-- -->
As an example, we&#x27;ll show what those look like.
</p><p><code class="inline-verbatim">loader.conf</code> is the configuration for the boot loader including the timeout seconds among others.
Here is a sample of a bootloader configuration.
</p><pre class="src-block"><code>default arch
timeout 4
</code></pre><p>In this config, this simply makes the <code class="inline-verbatim">arch</code> loader entry to be default when no actions has occurred.
It will start loading it automatically after a timeout of 4 seconds.
</p><p>The <code class="inline-verbatim">arch</code> loader entry can be found at <code class="inline-verbatim">${ESP}/loader/entries/arch.conf</code>.
The following code block shows what a loader entry looks like.
</p><pre class="src-block"><code>title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=&quot;PARTUUID=${PARTUUID}&quot;
</code></pre><p>You can customize and create extra entries for the same installation.
This is what <a href="/wiki/linux.distros.nixos">NixOS</a> does with its system generations, letting the user to boot to a specific point in time from the boot loader.
Very useful for emergency boots in case the current generation breaks for whatever reason.
</p><p>For complete details of the configuration file, you can see <code class="inline-verbatim">loader.conf.5</code> manual page.
</p><section><h2>Backlinks</h2><ul><li><a href="/wiki/linux.systemd">systemd</a></li></ul></section></main></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"metadata":{"date":"2021-08-07 20:08:09 +08:00","date_modified":"2022-05-22 21:24:33 +08:00","language":"en","source":""},"title":"systemd-boot","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"systemd also comes with a bootloader aptly named "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"systemd-boot"}]},{"type":"text","value":" though it only supports UEFI-based firmware.\nJust like GRUB, they can be configured through plain-text files.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"For detailed information about the bootloader, see the manual page "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"systemd-boot.7"}]},{"type":"text","value":".\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"With a complete installation, the bootloader config folder may look like the following list.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"/boot/\n`-- loader\n |-- entries # (ref:loader-entries)\n | `-- arch.conf\n |-- loader.conf # (ref:loader-conf)\n `-- random-seed\n"}]}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"/(loader-entries)"},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"loader/entries/"}]}]},{"type":"text","value":" is a directory containing all of the entries available to be booted.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"/(loader-conf)"},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"loader.conf"}]}]},{"type":"text","value":" contains the loader configuration.\n"}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Most Linux distros with systemd installed should have a sample config file somewhere. "},{"type":"text","value":"\nAs an example, we'll show what those look like.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"loader.conf"}]},{"type":"text","value":" is the configuration for the boot loader including the timeout seconds among others.\nHere is a sample of a bootloader configuration.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"default arch\ntimeout 4\n"}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In this config, this simply makes the "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"arch"}]},{"type":"text","value":" loader entry to be default when no actions has occurred.\nIt will start loading it automatically after a timeout of 4 seconds.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"arch"}]},{"type":"text","value":" loader entry can be found at "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"${ESP}/loader/entries/arch.conf"}]},{"type":"text","value":".\nThe following code block shows what a loader entry looks like.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"title Arch Linux\nlinux /vmlinuz-linux\ninitrd /initramfs-linux.img\noptions root=\"PARTUUID=${PARTUUID}\"\n"}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You can customize and create extra entries for the same installation.\nThis is what "},{"type":"element","tagName":"a","properties":{"href":"/linux.distros.nixos"},"children":[{"type":"text","value":"NixOS"}]},{"type":"text","value":" does with its system generations, letting the user to boot to a specific point in time from the boot loader.\nVery useful for emergency boots in case the current generation breaks for whatever reason.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"For complete details of the configuration file, you can see "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"loader.conf.5"}]},{"type":"text","value":" manual page.\n"}]}]},"backlinks":[{"path":"/linux.systemd","title":"systemd"}]},"__N_SSG":true},"page":"/[[...slug]]","query":{"slug":["linux.systemd.bootloader"]},"buildId":"Ie9t5zutrXP6Of75Cb5xF","assetPrefix":"/wiki","nextExport":false,"isFallback":false,"gsp":true}</script><script nomodule="" src="/wiki/_next/static/chunks/polyfills-99d808df29361cf7ffb1.js"></script><script src="/wiki/_next/static/chunks/main-ae4733327bd95c4ac325.js" async=""></script><script src="/wiki/_next/static/chunks/webpack-50bee04d1dc61f8adf5b.js" async=""></script><script src="/wiki/_next/static/chunks/framework.9d524150d48315f49e80.js" async=""></script><script src="/wiki/_next/static/chunks/commons.0e1c3f9aa780c2dfe9f0.js" async=""></script><script src="/wiki/_next/static/chunks/pages/_app-8e3d0c58a60ec788aa69.js" async=""></script><script src="/wiki/_next/static/chunks/940643274e605e7596ecea1f2ff8d83317a3fb76.4841a16762f602a59f00.js" async=""></script><script src="/wiki/_next/static/chunks/pages/%5B%5B...slug%5D%5D-1aa198f87ede1cd0e1dc.js" async=""></script><script src="/wiki/_next/static/Ie9t5zutrXP6Of75Cb5xF/_buildManifest.js" async=""></script><script src="/wiki/_next/static/Ie9t5zutrXP6Of75Cb5xF/_ssgManifest.js" async=""></script></body></html>