Skip to content

use /etc/clonetab to provide devices to be cloned#1

Open
src-up wants to merge 2855 commits into
mainfrom
PR-etc-clonetab
Open

use /etc/clonetab to provide devices to be cloned#1
src-up wants to merge 2855 commits into
mainfrom
PR-etc-clonetab

Conversation

@src-up

@src-up src-up commented Dec 10, 2025

Copy link
Copy Markdown
Owner

No description provided.

src-up pushed a commit that referenced this pull request Jan 21, 2026
Otherwise, if the VM is unexpectedly rebooted, then `importctl --user pull-tar`
may fail as the file may already exist.
```
[  123.351751] TEST-13-NSPAWN.sh[3946]: + run0 -u testuser importctl --user pull-tar file:///var/tmp/image-tar/kurps.tar.gz nurps --verify=checksum -m
[  123.541603] TEST-13-NSPAWN.sh[4311]: Enqueued transfer job 3. Press C-c to continue download in background.
[  123.552456] TEST-13-NSPAWN.sh[4311]: Pulling 'file:///var/tmp/image-tar/kurps.tar.gz', saving as 'nurps'.
[  123.552788] TEST-13-NSPAWN.sh[4311]: Operating on image directory '/home/testuser/.local/state/machines'.
[  123.819942] TEST-13-NSPAWN.sh[4311]: Got 1% of file:///var/tmp/image-tar/kurps.tar.gz.
[  124.156557] TEST-13-NSPAWN.sh[4311]: * shutting down connection #0
[  124.156896] TEST-13-NSPAWN.sh[4311]: * Could not open file /var/tmp/image-tar/kurps.tar.gz.sha256
[  124.157223] TEST-13-NSPAWN.sh[4311]: * closing connection #-1
[  124.159198] TEST-13-NSPAWN.sh[4311]: * Could not open file /var/tmp/image-tar/kurps.nspawn
[  124.159493] TEST-13-NSPAWN.sh[4311]: * closing connection #-1
[  124.159818] TEST-13-NSPAWN.sh[4311]: Acquired 68.5M.
[  124.160395] TEST-13-NSPAWN.sh[4311]: Download of file:///var/tmp/image-tar/kurps.tar.gz complete.
[  124.160664] TEST-13-NSPAWN.sh[4311]: Transfer failed: Could not read a file:// file
[  124.160923] TEST-13-NSPAWN.sh[4311]: Settings file could not be retrieved, proceeding without.
[  124.404733] TEST-13-NSPAWN.sh[4311]: * shutting down connection #1
[  124.405162] TEST-13-NSPAWN.sh[4311]: Acquired 79B.
[  124.406170] TEST-13-NSPAWN.sh[4311]: Download of file:///var/tmp/image-tar/SHA256SUMS complete.
[  124.406734] TEST-13-NSPAWN.sh[4311]: SHA256 checksum of file:///var/tmp/image-tar/kurps.tar.gz is valid.
[  124.455446] TEST-13-NSPAWN.sh[4311]: Failed to rename to final image name to /home/testuser/.local/state/machines/.tar-file:\x2f\x2f\x2fvar\x2ftmp\x2fimage-tar\x2fkurps\x2etar\x2egz: File exists
[  124.457251] TEST-13-NSPAWN.sh[4311]: Exiting.
```
Workaround for issue systemd#38240.
@src-up src-up force-pushed the PR-etc-clonetab branch 3 times, most recently from aff7c48 to 63e0b1d Compare February 16, 2026 17:43
@src-up src-up force-pushed the PR-etc-clonetab branch 3 times, most recently from c35a30a to bccc71a Compare February 25, 2026 19:20
@src-up src-up force-pushed the PR-etc-clonetab branch from bccc71a to 9ed6968 Compare April 9, 2026 20:24
src-up pushed a commit that referenced this pull request Apr 9, 2026
Fix a typo which causes a segfault when processing a user record
with matchHostname when it's an array instead of a simple string:

$ echo '{"userName":"crashhostarray","perMachine":[{"matchHostname":["host1","host2"],"locked":false}]}' | userdbctl -F -
Segmentation fault         (core dumped)

