graysky2 / anything-sync-daemon

Symlinks and syncs user specified dirs to RAM thus reducing HDD/SDD calls and speeding-up the system.
https://wiki.archlinux.org/index.php/Anything-sync-daemon
MIT License
349 stars 44 forks source link

NAMESPACE conflict with systemd private temporary folders #18

Closed doctorcolossus closed 9 years ago

doctorcolossus commented 9 years ago

Hi GraySky.

I was having a weird issue today, when trying to start a couple of services (namely polipo and privoxy), after upgrading and enabling anything-sync-daemon:

systemd[7913]: Failed at step NAMESPACE spawning /usr/bin/polipo: Invalid argument 
-- Subject: Process /usr/bin/polipo could not be executed
-- The process /usr/bin/polipo could not be executed and failed.
-- The error number returned while executing this process is 22.
Jan 24 21:17:18 netbook2 systemd[1]: polipo.service failed.
systemd[7915]: Failed at step NAMESPACE spawning /usr/bin/privoxy: Invalid argument
-- Subject: Process /usr/bin/privoxy could not be executed
-- The process /usr/bin/privoxy could not be executed and failed.
-- The error number returned while executing this process is 22.

I did not initially suspect asd, but after trying all kinds of other stuff, I finally discovered that polipo and privoxy would start normally if the asd service were stopped.

I'm not sure if this had been happening with previous versions of asd, as I had not been using it for some time and had just upgraded today in order to test out the new overlay-fs compatibility. My asd.conf is quite unremarkable. I was just trying with a single directory in order to try and troubleshoot:

WHATTOSYNC=('/home/casey/.config/copyq')
USE_OVERLAYFS="yes"

If I start asd with this configuration, and try to restart polipo and privoxy, they both always fail. As soon as I stop asd, they start up with no issues. So it's is always reproducible for me. I'm using anything-sync-daemon-5.65-1, built just an hour ago.

I just checked commenting out the USE_OVERLAYFS="yes", and then it works fine. So it does seem to be related to the new overlay-fs feature.

I am not sure exactly what is going on, but from what I have read, this error message usually has to do with some people's practice of symlinking /var/tmp to /tmp, or mounting /var/tmp as a tmpfs. Incidentally I had initially been doing the latter, and had also been using tmpfs folders for my polipo cache and log folders, but removed those directives from my fstab while troubleshooting. That didn't solve my problem, but stopping asd did.

Please let me know if there's any more info I could supply you with.

doctorcolossus commented 9 years ago

I also forgot to mention that I don't have the same problem with profile-sync-daemon. It, on the other hand, is working just fine...

graysky2 commented 9 years ago

I am not an expert with systemd and haven't seen that namespace error that you're seeing. I also do not use either of the two [polipo or privoxy] programs you mentioned, so I have not experience to drawn on. If you can use the symlinks in the default sync mode (ie no overlayfs) that does seem to narrow it down. Perhaps I am not invoking the mount correctly for these applications? Have a peek at /usr/bin/asd to see the mount syntax. You might try seeing if either program has a ML or forum and try asking there. If you are able to track it down to a mount option that needs to be present, I am happy to evaluate it. I just don't have time to begin using the two you mentioned on my own.

xhpohanka commented 9 years ago

Hi Graysky2,

I have similar issue that is described in original question. I sync whole /var/lib directory with asd and see NAMESPACE conflicts for systemd-hostnamed and systemd-localed

Jan 27 21:16:49 jules-ntb dbus[502]: [system] Activating via systemd: service name='org.freedesktop.locale1' unit='dbus-org.freedesktop.locale1.service'
Jan 27 21:16:49 jules-ntb systemd[1]: Cannot add dependency job for unit cups.socket, ignoring: Unit cups.socket failed to load: No such file or directory.
Jan 27 21:16:49 jules-ntb systemd[1018]: Failed at step NAMESPACE spawning /usr/lib/systemd/systemd-hostnamed: Invalid argument
Jan 27 21:16:49 jules-ntb systemd[1]: systemd-hostnamed.service: main process exited, code=exited, status=226/NAMESPACE
Jan 27 21:16:49 jules-ntb systemd[1]: Failed to start Hostname Service.
Jan 27 21:16:49 jules-ntb systemd[1]: Unit systemd-hostnamed.service entered failed state.
Jan 27 21:16:49 jules-ntb systemd[1]: systemd-hostnamed.service failed.
Jan 27 21:16:49 jules-ntb systemd[1028]: Failed at step NAMESPACE spawning /usr/lib/systemd/systemd-localed: Invalid argument
Jan 27 21:16:49 jules-ntb systemd[1]: systemd-localed.service: main process exited, code=exited, status=226/NAMESPACE
Jan 27 21:16:49 jules-ntb systemd[1]: Failed to start Locale Service.
Jan 27 21:16:49 jules-ntb systemd[1]: Unit systemd-localed.service entered failed state.
Jan 27 21:16:49 jules-ntb systemd[1]: systemd-localed.service failed.

Both services start correctly when asd is stopped.

This gives me one general question. Is it wise to sync whole /var/lib?

regards

graysky2 commented 9 years ago

@xhpohanka - Are you using overlayfs as well? I wouldn't move the entire /var/lib unless you have a robust backup scheme.

xhpohanka commented 9 years ago

On my Archlinux box systemd-hostnamed and systemd-localed fails to start only if using overlayfs. Even if I sync only directory without no connection to these services (eg. /srv). Without overlayfs both services start without problems.

graysky2 commented 9 years ago

That is interesting! I am syncing /var/lib/monitorix using overlay on one of my servers. I looked into systemctl to see if either of those failed, but I don't seem to be using either of them so I cannot repeat.

gim- commented 9 years ago

I experience same the issue as @xhpohanka and I wrote about this in the Arch forum. So I went ahead and tried a few things with my options in asd.conf and it looks like setting VOLATILE to /tmp instead of /dev/shm solved the issue for me. So it's probably related to where ASD is trying to place files. I'll let you know if I find something more.

graysky2 commented 9 years ago

Fixed in https://github.com/graysky2/anything-sync-daemon/commit/b42340cd96c220c9f0c1d3b3b6f2073ba55538c2

Glandos commented 9 years ago

I'm sorry to say that I still have the issue with systemd 226 and asd 5.74 on Debian/Unstable. Exactly the same condition and symptoms. Stopping asd.service worked.

graysky2 commented 9 years ago

@glandos - I'm confused: you've solved the namespace errors by stopping the service?