Skip to content

keepalived-sync: fix mkdir permission denied in rsync.sh#28608

Open
willjayyyy wants to merge 1 commit intoopenwrt:openwrt-24.10from
willjayyyy:fix/keepalived-sync-mkdir-sudo
Open

keepalived-sync: fix mkdir permission denied in rsync.sh#28608
willjayyyy wants to merge 1 commit intoopenwrt:openwrt-24.10from
willjayyyy:fix/keepalived-sync-mkdir-sudo

Conversation

@willjayyyy
Copy link

Summary

  • Use conditional sudo for mkdir in rsync.sh to match the existing sudo rsync behavior, falling back to plain mkdir when sudo is not available
  • Update the sudoers configuration in the postinst script to permit /bin/mkdir in addition to /usr/bin/rsync

Problem

After the first successful sync, rsync -a (running via sudo rsync) preserves root ownership on synced directories. Subsequent syncs fail at the mkdir step because the keepalived user cannot create subdirectories inside root-owned directories:

mkdir: can't create directory '/usr/share/keepalived/rsync/etc/...': Permission denied

Root Cause

rsync.sh uses --rsync-path="sudo rsync" for the rsync commands (lines 67, 83) but runs mkdir without sudo (line 59). This inconsistency causes mkdir to fail when directories are owned by root.

Test Plan

  • Verify sync works on a fresh keepalived-sync setup
  • Verify sync works after directories become root-owned from previous syncs
  • Verify sync works on systems without sudo installed

Fixes: #28565

@willjayyyy willjayyyy force-pushed the fix/keepalived-sync-mkdir-sudo branch from 8b5ac25 to 0a6fa13 Compare February 20, 2026 13:41
@github-actions github-actions bot added the OpenWrt 24.10 Issue/PR on branch 24.10 label Feb 20, 2026
@feckert
Copy link
Member

feckert commented Feb 20, 2026

Please bump the PKG_RELEASE in the same commit by one.
Also use a correct email address with your real name in your Signed-off-by line
Signed-off-by: willjayyyy <willjayyyy@users.noreply.github.com>

@willjayyyy willjayyyy force-pushed the fix/keepalived-sync-mkdir-sudo branch from 0a6fa13 to 00681eb Compare February 20, 2026 14:32
The rsync.sh script uses sudo for rsync but not for mkdir. After the
first sync, rsync -a preserves root ownership on directories under the
sync target. Subsequent syncs fail at the mkdir step because the
keepalived user cannot create subdirectories inside root-owned
directories.

Add sudo to the mkdir command to match the existing sudo rsync usage.

Also update the sudoers configuration in the postinst script to permit
/bin/mkdir in addition to /usr/bin/rsync.

Fixes: openwrt#28565
Signed-off-by: willjay <723386252@qq.com>
@willjayyyy willjayyyy force-pushed the fix/keepalived-sync-mkdir-sudo branch from 00681eb to 8438644 Compare February 20, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OpenWrt 24.10 Issue/PR on branch 24.10

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants