summaryrefslogtreecommitdiff
path: root/src/boot
Commit message (Collapse)AuthorAgeFilesLines
* Update FSF license notices to use URL instead of addressJoseph Marrero2021-12-078-24/+8
|
* ostree-remount: Order before systemd-rfkill.*Jonathan Lebon2021-06-221-1/+1
| | | | | | | | | | | The `systemd-rfkill.*` service falls in the category of early things that need write access to `/var`, so we need to make sure we run before or it might hit the read-only sysroot. The long-term fix for this is https://github.com/ostreedev/ostree/issues/2115. Closes: https://github.com/coreos/fedora-coreos-tracker/issues/746
* Fix mkinitcpio with newer systemd versionsMatt Bilker2020-08-251-1/+1
| | | | | | | - Fixes systemd failing to determine if `/sysroot` is valid because of `/etc/os-release` not being available yet. - Related: #1759
* boot: Replace deprecated StandardOutput=syslog with journal, etc.Simon McVittie2020-08-212-4/+4
| | | | | | | systemd deprecated this in v246. Resolves: #2169 Signed-off-by: Simon McVittie <smcv@collabora.com>
* dracut: Create reproducible imagesJoão Paulo Rechi Vita2020-08-131-0/+1
| | | | | | | | | | Without reproducible images, a rebuild of the initrd will create a different image file (due to things like creation time of the files in the cpio archive) even if the actual contents in it are exactly the same, adding an unnecessary download during updates. Adding 'reproducible=yes' avoids this and creates the same image files for the same content.
* finalize: Add RequiresMountsFor=/boot tooColin Walters2020-05-131-1/+1
| | | | | | | | | | In https://bugzilla.redhat.com/show_bug.cgi?id=1827712 some OpenShift CI is seeing `/boot` being unmounted before `ostree-finalize-staged.service` runs or completes. We finally tracked this down to a bug elsewhere, but I think we should add this because it clearly shows our requirements.
* ostree-prepare-root: Requires=sysroot.mountColin Walters2020-05-081-0/+1
| | | | | | | | | | | With just `After=` we'll still try to run in the scenario where `sysroot.mount` fails because the rootfs didn't appear. And this will end up spewing an error which can confuse people into thinking something is wrong at the ostree level. This has come up numerous times w/{Fedora,RHEL} CoreOS, most recently while looking at https://bugzilla.redhat.com/show_bug.cgi?id=1803130
* finalize-staged: Add ProtectHome=yes and ReadOnlyPaths=/etcColin Walters2020-04-221-0/+8
| | | | | | | | | | | | Same motivation as https://github.com/coreos/rpm-ostree/pull/2060 I tried `InaccessiblePaths=/var` first and was very sad to find out we have one tiny exception that breaks it. Otherwise it'd be so elegant. Maybe in the future we split out that one thing to a separate `ostree-finalized-stage-var.service` that's just `ExecStart=/bin/rm -vf /var/.updated` and is otherwise `ProtectSystem=strict` etc.
* grub2: Don't add menu entries if GRUB supports parsing BLS snippetsJavier Martinez Canillas2020-04-061-0/+10
| | | | | | | | | | | | | | | | | | | | | | This is another attempt to avoid having duplicated menu entries caused by GRUB having support to parse BLS snippets and the 15_ostree script adding menu entries as well. The previous attempt was in commit 985a1410029 ("grub2: Exit gracefully if the configuration has BLS enabled") but that lead to users not having menu entries at all, due having an old GRUB version that was not able to parse the BLS snippets. This happened because the GRUB bootloader is never updated in the ESP as a part of the OSTree upgrade transaction. The logic is similar to the previous commit, the 15_ostree script exits if able to determine that the bootloader can parse the BLS snippets directly. But this time it will not only check that a BLS configuration was enabled, but also that a /boot/grub2/.grub2-blscfg-supported file exists. This file has to be created by a component outside of OSTree that also takes care of updating GRUB to a version that has proper BLS support.
* Support mounting /sysroot (and /boot) read-onlyColin Walters2019-12-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to support extending the read-only state to cover `/sysroot` and `/boot`, since conceptually all of the data there should only be written via libostree. Or at least for `/boot` should *mostly* just be written by ostree. This change needs to be opt-in though to avoid breaking anyone. Add a `sysroot/readonly` key to the repository config which instructs `ostree-remount.service` to ensure `/sysroot` is read-only. This requires a bit of a dance because `/sysroot` is actually the same filesystem as `/`; so we make `/etc` a writable bind mount in this case. We also need to handle `/var` in the "OSTree default" case of a bind mount; the systemd generator now looks at the writability state of `/sysroot` and uses that to determine whether it should have the `var.mount` unit happen before or after `ostree-remount.service.` Also add an API to instruct the libostree shared library that the caller has created a new mount namespace. This way we can freely remount read-write. This approach extends upon in a much better way previous work we did to support remounting `/boot` read-write. Closes: https://github.com/ostreedev/ostree/issues/1265
* Revert "grub2: Exit gracefully if the configuration has BLS enabled"Colin Walters2019-10-241-7/+0
| | | | | | | This reverts commit 985a14100295c99d0c6d712bfbee0ec52a3a1601. It turned out that some people have old bootloaders, and hence get the "no entries" problem. That's much, much much worse than double entries.
* grub2: Exit gracefully if the configuration has BLS enabledJavier Martinez Canillas2019-09-261-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Fedora 30 grub2 has support to populate its menu entries from the BootLoaderSpec fragments in /boot/loader/entries, so there's no need to generate menu entries anymore using the /etc/grub.d/15_ostree script. But since ostree doesn't update the bootloader, it may be that the grub2 installed is an old one that doesn't have BLS support. For new installs, GRUB_ENABLE_BLSCFG=true is set in /etc/default/grub to tell the /etc/grub.d/10_linux script if a blscfg command has to be added to the generated grub2 config file. So check if BLS is enabled in /etc/default/grub and only add the entries if that's not the case. Otherwise the menu entries will be duplicated. The approach has the drawback that if a user sets GRUB_ENABLE_BLSCFG=true in /etc/default/grub without updating grub2, they will get an empty menu. Since there won't be any entries created by the 30_ostree script and the blscfg command won't work on the older grub2. Unfortunately there is no way to know if the installed grub2 already has BLS support or not. Related: https://bugzilla.redhat.com/show_bug.cgi?id=1751272#c27 Closes: #1929 Approved by: jlebon
* boot/finalize-staged: Run after systemd-journal-flush.serviceJonathan Lebon2019-09-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | In Fedora 31, `systemd-journal-flush.service` uses a new `--smart-relinquish-var` switch which fixes the `umount: /var: target is busy` bug by telling journald to stop logging to `/var` and back to `/run` again during shutdown. This interacted with `ostree-finalize-staged.service` in a tricky way: since we weren't strongly ordered against it, when we happened to finalize after `/var` is relinquished, we never persisted the output from that service to disk. This then threw off `rpm-ostree status` when trying to find the completion message to know that finalization went well. Just fix this by adding an explicit `After=` on that unit. That way we shut down *before* `systemd-journal-flush.service` (the `/var` relinquish bit happens in its `ExecStop=`). For more info, see: https://github.com/systemd/systemd/commit/3ff7a50d66e3f851d3d9f132b740a7fb2055aa1d https://github.com/systemd/systemd/commit/1e187d2dd52cbb4f0bb30e4d96acf7f72a145b91 https://bugzilla.redhat.com/show_bug.cgi?id=1751272 Closes: #1926 Approved by: cgwalters
* boot: Activate ostree-finalize-staged even earlierJonathan Lebon2019-04-151-2/+2
| | | | | | | | | | | | | Really, all `ostree admin finalize-staged` needs is access to `/sysroot` and `/boot`. So let's activate it right after `local-fs.target` so that it gets deactivated later in the shutdown process. This should allow us to conflict with less services still running and possibly writing things to `/etc`. Related: https://bugzilla.redhat.com/show_bug.cgi?id=1672283 Closes: #1840 Approved by: cgwalters
* ostree-grub-generator: Comment wording fixRobert Fairley2019-03-011-1/+1
| | | | | Closes: #1814 Approved by: jlebon
* grub2: add support for devicetreeRicardo Salveti2018-12-211-0/+7
| | | | | | | | | | | | | | Similar as available for u-boot (ce2995e1dc1557c4d97ef5af807eacf3ef4a22d8) and syslinux (c5112c25e4519835c4cd53f4350c1b2f2a477746), enable parsing and writing devicetree filename into grub.cfg. This is required by arm64-based devices running edk2 instead of u-boot as the main bootloader (e.g. 96boards HiKey and HiKey960). Signed-off-by: Ricardo Salveti <ricardo@foundries.io> Closes: #1790 Approved by: cgwalters
* boot/grub2: Add some more explanation in ostree-grub-generatorJonathan Lebon2018-12-201-5/+6
| | | | | | | | | | Even with the previous docstring, I didn't understand at first the relationship between the `ostree-grub-generator` script and `ostree-bootloader-grub2.c`. Throw some more docs to clarify things a bit. Closes: #1791 Approved by: cgwalters
* boot: Add ostree-finalize-staged.pathJonathan Lebon2018-10-231-0/+28
| | | | | | | | | | | | | | | | Rather than manually starting the `ostree-finalize-staged.service` unit, we can leverage systemd's path units for this. It fits quite nicely too, given that we already have a path we drop iif we have a staged deployment. To give some time for the preset to make it to systems, we don't yet drop the explicit call to `systemctl start`. Though we do make it conditional based on a DEBUG env var so that we can actually test it in CI for now. Once we're sure this has propagated, we can drop the `systemctl start` path and the env var together. Closes: #1740 Approved by: cgwalters
* ostree-prepare-root.service: Run earlier in initrdJonathan Lebon2018-10-192-5/+4
| | | | | | | | | | | | | | | | | | | | | Previously, we were preparing the root very late in the boot process; right before we switch root. The issue with that is that most services in the initrd that run `After=initrd-root-fs.target` expect that `/sysroot` already points to the rootfs we'll be pivoting to. Running this late violates that assumption. This patch fixes this by making `ostree-prepare-root.service` instead run right after `sysroot.mount` (the physical sysroot mounted by systemd) but still before `initrd-root-fs.target` (which is the target signalling that `/sysroot` is now valid and ready). This should make it easier to integrate OSTree with other initrd services such as Ignition. Related: https://github.com/dustymabe/ignition-dracut/issues/20 Closes: #1759 Approved by: cgwalters
* ostree-prepare-root.service: Use RemainAfterExit=yesJonathan Lebon2018-10-191-0/+1
| | | | | | | | | For the same reasons as #1697. This is especially important in services that are likely to be used as an `After/Before=` target in other units. `ostree-prepare-root.service` is one such service. Closes: #1759 Approved by: cgwalters
* finalize-staged: Bump timeout to 5 minutesColin Walters2018-10-161-0/+4
| | | | | | | | | | | | | | | | | | | | | See https://github.com/projectatomic/rpm-ostree/issues/1568 Basically for people on e.g. rotational media, the default 90 second timeout can be too small. We're in a tough situation here, because delaying shutdown can be problematic too if the user is trying to shut down their laptop to put in a backpack, etc. There's potential optimizations here to make; I think we could pre-copy the kernel/initramfs for example. I suspect for some people the grub2 os-prober is a factor here too, if that tries to e.g. inspect attached USB rotational hard drives. But hopefully we'll get rid of that soon. Closes: #1755 Approved by: jlebon
* boot: Add Documentation= lines to servicesJonathan Lebon2018-10-053-1/+4
| | | | | | | | | It's a neat way to point folks to the documentation (of course, better would be to have man pages for each of those services). Also consistently use Title Case everywhere. Closes: #1750 Approved by: cgwalters
* boot: Remove [Install] from ostree-finalize-stagedJonathan Lebon2018-10-051-3/+0
| | | | | | | | Let's just make this service not installable anymore. It should only be activated manually. Closes: #1750 Approved by: cgwalters
* ostree-remount.service: RemainAfterExit=yesColin Walters2018-07-311-0/+1
| | | | | | | | | | | | | | | | | This is standard practice for units like this; e.g. it's what `systemd-remount-fs.service` does. I think it may be part of or the whole cause for https://github.com/projectatomic/rpm-ostree/issues/1471 I haven't reproduced the problem exactly but it seems to me that if the unit starts and is GC'd, then when systemd goes to execute a later unit it might end up restarting it. A noticeable side effect of this is that `systemctl status ostree-remount` exits with code `0` as expected. Closes: #1697 Approved by: jlebon
* boot: Use emergency.target, not emergency.serviceAlex Kiernan2018-07-032-2/+2
| | | | | | | | | | | | Follow systemd units in using emergency.target, not emergency.service (which is the sole unit, by default, in emergency.target) so we can easily reconfigure the units which are actived when entering emergency mode. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Closes: #1665 Approved by: cgwalters
* deploy: Change BootLoaderSpec filenames so they can be used for sortingJavier Martinez Canillas2018-06-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently the BLS snippets are named ostree-$ID-$VARIANT_ID-$index.conf, but the BLS config files are actually sorted by using the version field which is the inverse of the index. In most places, _ostree_sysroot_read_boot_loader_configs() is used to get the BLS files and this function already returns them sorted by the version field. The only place where the index trailing number is used is in the ostree-grub-generator script that lists the BLS files to populate the grub config file. But for some bootloaders the BLS filename is the criteria for sorting by taking the filename as a string version. So on these bootloaders the BLS entries will be listed in the reverse order. To avoid that, change the BLS snippets filename to have the version field instead of the index and also to have the version before deployment name. Make the filenames to be of the form ostree-$version-$ID-$VARIANT_ID.conf so the version is before the deployment name. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Closes: #1654 Approved by: cgwalters
* ostree-grub-generator: sort BLS files by version instead of alphabeticallyJavier Martinez Canillas2018-06-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The ostree-grub-generator populates the grub.cfg menu entries using the BLS config files. But it uses the ls command that by default sorts the entries alphabetically, so the order won't be correct if there are more than 10 deployments, i.e: $ ls -1 /boot/loader/entries/ ostree-fedora-workstation-0.conf ostree-fedora-workstation-10.conf ostree-fedora-workstation-1.conf ... So instead the -v option should be used to make ls use version sorting: $ ls -1 -v /boot/loader/entries/ ostree-fedora-workstation-0.conf ostree-fedora-workstation-1.conf ... ostree-fedora-workstation-10.conf Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Closes: #1653 Approved by: cgwalters
* Add concept of "staged" deploymentColin Walters2018-04-121-0/+36
| | | | | | | | | | | | | | | | | | | | | | Add API to write a deployment state to `/run/ostree/staged-deployment`, along with a systemd service which runs at shutdown time. This is a big change to the ostree model for hosts, but it closes a longstanding set of bugs; many, many people have hit the "losing changes in /etc" problem. It also avoids the other problem of racing with programs that modify `/etc` such as LVM backups: https://bugzilla.redhat.com/show_bug.cgi?id=1365297 We need this in particular to go to a full-on model for automatically updated host systems where (like a dual-partition model) everything is fully prepared and the reboot can be taken asynchronously. Closes: https://github.com/ostreedev/ostree/issues/545 Closes: #1503 Approved by: jlebon
* Add SPDX-License-Identifier to source filesMarcus Folkesson2018-01-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | SPDX License List is a list of (common) open source licenses that can be referred to by a “short identifier”. It has several advantages compared to the common "license header texts" usually found in source files. Some of the advantages: * It is precise; there is no ambiguity due to variations in license header text * It is language neutral * It is easy to machine process * It is concise * It is simple and can be used without much cost in interpreted environments like java Script, etc. * An SPDX license identifier is immutable. * It provides simple guidance for developers who want to make sure the license for their code is respected See http://spdx.org for further reading. Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Closes: #1439 Approved by: cgwalters
* ostree-grub-generator: update outdated commentGatis Paeglis2018-01-101-2/+1
| | | | | Closes: #1401 Approved by: cgwalters
* Support for booting without initramfsGatis Paeglis2018-01-101-3/+5
| | | | | | | | | | | | | | | Previously when initramfs-* was not found in a deployment's boot directory, it was assumed that rootfs is prepared for ostree booting by a kernel patch. With this patch, the behaviour changes to be - if initramfs-* is not found, assume that system is using a static ostree-prepare-root as init process. Booting without initramfs is a common use case on embedded systems. This approach is also more convenient, than having to patch the kernel. Closes: #1401 Approved by: cgwalters
* grub2: Exit gracefully if there's no system ostree repositoryColin Walters2018-01-091-1/+5
| | | | | | | | | | | | Apparently there testing systems that literally install *all* packages. Having `ostree-grub2` currently causes grub2 to fail on a non-ostree managed system. Let's just gracefully exit if there's no system repository. https://bugzilla.redhat.com/show_bug.cgi?id=1532668 Closes: #1399 Approved by: jlebon
* ostree-grub-generator: fix typo in commentWill Thompson2018-01-091-1/+1
| | | | | Closes: #1398 Approved by: jlebon
* grub-generator: If OSTREE_BOOT_PARTITION is not set, default to /bootCarlos Alberto Lopez Perez2017-11-151-1/+6
| | | | | Closes: #1326 Approved by: cgwalters
* boot: Add a tmpfiles.d snippet to clean up /var/tmp/ostree-ovl.XXXColin Walters2017-08-171-0/+19
| | | | | | | | | | | | | This is simplest for now. Compare with similar logic from `/usr/lib/tmpfiles.d/tmp.conf`: ``` R! /tmp/systemd-private-* ``` Closes: https://github.com/ostreedev/ostree/issues/393 Closes: #1090 Approved by: jlebon
* boot: Ensure we remount /var writable before systemd does journal flushColin Walters2016-09-151-1/+1
| | | | | | | | Otherwise, we may not get a persistent journal for the first boot. https://bugzilla.redhat.com/show_bug.cgi?id=1265295 Closes: #511 Approved by: jlebon
* Move ostree-* executables to /usr/lib/ostreeGatis Paeglis2016-08-114-6/+6
| | | | | | | | | | | | | | | | | Why not to use libexecdir? Because this directory does not exist on some distros or paths between distros varies. There are several reasons why a well known path is prefered, for example when generating a kernel command line: init=${ostree}/usr/lib/ostree-boot/ostree-prepare-root In addition this saves us some typing in a console when wanting to access the "ostree" cmd line. Closes: #449 Approved by: cgwalters
* Introducing ostree-grub-generatorGatis Paeglis2016-04-042-0/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ostree-grub-generator can be used to customize the generated grub.cfg file. Compile time decision ostree-grub-generator vs grub2-mkconfig can be overwritten with the OSTREE_GRUB2_EXEC envvar - useful for auto tests and OS installers. Why this alternative approach: 1) The current approach is less flexible than using a custom 'ostree-grub-generator' script. Each system can adjust this script for its needs, instead of using the hardcoded values from ostree-bootloader-grub2.c. 2) Too much overhead on embedded to generate grub.cfg via /etc/grub.d/ configuration files. It is still possible to do so, even with this patch applied. No need to install grub2 package on a target device. 3) The grub2-mkconfig code path has other issues: https://bugzilla.gnome.org/show_bug.cgi?id=761180 Task: https://bugzilla.gnome.org/show_bug.cgi?id=762220 Closes: #228 Approved by: cgwalters
* syntax-check: Remove empty lines at the end of fileGiuseppe Scrivano2015-02-021-1/+0
| | | | Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* libostree: Add initial GRUB2 supportColin Walters2014-10-161-0/+47
| | | | | | | | | | | | | | | | | | | | In this approach, we drop a /etc/grub.d/15_ostree file which is a hybrid of shell/C that picks up bits from the GRUB2 library (e.g. the block device script generation), and then calls into libostree's GRUB2 code which knows about the BLS entries. This is admittedly ugly. There exists another approach for GRUB2 to learn the BLS specification. However, the spec has a few issues: https://www.redhat.com/archives/anaconda-devel-list/2014-July/msg00002.html This approach also gives a bit more control to the admin via the naming of the 15_ostree symlink; they can easily disable it: Or reorder the ostree entries ahead of 10_linux: Also, this approach doesn't require patches for grub2, which is an issue with the pressure to backport (rpm-)OSTree to EL7.
* boot/ostree-remount.service: run before tmpfiles.dDaniel Drake2014-02-111-0/+2
| | | | | | | | | | | tmpfiles.d configurations generally require write access to some places that are read-only until ostree-remount runs. Make sure ostree-remount has run first. Thanks to Cosimo Cecchi for finding and diagnosing this problem. https://bugzilla.gnome.org/show_bug.cgi?id=724183
* ostree-prepare-root.service: Also order before plymouth-switch-root.serviceColin Walters2014-01-271-0/+1
| | | | | In the OSTree model, /sysroot gets set up twice. We need to ensure that the /sysroot plymouth sees is only after OSTree has set it up.
* boot/ostree-remount.service: Run before plymouth-read-write.serviceColin Walters2014-01-271-1/+3
| | | | | The plymouth service needs a writable /var, so ensure that we run before it does.
* ostree-remount.service: Run before systemd-random-seed.serviceColin Walters2013-11-221-1/+1
| | | | | It's essential that we've mounted /var read-write in order for random-seed.service to work.
* Add support for mkinitcpioDaniel Narvaez2013-10-246-0/+138
https://bugzilla.gnome.org/show_bug.cgi?id=710682