Commit Graph

29 Commits

Author SHA1 Message Date
Yu Watanabe db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Lennart Poettering 2bc181dae7 gpt: add new GPT partition types of /usr partitions 2020-09-19 21:19:23 +02:00
Lennart Poettering aa088f62d1 gpt: move GPT_LINUX_GENERIC definition next to the user GPT partition types
No code changes, just some reordering.
2020-09-16 16:31:16 +02:00
Anita Zhang 1b9d61bcee
Merge pull request #14696 from poettering/dissect-tweaks
various tweaks to the image dissection logic
2020-01-30 12:46:03 -08:00
Lennart Poettering 0f7c9a3d81 dissect: complain if partition flags are set that we don't know 2020-01-29 19:29:39 +01:00
Lennart Poettering 70a5db5822 home: add new systemd-homed service that can manage LUKS homes
Fixes more or less: https://bugs.freedesktop.org/show_bug.cgi?id=67474
2020-01-28 22:36:07 +01:00
Zbigniew Jędrzejewski-Szmek dc972b0740 systemd-id128: add new verb to print GPT partitions UUIDs 2020-01-23 23:32:13 +01:00
Zbigniew Jędrzejewski-Szmek 19ce38ce62 shared/gpt: export gpt_partition_type_uuid_{to,from}_string functions 2020-01-23 22:56:23 +01:00
Lennart Poettering d4dffb8533 dissect: introduce new recognizable partition types for /var and /var/tmp
This has been requested many times before. Let's add it finally.

GPT auto-discovery for /var is a bit more complex than for other
partition types: the other partitions can to some degree be shared
between multiple OS installations on the same disk (think: swap, /home,
/srv). However, /var is inherently something bound to an installation,
i.e. specific to its identity, or actually *is* its identity, and hence
something that cannot be shared.

To deal with this this new code is particularly careful when it comes to
/var: it will not mount things blindly, but insist that the UUID of the
partition matches a hashed version of the machine-id of the
installation, so that each installation has a very specific /var
associated with it, and would never use any other. (We actually use
HMAC-SHA256 on the GPT partition type for /var, keyed by the machine-id,
since machine-id is something we want to keep somewhat private).

Setting the right UUID for installations takes extra care. To make
things a bit simpler to set up, we avoid this safety check for nspawn
and RootImage= in unit files, under the assumption that such container
and service images unlikely will have multiple installations on them.
The check is hence only required when booting full machines, i.e. in
in systemd-gpt-auto-generator.

To help with putting together images for full machines, PR #14368
introduces a repartition tool that can automatically fill in correctly
calculated UUIDs on first boot if images have the var partition UUID
initialized to all zeroes. With that in place systems can be put
together in a way that on first boot the machine ID is determined and
the partition table automatically adjusted to have the /var partition
with the right UUID.
2019-12-23 14:43:59 +01:00
Lennart Poettering 7b5de29569 gpt: add definition for boot loader spec partition
As listed in the boot loader spec since a long time:

https://systemd.io/BOOT_LOADER_SPECIFICATION#technical-details
2019-03-01 12:41:32 +01:00
Lennart Poettering 0c69794138 tree-wide: remove Lennart's copyright lines
These lines are generally out-of-date, incomplete and unnecessary. With
SPDX and git repository much more accurate and fine grained information
about licensing and authorship is available, hence let's drop the
per-file copyright notice. Of course, removing copyright lines of others
is problematic, hence this commit only removes my own lines and leaves
all others untouched. It might be nicer if sooner or later those could
go away too, making git the only and accurate source of authorship
information.
2018-06-14 10:20:20 +02:00
Lennart Poettering 818bf54632 tree-wide: drop 'This file is part of systemd' blurb
This part of the copyright blurb stems from the GPL use recommendations:

https://www.gnu.org/licenses/gpl-howto.en.html

The concept appears to originate in times where version control was per
file, instead of per tree, and was a way to glue the files together.
Ultimately, we nowadays don't live in that world anymore, and this
information is entirely useless anyway, as people are very welcome to
copy these files into any projects they like, and they shouldn't have to
change bits that are part of our copyright header for that.

hence, let's just get rid of this old cruft, and shorten our codebase a
bit.
2018-06-14 10:20:20 +02:00
Lennart Poettering 56b00d0028 tree-wide: remove some double newlines in headers, too 2018-05-22 16:13:45 +02:00
Zbigniew Jędrzejewski-Szmek 11a1589223 tree-wide: drop license boilerplate
Files which are installed as-is (any .service and other unit files, .conf
files, .policy files, etc), are left as is. My assumption is that SPDX
identifiers are not yet that well known, so it's better to retain the
extended header to avoid any doubt.