$ coredumpctl info
...
       Message: Process 1172301 (userdbctl) of user 1000 dumped core.

                Module libz.so.1 from rpm zlib-ng-2.3.3-1.fc43.x86_64
                Module libcrypto.so.3 from rpm openssl-3.5.4-2.fc43.x86_64
                Stack trace of thread 1172301:
                #0  0x00007fded7b3a656 __strcmp_evex (libc.so.6 + 0x159656)
                #1  0x00007fded7e95397 per_machine_hostname_match (libsystemd-shared-260.so + 0x295397)
                systemd#2  0x00007fded7e955b5 per_machine_match (libsystemd-shared-260.so + 0x2955b5)
                systemd#3  0x00007fded7e957c6 dispatch_per_machine (libsystemd-shared-260.so + 0x2957c6)
                systemd#4  0x00007fded7e96c97 user_record_load (libsystemd-shared-260.so + 0x296c97)
                systemd#5  0x000000000040572d display_user (/home/fsumsal/repos/@systemd/systemd/build/userdbctl + 0x572d)
                systemd#6  0x00007fded7ea9727 dispatch_verb (libsystemd-shared-260.so + 0x2a9727)
                systemd#7  0x000000000041077c run (/home/fsumsal/repos/@systemd/systemd/build/userdbctl + 0x1077c)
                systemd#8  0x00000000004107ce main (/home/fsumsal/repos/@systemd/systemd/build/userdbctl + 0x107ce)
                systemd#9  0x00007fded79e45b5 __libc_start_call_main (libc.so.6 + 0x35b5)
                systemd#10 0x00007fded79e4668 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x3668)
                systemd#11 0x00000000004038d5 _start (/home/fsumsal/repos/@systemd/systemd/build/userdbctl + 0x38d5)
                ELF object binary architecture: AMD x86-64
src-up pushed a commit that referenced this pull request Apr 9, 2026
The fido2_hmac_salt/fido2_hmac_credential/recovery_key fields kept
leaking memory as the array itself wasn't deallocated after deallocating
each of its elements data:

$ build-san/userdbctl -F fuzz-corpus-userdb/auth-fido2.json
...
=================================================================
==1292840==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x7f56f00e5e4b in realloc.part.0 (/lib64/libasan.so.8+0xe5e4b) (BuildId: 25975f766867e9e604dc5a71a8befeaed3301942)
    #1 0x7f56ed869e42 in greedy_realloc ../src/basic/alloc-util.c:65
    systemd#2 0x7f56ed7ff5e9 in dispatch_fido2_hmac_salt ../src/shared/user-record.c:836
    systemd#3 0x7f56edd73cbc in sd_json_dispatch_full ../src/libsystemd/sd-json/sd-json.c:5204
    systemd#4 0x7f56edd745fc in sd_json_dispatch ../src/libsystemd/sd-json/sd-json.c:5276
    systemd#5 0x7f56ed80100b in dispatch_privileged ../src/shared/user-record.c:998
    systemd#6 0x7f56edd73cbc in sd_json_dispatch_full ../src/libsystemd/sd-json/sd-json.c:5204
    systemd#7 0x7f56edd745fc in sd_json_dispatch ../src/libsystemd/sd-json/sd-json.c:5276
    systemd#8 0x7f56ed80622c in user_record_load ../src/shared/user-record.c:1697
    systemd#9 0x000000408c15 in display_user ../src/userdb/userdbctl.c:447
    systemd#10 0x7f56ed83cc9a in dispatch_verb ../src/shared/verbs.c:137
    systemd#11 0x00000041df2b in run ../src/userdb/userdbctl.c:1908
    systemd#12 0x00000041dfbe in main ../src/userdb/userdbctl.c:1911
    systemd#13 0x7f56ec8105b4 in __libc_start_call_main (/lib64/libc.so.6+0x35b4) (BuildId: 2b5beec0fd24fe9c9f43eddfdd5facf0b8a1b805)
    systemd#14 0x7f56ec810667 in __libc_start_main@@GLIBC_2.34 (/lib64/libc.so.6+0x3667) (BuildId: 2b5beec0fd24fe9c9f43eddfdd5facf0b8a1b805)
    systemd#15 0x000000404a44 in _start (/home/fsumsal/repos/@systemd/systemd/build-san/userdbctl+0x404a44) (BuildId: 19e8b7e7b7038d2cea20bc18a55bea2a9e4406d5)

