Based on: * https://github.com/systemd/systemd/pull/13881 * https://www.redhat.com/archives/linux-lvm/2020-April/msg00003.html * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f36776fafbaa0094390dd4e7e3e29805e0b82730 --- a/src/udev/udevadm-trigger.c 2020-03-06 13:38:52.000000000 +0100 +++ b/src/udev/udevadm-trigger.c 2020-04-18 19:25:51.179705429 +0200 @@ -10,6 +10,7 @@ #include "device-private.h" #include "fd-util.h" #include "fileio.h" +#include "id128-util.h" #include "path-util.h" #include "process-util.h" #include "set.h" @@ -27,6 +28,15 @@ sd_device *d; int r, ret = 0; + sd_id128_t id; + char uuid[ID128_UUID_STRING_MAX]; + r = sd_id128_randomize(&id); + if (r < 0) { + log_debug_errno(r, "Failed to generate random UUID: %m"); + return r; + } + id128_to_uuid_string(id, uuid); + FOREACH_DEVICE_AND_SUBSYSTEM(e, d) { _cleanup_free_ char *filename = NULL; const char *syspath; @@ -43,7 +53,11 @@ if (!filename) return log_oom(); - r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER); + _cleanup_free_ char *full_action = NULL; + full_action = strjoin(action, " ", uuid, " SOURCE=UDEVTRIGGER"); + if (!full_action) + return log_oom(); + r = write_string_file(filename, full_action, WRITE_STRING_FILE_DISABLE_BUFFER); if (r < 0) { bool ignore = IN_SET(r, -ENOENT, -EACCES, -ENODEV, -EROFS);