summaryrefslogtreecommitdiff
path: root/src/switchroot/ostree-mount-util.h
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: Run clang-formatColin Walters2023-05-021-8/+8
| | | | | This is a one-time tree wide reformatting to ensure consistency going forward.
* Update FSF license notices to use URL instead of addressJoseph Marrero2021-12-071-3/+1
|
* Move ro /sysroot bind mount of /etc into initramfsColin Walters2020-05-241-1/+3
| | | | | | | | | | | | | | | | | | | | | | | We recently disabled the read-only /sysroot handling: https://github.com/ostreedev/ostree/pull/2108/commits/e35b82fb891daee823fcce421ae8f1442b630ea2 The core problem was that a lot of services run early in the real root and want write access to things like `/var` and `/etc`. In trying to do remounts while the system is running we introduce too many race conditions. Instead, just make the `/etc` bind mount in the initramfs right after we set up the main root. This is much more natural really, and avoids all race conditions since nothing is running in the sysroot yet. The main awkward part is that since we're not linking `ostree-prepare-root` to GLib (yet) we have a hacky parser for the config file. But, this is going to be fine I think. In order to avoid parsing the config twice, pass state from `ostree-prepare-root` to `ostree-remount` via a file in `/run`.
* switchroot: Allow letting ostree-prepare-root mount /varJonathan Lebon2018-06-071-0/+2
| | | | | | | | | | | In some scenarios, it might make sense to let `ostree-prepare-root` do the `/var` mount from the state root as before. For example, one may want to do some system configuration before the switch root. This of course comes at the expense of supporting `/var` as a mount point in `/etc/fstab`. Closes: #1617 Approved by: cgwalters
* switchroot: Ensure /run/ostree-booted is created even without initramfsColin Walters2018-03-221-0/+15
| | | | | | | | | | | | | | | See https://mail.gnome.org/archives/ostree-list/2018-March/msg00012.html If ostree-prepare-root is run as pid 1 (i.e we're not using an initramfs), then anything we write outside the target sysroot (such as `/run/ostree-booted`) will be lost. Since `ostree-remount.service` runs fairly early in boot, and is triggered via `ConditionKernelCommandLine=ostree`, we can just touch the file there in addition. Closes: #1508 Approved by: akiernan
* 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
* tree-wide: Remove Emacs modelinesColin Walters2017-09-211-2/+1
| | | | | | | | | We added a `.dir-locals.el` in commit: 9a77017d87b74c5e2895cdd64ad098018929403f There's no need to have it per-file, with that people might think to add other editors, which is the wrong direction. Closes: #1206 Approved by: jlebon
* Switch to using a systemd generator for /varColin Walters2017-05-161-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If one wants to set up a mount for `/var` in `/etc/fstab`, it won't be mounted since `ostree-prepare-root` set up a bind mount for `/var` to `/sysroot/ostree/$stateroot/var`, and systemd will take the already extant mount over what's in `/etc/fstab`. There are a few options to fix this, but what I settled on is parsing `/etc/fstab` in a generator (exactly like `systemd-fstab-generator` does), except here we look for an explicit mount for `/var`, and if one *isn't* found, synthesize the default ostree mount to the stateroot. Another nice property is that if an admin creates a `var.mount` unit in `/etc` for example, that will also override our mount. Note that today ostree doesn't hard depend on systemd, so this behavior only kicks in if we're built with systemd *and* libmount support (for parsing `/etc/fstab`). I didn't really test that case though. Initially I started writing this as a "pure libc" program, but at one point decided to use `libostree.so` to find the booted deployment. That didn't work out because `/boot` wasn't necessarily mounted and hence we couldn't find the bootloader config. A leftover artifact from this is that the generator code calls into libostree via the "cmd private" infrastructure. But it's an easy way to share code, and doesn't hurt. Closes: #859 Approved by: jlebon
* switchroot: Move `path_is_on_readonly_fs` to header fileWilliam Manley2016-08-301-2/+18
| | | | | | | | | | This simplifies the build system by removing the need for `libswitchroot-mountutil.la`. Original idea by @cgwalters in #477. Closes: #478 Approved by: cgwalters
* switchroot: Replace custom error printing with err/warn functions from libcWilliam Manley2016-08-301-2/+0
| | | | | | | | | | | | | | | | The `warn()` libc extension has exactly the same behaviour as our own `perrorv` function, but is available in (at least) glibc and musl. As an added bonus the similar function `err()` which will exit with an error code afterwards. This implementation is tidier and allows us to get rid of our own `perrorv`. It paves the way to removing `ostree-mount-util.c` to simplify the build scripts. Original idea by @cgwalters in #477. Closes: #478 Approved by: cgwalters
* admin: Add an `unlock` command, and libostree APIColin Walters2016-03-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm trying to improve the developer experience on OSTree-managed systems, and I had an epiphany the other day - there's no reason we have to be absolutely against mutating the current rootfs live. The key should be making it easy to rollback/reset to a known good state. I see this command as useful for two related but distinct workflows: - `ostree admin unlock` will assume you're doing "development". The semantics hare are that we mount an overlayfs on `/usr`, but the overlay data is in `/var/tmp`, and is thus discarded on reboot. - `ostree admin unlock --hotfix` first clones your current deployment, then creates an overlayfs over `/usr` persistent to this deployment. Persistent in that now the initramfs switchroot tool knows how to mount it as well. In this model, if you want to discard the hotfix, at the moment you roll back/reboot into the clone. Note originally, I tried using `rofiles-fuse` over `/usr` for this, but then everything immediately explodes because the default (at least CentOS 7) SELinux policy denies tons of things (including `sshd_t` access to `fusefs_t`). Sigh. So the switch to `overlayfs` came after experimentation. It still seems to have some issues...specifically `unix_chkpwd` is broken, possibly because it's setuid? Basically I can't ssh in anymore. But I *can* `rpm -Uvh strace.rpm` which is handy. NOTE: I haven't tested the hotfix path fully yet, specifically the initramfs bits.
* syntax-check: Remove empty lines at the end of fileGiuseppe Scrivano2015-02-021-1/+0
| | | | Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
* Switch to #pragma once for headersColin Walters2013-07-091-3/+1
| | | | It's just less tedious, and we're GCC/LLVM specific anyways.
* dracut: Add ostree-remountColin Walters2013-06-041-0/+27
Linux creates a copy of the soure mount flags when creating a bind mount; if the source is read-only, then the bind mount is. The problem is that systemd will remount the rootfs read/write, but each mount (/home, /var etc.) will still be read-only. We need to remount every bind mount except for /usr to read-write too. This only "worked" with the old ostree-switch-root because it effectively force mounted the rootfs read-write always, ignoring the "ro" flag.