You are not logged in.

#1 2020-07-08 20:53:52

spiri
Member
Registered: 2016-12-31
Posts: 65

[solved] [rsync] @ERROR: chdir failed but directory exists

Hello Community,

I wrote a script one year ago which does a backup from one LUKS-encrypted device to another one. I do backups from /home, /etc, etc.

I also did a cron job about this to automatically save all my data after a period of time. And this really worked all the time. The old data still resides on my second encrypted hard disk.

Now I'm getting an error when I try to backup my /home and /root partition. rsync cannot chdir (cd I guess?) to /home/spiri. But /home/spiri is my home path and this path really exists.

Just the parent directories are getting copied without any file and not the same permissions as the original files (did rsync -a).

[spiri@linux][spiri(x3)@bash]$ sudo systemctl disable --now rsyncd
[sudo] password for spiri: 
Removed /etc/systemd/system/multi-user.target.wants/rsyncd.service.
[spiri@linux][spiri(x3)@bash]$ sudo systemctl enable --now rsyncd
Created symlink /etc/systemd/system/multi-user.target.wants/rsyncd.service → /usr/lib/systemd/system/rsyncd.service.
[spiri@linux][spiri(x3)@bash]$ sudo rsync -av root@localhost::auto::root .
receiving incremental file list
./

sent 27 bytes  received 47 bytes  148.00 bytes/sec
total size is 0  speedup is 0.00
[spiri@linux][spiri(x3)@bash]$ sudo rsync -av root@localhost::auto::home.spiri .
@ERROR: chdir failed
rsync error: error starting client-server protocol (code 5) at main.c(1777) [Receiver=3.2.1]
[spiri@linux][spiri(x3)@bash]$ systemctl status rsyncd
● rsyncd.service - fast remote file copy program daemon
     Loaded: loaded (/usr/lib/systemd/system/rsyncd.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2020-07-08 22:07:34 CEST; 45s ago
       Docs: man:rsync(1)
             man:rsyncd.conf(5)
   Main PID: 38241 (rsync)
      Tasks: 1 (limit: 19023)
     Memory: 1.1M
     CGroup: /system.slice/rsyncd.service
             └─38241 /usr/bin/rsync --daemon --no-detach

Jul 08 22:07:34 at-home systemd[1]: Started fast remote file copy program daemon.
Jul 08 22:07:34 at-home rsyncd[38241]: rsyncd version 3.2.1 starting, listening on port 873
Jul 08 22:07:57 at-home rsyncd[38292]: connect from localhost (127.0.0.1)
Jul 08 22:07:57 at-home rsyncd[38292]: rsync allowed access on module auto::root from localhost (127.0.0.1)
Jul 08 22:07:57 at-home rsyncd[38292]: rsync on auto::root/ from localhost (127.0.0.1)
Jul 08 22:07:57 at-home rsyncd[38292]: building file list
Jul 08 22:07:57 at-home rsyncd[38292]: sent 67 bytes  received 32 bytes  total size 0
Jul 08 22:08:06 at-home rsyncd[38322]: connect from localhost (127.0.0.1)
Jul 08 22:08:06 at-home rsyncd[38322]: rsync allowed access on module auto::home.spiri from localhost (127.0.0.1)
Jul 08 22:08:06 at-home rsyncd[38322]: rsync: [Receiver] chdir /home/spiri failed: No such file or directory (2)
[spiri@linux][spiri(x3)@bash]$ sudo ls -ld root home
drwxrwx--- 3 root root 4096 Jul  8 16:01 home
d--------- 2 root root 4096 Jul  8 15:57 root

I found on the Internet adding "use chroot = yes" would solve the problem but this is not true for me.

I get chdir error for my /home/spiri and an empty directory for /root. Also I am running rsync as root.

Here is my config:

uid = nobody
gid = nobody
use chroot = no
max connections = 4
syslog facility = local5
pid file = /run/rsyncd.pid
address = 127.0.0.1
port = 873
# listen = 1
max connections = 1


[auto::home.spiri]
	path = /home/spiri
	comment = My home directory
	uid = root
	gid = root
	read only = true
	exclude = *
	include = ...


[auto::root]
	path = /root
	comment = Private area
	uid = root
	gid = root
	read only = true
	exclude = *
	include = ...

Last edited by spiri (2020-07-16 13:33:00)

Offline

#2 2020-07-09 00:38:01

spiri
Member
Registered: 2016-12-31
Posts: 65

Re: [solved] [rsync] @ERROR: chdir failed but directory exists

Hello again,

I found this link with the same problem: https://unix.stackexchange.com/question … ory-exists

The problem is still not solved. I tried chroot which results in the same error and my read is chroot is not the option I'm searching for and I don't use SELinux.

Also I tried to install a command named 'chdir' in /usr/bin to implement the functionalities of cd (chdir == cd). Same error.

I am about to backup my system because I need to install Windows first because the installation will not work otherwise. I'm not sure how long do I wait until giving up.

If you need more information please tell me.

Offline

#3 2020-07-09 00:49:11

loqs
Member
Registered: 2014-03-06
Posts: 17,884

Re: [solved] [rsync] @ERROR: chdir failed but directory exists

Is ProtectHome on in rsyncd.service?

Offline

#4 2020-07-16 13:32:44

spiri
Member
Registered: 2016-12-31
Posts: 65

Re: [solved] [rsync] @ERROR: chdir failed but directory exists

Thank you, disabling it solves the problem.

Offline

Board footer

Powered by FluxBB