Comment 18 for bug 1778946

Douglas Kosovic (dkosovic) wrote :

I wasn't able to redirect the stderr from the following line in /etc/ppp/ip-up.d/0000usepeerdns (probably because of something pppd is doing) :

cp -a "$REALRESOLVCONF" "$REALRESOLVCONF.pppd-backup.$PPP_IFACE"

So I modified the cp.c source from the coreutils package and redirected stderr to a file.

The error message I now see is :

cp: failed to preserve ownership for '/run/systemd/resolve/stub-resolv.conf.pppd-backup.ppp0': Operation not permitted

cp.c is using the lchown() function which is failing with that message.

Looks like only preserving ownership is failing as I tried the following and it works:

cp --preserve=mode,timestamps "$REALRESOLVCONF" "$REALRESOLVCONF.pppd-backup.$PPP_IFACE"

The way /run is mounted might be the reason why 'cp -a' and lchown() is failing.

Ignore what I said able $? being 0 after the cp -a line. Doing the following line confirms $? is 1 :

cp -a "$REALRESOLVCONF" "$REALRESOLVCONF.pppd-backup.$PPP_IFACE" || echo ERROR $? >> /tmp/usepeerdns-up.log