diff --git a/0593-dracut-only-copy-xattr-if-root.patch b/0593-dracut-only-copy-xattr-if-root.patch new file mode 100644 index 0000000..8cca39a --- /dev/null +++ b/0593-dracut-only-copy-xattr-if-root.patch @@ -0,0 +1,33 @@ +From 97b36b154ce40f91b1c73a610c796965a569b637 Mon Sep 17 00:00:00 2001 +From: Daniel Molkentin +Date: Mon, 18 Feb 2019 14:21:05 +0100 +Subject: [PATCH] dracut: only copy xattr, if root + +(Cherry-picked from 076fcd1652af25f57aae063fda3b8c39ef828ac6) +--- + install/dracut-install.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/install/dracut-install.c b/install/dracut-install.c +index a7bfdb8c..381327c2 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -222,8 +222,13 @@ static int cp(const char *src, const char *dst) + if (ret == 0) { + struct timeval tv[2]; + if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0) +- if(fchown(dest_desc, (uid_t) - 1, sb.st_gid) != 0) +- log_error("Failed to chown %s: %m", dst); ++ if(fchown(dest_desc, (uid_t) - 1, sb.st_gid) != 0) { ++ if (geteuid() == 0) ++ log_error("Failed to chown %s: %m", dst); ++ else ++ log_info("Failed to chown %s: %m", dst); ++ } ++ + tv[0].tv_sec = sb.st_atime; + tv[0].tv_usec = 0; + tv[1].tv_sec = sb.st_mtime; +-- +2.16.4 + diff --git a/dracut.changes b/dracut.changes index 4db92c9..e8dcf11 100644 --- a/dracut.changes +++ b/dracut.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Feb 15 17:23:11 UTC 2019 - Daniel Molkentin + +- Avoid "Failed to chown ... Operation not permitted" when run from non-root, + by not copying xattrs. (osc#1092178) + * adds 0593-dracut-only-copy-xattr-if-root.patch + ------------------------------------------------------------------- Tue Feb 12 16:38:21 UTC 2019 - Daniel Molkentin diff --git a/dracut.spec b/dracut.spec index fdc9bb2..d51c9ec 100644 --- a/dracut.spec +++ b/dracut.spec @@ -429,6 +429,8 @@ Patch590: 0590-00systemd-check-if-systemd-version-is-a-number.patch Patch591: 0591-91zipl-Don-t-use-contents-of-commented-lines.patch # Patch submitted to upstream Patch592: 0592-95iscsi-handle-qedi-like-bnx2i.patch +# Patch adopted from upstream commit e7ba1392e180eb6f5e19dfd28a340a98cf09a3cd +Patch593: 0593-dracut-only-copy-xattr-if-root.patch BuildRequires: asciidoc BuildRequires: bash @@ -739,6 +741,7 @@ chmod a+x modules.d/95qeth_rules/module-setup.sh %patch590 -p1 %patch591 -p1 %patch592 -p1 +%patch593 -p1 %build %configure\