Direct leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f56f00e5e4b in realloc.part.0 (/lib64/libasan.so.8+0xe5e4b) (BuildId: 25975f766867e9e604dc5a71a8befeaed3301942)
    #1 0x7f56ed869e42 in greedy_realloc ../src/basic/alloc-util.c:65
    systemd#2 0x7f56ed7fe779 in dispatch_fido2_hmac_credential_array ../src/shared/user-record.c:775
    systemd#3 0x7f56edd73cbc in sd_json_dispatch_full ../src/libsystemd/sd-json/sd-json.c:5204
    systemd#4 0x7f56edd745fc in sd_json_dispatch ../src/libsystemd/sd-json/sd-json.c:5276
    systemd#5 0x7f56ed80622c in user_record_load ../src/shared/user-record.c:1697
    systemd#6 0x000000408c15 in display_user ../src/userdb/userdbctl.c:447
    systemd#7 0x7f56ed83cc9a in dispatch_verb ../src/shared/verbs.c:137
    systemd#8 0x00000041df2b in run ../src/userdb/userdbctl.c:1908
    systemd#9 0x00000041dfbe in main ../src/userdb/userdbctl.c:1911
    systemd#10 0x7f56ec8105b4 in __libc_start_call_main (/lib64/libc.so.6+0x35b4) (BuildId: 2b5beec0fd24fe9c9f43eddfdd5facf0b8a1b805)
    systemd#11 0x7f56ec810667 in __libc_start_main@@GLIBC_2.34 (/lib64/libc.so.6+0x3667) (BuildId: 2b5beec0fd24fe9c9f43eddfdd5facf0b8a1b805)
    systemd#12 0x000000404a44 in _start (/home/fsumsal/repos/@systemd/systemd/build-san/userdbctl+0x404a44) (BuildId: 19e8b7e7b7038d2cea20bc18a55bea2a9e4406d5)

SUMMARY: AddressSanitizer: 176 byte(s) leaked in 2 allocation(s).
src-up pushed a commit that referenced this pull request Apr 9, 2026
…d#40979)

Fix a typo which causes a segfault when processing a user record
with `matchHostname` when it's an array instead of a simple string:

```
$ echo '{"userName":"crashhostarray","perMachine":[{"matchHostname":["host1","host2"],"locked":false}]}' | userdbctl -F -
Segmentation fault         (core dumped)

$ coredumpctl info
...
       Message: Process 1172301 (userdbctl) of user 1000 dumped core.

                Module libz.so.1 from rpm zlib-ng-2.3.3-1.fc43.x86_64
                Module libcrypto.so.3 from rpm openssl-3.5.4-2.fc43.x86_64
                Stack trace of thread 1172301:
                #0  0x00007fded7b3a656 __strcmp_evex (libc.so.6 + 0x159656)
                #1  0x00007fded7e95397 per_machine_hostname_match (libsystemd-shared-260.so + 0x295397)
                systemd#2  0x00007fded7e955b5 per_machine_match (libsystemd-shared-260.so + 0x2955b5)
                systemd#3  0x00007fded7e957c6 dispatch_per_machine (libsystemd-shared-260.so + 0x2957c6)
                systemd#4  0x00007fded7e96c97 user_record_load (libsystemd-shared-260.so + 0x296c97)
                systemd#5  0x000000000040572d display_user (/home/fsumsal/repos/@systemd/systemd/build/userdbctl + 0x572d)
                systemd#6  0x00007fded7ea9727 dispatch_verb (libsystemd-shared-260.so + 0x2a9727)
                systemd#7  0x000000000041077c run (/home/fsumsal/repos/@systemd/systemd/build/userdbctl + 0x1077c)
                systemd#8  0x00000000004107ce main (/home/fsumsal/repos/@systemd/systemd/build/userdbctl + 0x107ce)
                systemd#9  0x00007fded79e45b5 __libc_start_call_main (libc.so.6 + 0x35b5)
                systemd#10 0x00007fded79e4668 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x3668)
                systemd#11 0x00000000004038d5 _start (/home/fsumsal/repos/@systemd/systemd/build/userdbctl + 0x38d5)
                ELF object binary architecture: AMD x86-64
```
@src-up src-up force-pushed the PR-etc-clonetab branch from 9ed6968 to 2edea5d Compare April 9, 2026 20:35
src-up pushed a commit that referenced this pull request Apr 27, 2026
There are only a few target dirs we place resources in when generating
on-the-fly initrd cpios. These dirs have very specific attributes.
Instead of repeating this everywhere, let's encapsulate them in a new
explicit structure, that we can reuse at various places.