I also kept any copyright lines. We can probably remove them, but it'd nice to
obtain explicit acks from all involved authors before doing that.
2018-04-06 18:58:55 +02:00
Zbigniew Jędrzejewski-Szmek 53e1b68390 Add SPDX license identifiers to source files under the LGPL
This follows what the kernel is doing, c.f.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
2017-11-19 19:08:15 +01:00
Lennart Poettering a48dd3475b dissect: don't honour NOAUTO flags when looking for ESP (#5224)
The flag is originally defined for "basic data partitions", but not for the
ESP. We reuse it for the various partitions defined by the Discoverable
Partitions Spec, but it isn't defined for the ESP, hence don't check for
it. Instead, do check for GPT_FLAG_NO_BLOCK_IO_PROTOCOL, as that flag
actually is defined for all partition types, and recommended to use by
the UEFI spec.

Fixes: #5218
2017-02-07 22:10:48 -05:00
Lennart Poettering 4623e8e6ac nspawn/dissect: automatically discover dm-verity verity partitions
This adds support for discovering and making use of properly tagged dm-verity
data integrity partitions. This extends both systemd-nspawn and systemd-dissect
with a new --root-hash= switch that takes the root hash to use for the root
partition, and is otherwise fully automatic.

Verity partitions are discovered automatically by GPT table type UUIDs, as
listed in
https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/
(which I updated prior to this change, to include new UUIDs for this purpose.

mkosi with https://github.com/systemd/mkosi/pull/39 applied may generate images
that carry the necessary integrity data. With that PR and this commit, the
following simply lines suffice to boot up an integrity-protected container image:

```
 # mkdir test
 # cd test
 # mkosi --verity
 # systemd-nspawn -i ./image.raw -bn
```

Note that mkosi writes the image file to "image.raw" next to a a file
"image.roothash" that contains the root hash. systemd-nspawn will look for that
file and use it if it exists, in case --root-hash= is not specified explicitly.
2016-12-07 18:38:41 +01:00
Lennart Poettering 0ef6f45425 tree-wide: place #pragma once at the same place everywhere
Usually, we place the #pragma once before the copyright blurb in header files,
but in a few cases we didn't. Move those around, so that we do the same thing
everywhere.
2016-02-20 22:42:29 +01:00
Daniel Mack b26fa1a2fb tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file.
2016-02-10 13:41:57 +01:00
Andrew Wilcox f827e09fda Add GPT partition type GUID for Itanium root partition 2016-01-04 06:22:58 -06:00
Zbigniew Jędrzejewski-Szmek c9403dced7 #pragma once here and there 2015-01-23 09:30:44 -05:00
Lennart Poettering f6c51a8136 nspawn: support dissecting GPT images that contain only a single generic linux partition
This should allow running Ubuntu UEFI GPT Images with nspawn,
unmodified.
2015-01-19 20:24:10 +01:00
Lennart Poettering 6017365a1d endian: explicitly include endian.h wherever we want to use __BYTE_ORDER 2014-07-11 16:13:13 +02:00
Lennart Poettering 4f4b92ba7a always check for __BYTE_ORDER == __BIG_ENDIAN when checking for endianess
Let's always stick to glibc's way to determine byte order, and not mix
autoconf-specific checks with gcc checks.
2014-07-11 15:56:16 +02:00
Lennart Poettering a86eae57ff gpt: introduce root partition type GUIDs for ARM 32bit + ARM 64bit 2014-03-14 15:12:48 +01:00
Lennart Poettering cca1dfddd4 gpt-auto-generator: honour read-only and no-auto flag from GPT data
Similar to the read-only and no-automount flags of Microsoft Basic Data
Partitions, introduce our own flags. We map them to the same flag bits
as Microsoft's, to keep things simple.
2014-03-13 01:01:56 +01:00
Lennart Poettering 1b9e5b1263 nspawn: add --image= switch to boot GPT disk images that follow the Discoverable Partitions Specification 2014-03-10 20:35:52 +01:00
Lennart Poettering cbd353ce77 udev-builtin-blkid: when we find a GPT partition marked as root disk on the same disk as the ESP, expose a property on the udev device
This is preparation for a logic to automatically discover the root
partition to boot from if no partition has been configured explicitly.

This makes use of our newly defined GPT type GUIDs for our root disks:

 #define GPT_ROOT_X86    SD_ID128_MAKE(44,47,95,40,f2,97,41,b2,9a,f7,d1,31,d5,f0,45,8a)
 #define GPT_ROOT_X86_64 SD_ID128_MAKE(4f,68,bc,e3,e8,cd,4d,b1,96,e7,fb,ca,f9,84,b7,09)

We define differen GUIDs for different architectures to allow images
which finde the right root partition for the appropriate arch.
2014-03-07 02:40:24 +01:00
Lennart Poettering e48fdd8443 generators: rework mount generators
- Add support for finding and mounting /srv based on GPT data, similar
  to how we already handly /home.

- Share the fsck logic between GPT, EFI and fstab generators

- Make sure we never run the EFI generator inside containers

- Drop DefaultDependencies=no from EFI mount units

- Other fixes
2014-03-06 04:00:41 +01:00