This is preparation for placing extra resources of Type #1 entry also in
them without having to encode access modes at multiple places
redundantly.
@src-up src-up force-pushed the PR-etc-clonetab branch from 81c6ce9 to 0ded5c0 Compare May 22, 2026 21:20
RaitoBezarius and others added 14 commits May 30, 2026 00:20
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
- This synchronize the state for existing stuff.
- Enable translations for Plymouth interaction strings.
- Translate them in French as an example.

Fixes systemd#42384.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/
Translation: systemd/main
Map the Power Boost key (top-right corner, scancode 0x64) to KEY_PROG1.
Map the Touchpad Toggle key (Fn+F8, scancode 0x76) to KEY_F21.

Verified working via evtest:

Event: type 4 (EV_MSC), code 4 (MSC_SCAN), value 64
Event: type 1 (EV_KEY), code 148 (KEY_PROG1), value 1

Event: type 4 (EV_MSC), code 4 (MSC_SCAN), value 76
Event: type 1 (EV_KEY), code 206 (KEY_F21), value 1

DMI: svnInfinix:*pnY3Max:*
AT keyboard scancodes: 0x64, 0x76 (set 2)
4a1f92c added '!' through confusion:
the goal was probably to exclude those directories from cleanup at
runtime. But as discussed below, that exclusion is not needed. In fact,
we want the rule to be active during runtime, so that if the directory
were removed or wasn't created earlier for whatever reason, it'd be
created during one of those later runs too. This just makes the system
more robust.

Those directories are used for sockets, and tmpfiles will not remove
live sockets. So it is fine to run the cleanup on those directories,
it doesn't have any effect in normal circumstances. The only case where
the cleanup would matter would be if the service was running, crashed
without removing the socket, and the system would remain up for more
than 10 days after that. This is not a particularly likely scenario, but
OTOH, we can imaging that somebody tried to run Xorg, it didn't work,
and they switched to Wayland. Or their DE crashes every once in a while,
leaving some state behind. Keeping the cleanup in place seems OK, it
makes the system slightly more robust in fringe scenarios.

In fact, this cleanup will work better if we reduce the delay from
10 days to something small. systemd-tmpfiles-clean.timer runs once
per day, so the cleanup will not be very fast anyway. So use '1h' as
an arbitrary small value. (I think '0' would be risky, because it's
possible for the socket to be set up through a script where it's
created first and the service is connected to it, so it is momentarily
"not live". I think people used to do this. Not sure if that happens
anymore, but let's be safe.)

Co-authored-by: Jarl Gullberg <jarl.gullberg@visar-systems.com>
We need a removal rule for systems where /tmp is not on tmpfs,
so that if they crash, stale sockets will be removed during boot.
OTOH, at runtime, those lock files must never be removed.
But since the 'r!' rule uses '!', it only applies during boot. With
the rule inactive, the usual time-based cleanup for /tmp/ was also
applied to those files, causing them to be removed after 10 days.

Fixes systemd#35182.
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Américo Monteiro <a_monteiro@gmx.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/pt/
Translation: systemd/main
Currently translated at 97.1% (277 of 285 strings)

Co-authored-by: Yuri Chornoivan <yurchor@ukr.net>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/uk/
Translation: systemd/main
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: 김인수 <simmon@nplob.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ko/
Translation: systemd/main
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Marek Adamski <maradam@users.noreply.translate.fedoraproject.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/pl/
Translation: systemd/main
Currently translated at 99.2% (283 of 285 strings)

Co-authored-by: Ettore Atalan <atalanttore@googlemail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/de/
Translation: systemd/main
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Luna Jernberg <droidbittin@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/sv/
Translation: systemd/main
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Anders Jonsson <anders.jonsson@norsjovallen.se>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/sv/
Translation: systemd/main
meskobalazs and others added 14 commits June 8, 2026 03:53
Currently translated at 92.6% (264 of 285 strings)

Co-authored-by: Balázs Meskó <meskobalazs@mailbox.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/hu/
Translation: systemd/main
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Martin Srebotnjak <miles@filmsi.net>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/sl/
Translation: systemd/main
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Weblate Translation Memory <noreply-mt-weblate-translation-memory@weblate.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/sl/
Translation: systemd/main
Currently translated at 32.6% (93 of 285 strings)

po: Translated using Weblate (Interlingua)

Currently translated at 0.3% (1 of 285 strings)

po: Translated using Weblate (Estonian)

Currently translated at 84.5% (241 of 285 strings)

po: Translated using Weblate (Slovenian)

Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Anonymous <noreply@weblate.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/et/
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ia/
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/pa/
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/sl/
Translation: systemd/main
Currently translated at 84.5% (241 of 285 strings)

Co-authored-by: Henri Aunin <contact+fedora@hen.ee>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/et/
Translation: systemd/main
Currently translated at 84.5% (241 of 285 strings)

Co-authored-by: Priit Jõerüüt <jrtkbfdr@users.noreply.translate.fedoraproject.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/et/
Translation: systemd/main
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Kristjan Schmidt <kristjan.schmidt@googlemail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/eo/
Translation: systemd/main
Currently translated at 0.3% (1 of 285 strings)

Co-authored-by: Emilio Sepulveda <emism.translations@gmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/ia/
Translation: systemd/main
Currently translated at 32.6% (93 of 285 strings)

Co-authored-by: A S Alam <aalam@users.noreply.translate.fedoraproject.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/pa/
Translation: systemd/main
These also need to set exit_status so that sd-executor returns the right
thing to pid1.
The message is stale (this is about UserNamespacePath=, not PrivateUsers=) and
this should be an error, not notice given we are going to fail.
…temd#42512)

These also need to set exit_status so that sd-executor returns the right
thing to pid1.
The UEFI specification only defines A/C/I/M/Zicsr/Zifencei as mandatory
extensions in boot services. However, on systems with everything built
with F/D support, its difficult to disable F/D without changing a
toolchain. In addition, both EDK2 and U-Boot enable F/D on boot,
although they neither enable nor disable V. EDK2 comments even claim the
enablement of FPU is "to be compliant with UEFI spec" despite the spec
requires dynamic detection before using F/D.

Add corresponding -march flags to prevent systemd-boot from using other
extensions on RISC-V, and a comment for the temporary enablement of F/D.

Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
@src-up src-up force-pushed the PR-etc-clonetab branch 2 times, most recently from 1021036 to 2c5e8c9 Compare June 8, 2026 17:49
@src-up src-up force-pushed the PR-etc-clonetab branch 2 times, most recently from 68dc4a4 to 52ef5aa Compare June 8, 2026 20:22
Kakueeen and others added 5 commits June 9, 2026 09:19
The Cloudflare DNS-over-TLS service should use 'one.one.one.one'
as the TLS hostname, not 'cloudflare-dns.com' (which is only
correct for DNS-over-HTTPS).

This matches Cloudflare's official documentation:
https://developers.cloudflare.com/1.1.1.1/encryption/dns-over-tls/

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>

Fixes systemd#42287

Signed-off-by: Liu Zhangjian <liuzhangjian@uniontech.com>
Only .dtbauto and .efifw may appear more than once, .hwids is a
singleton per the UKI specification and the stub reads a single .hwids
section (per profile), matching hardware IDs against entries within it.

Co-developed-by: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Paul Meyer <katexochen0@gmail.com>
Currently translated at 37.8% (108 of 285 strings)

Co-authored-by: ButterflyOfFire <butterflyoffire@users.noreply.translate.fedoraproject.org>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/kab/
Translation: systemd/main
Currently translated at 100.0% (285 of 285 strings)

Co-authored-by: Léane GRASSER <leane.grasser@proton.me>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/fr/
Translation: systemd/main
@src-up src-up force-pushed the PR-etc-clonetab branch 2 times, most recently from ba6ab28 to 0d0dc52 Compare June 10, 2026 06:20
@src-up src-up force-pushed the PR-etc-clonetab branch from 0d0dc52 to 879ff07 Compare June 10, 2026 17:59
Adds dm-clone device setup at boot via a new /etc/clonetab config file,
following the crypttab/veritytab pattern.

- Add systemd-clonesetup-generator to parse /etc/clonetab and generate units.
- Add systemd-clonesetup binary to create/remove dm-clone devices via ioctl.
- Add clonesetup.target for ordering dm-clone activation at boot.
- Add region_size= option in clonetab to configure dm-clone hydration granularity.
- Add clonetab(5) and systemd-clonesetup-generator(8) man pages.

Fixes: systemd#39500
@src-up src-up force-pushed the PR-etc-clonetab branch from 879ff07 to d000784 Compare June 10, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.