You are not logged in.
My root file system is nilfs2. Yay!
But I can't get the cleanerd to auto-start.
According to the documentation, for root file systems, I need to run a manual command to start it.
I tried creating a unit (service) file to do this, but systemd doesn't seem to recognize it.
I create the file as /etc/systemd/system/nilfs-cleanerd.service, but I get an error trying to enable it.
I also have it as a "wants" to try to auto-run it.
Shell output, showing the file, and the command/error:
[root@robot1 /]# systemctl enable nilfs-cleanerd.service
Failed to issue method call: Invalid argument
[root@robot1 /]# cat /etc/systemd/system/nilfs-cleanerd.service
[Unit]
Description=Garbage collect NILFS segments
After=local-fs.target
[Service]
ExecStart=/sbin/nilfs_cleanerd
Type=simple
[Install]
Alias=nilfs-cleanerd.service
WantedBy=local-fs.target.wants
[root@robot1 /]#
So, how do I debug this error? There's no "-v" option to systemctl to get more verbose error messages that might give a hint about where in the operation it fails.
Also, there seems to be a cleanerd running somehow:
[root@robot1 /]# ps alx | grep ni[l]
1 0 222 2 20 0 0 0 nilfs_ S ? 0:03 [segctord]
4 0 223 1 20 0 14692 864 wq_sle Ss ? 0:00 /sbin/nilfs_cleanerd -n /dev/sda1 /
[root@robot1 /]#
but nilfs-clean doesn't find it:
[root@robot1 /]# nilfs-clean
No cleaner found on /dev/sda1.
[root@robot1 /]#
so it may be that my problem is related to nilfs-clean rather than the systemctl command. But I still want to understand how to debug this systemctl error.
Offline
To begin with, you should drop the '.wants' in the WantedBy line. Also it seems like you have an Alias that is identical to the real name?
Next, hope for someone who knows something about nilfs to jump in
Offline
To begin with, you should drop the '.wants' in the WantedBy line. Also it seems like you have an Alias that is identical to the real name?
Next, hope for someone who knows something about nilfs to jump in :)
I removed the ".wants" suffix, and get the same error.
I have the "alias" there because I think that's what's needed for services that are installed as wanted by other things. I could be wrong.
I posted the nilfs specific question in another thread in another sub-forum. This thread is about systemd, and writing custom services. Specifically, where should custom service files live? Documentation seems to say /etc/systemd/system/yourname.service, but that's what I do, and it doesn't work. That's also where systemctl puts the symlinks for enabled services, and clearly it can't put a symlink there when the service already has the same name.
So, if I want to create a service file, that systemctl will find, and that can be enabled/disabled like regular services, what directory should it live in? This is not actually mentioned in any of the documentation I could find, which just focuses on examples of various kinds of unit files...
Offline
nilfs-cleanerd will be automatically started when you mount any nilfs2 partition, there should be no need to manually start it.
From man mount.nilfs2:
mount.nilfs2 serves to attach a NILFS2 file system on the specified directory dir. It is intended to be executed from mount(8), and will invoke the garbage collector nilfs_cleanerd(8) after an actual mount system call has succeeded. Conversely, umount.nilfs2(8) will shutdown the garbage collector before detaching the file system.
Last edited by R00KIE (2012-12-31 11:22:05)
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
Jwatte - do NOT put your questions about systemd in the main wiki pages. The discussion tab is there for exactly that purpose.
Now... please look again at the contents of /etc/systemd/system - it does not contain the symlinks for enabled services, it contains a number of *.wants directories, and they contain the symlinks for enabled services. You can also verify this by reading the output of any successful "systemctl enable foo" command.
Finally if you think the wiki is not clear enough on what goes where, you can improve it yourself.
Last edited by tomk (2012-12-31 12:05:52)
Offline
Finally if you think the wiki is not clear enough on what goes where, you can improve it yourself.
I'd be happy to improve it, once I find the authoritative source that tells me what the rule is.
You're not actually answering the question, though, unless I'm supposed to read between the lines.
Are you saying that locally defined services should, in fact, have their files live in /etc/systemd/system ? Because when I select particular services, symlinks get generated in /etc/systemd/system. Here's the output of "ls -l /etc/systemd/system" on my machine:
[jwatte@robot1 Onyx]$ ls -l /etc/systemd/system
total 40
-rw-r--r-- 1 root root 1662 Dec 14 05:00 autologin@.service
lrwxrwxrwx 1 root root 41 Dec 14 05:05 default.target -> /usr/lib/systemd/system/multi-user.target
lrwxrwxrwx 1 root root 36 Dec 14 04:50 display-manager.service -> /usr/lib/systemd/system/lxdm.service
drwxr-xr-x 2 root root 4096 Dec 14 05:01 getty.target.wants
drwxr-xr-x 2 root root 4096 Dec 30 15:57 local-fs.target.wants
drwxr-xr-x 2 root root 4096 Dec 29 20:19 multi-user.target.wants
-rwxr-xr-x 1 root root 191 Dec 30 15:57 nilfs-cleanerd.service
drwxr-xr-x 2 root root 4096 Dec 29 20:19 printer.target.wants
drwxr-xr-x 2 root root 4096 Dec 29 20:19 sockets.target.wants
drwxr-xr-x 2 root root 4096 Nov 22 07:21 sysinit.target.wants
[jwatte@robot1 Onyx]$
Note the symlinks for default.target and display-manager.service. Then again, autologin@.service is a file living in this directory.
The problem then becomes: Why do I get the error listed at the beginning of this post?
Here's the output of ls -l on local-fs.target:
[jwatte@robot1 Onyx]$ ls -l /etc/systemd/system/local-fs.target.wants/
total 4
lrwxrwxrwx 1 root root 42 Dec 30 15:57 nilfs-cleanerd.service -> /etc/systemd/system/nilfs-cleanerd.service
[jwatte@robot1 Onyx]$
Last edited by jwatte (2013-01-01 22:52:01)
Offline
nilfs-cleanerd will be automatically started when you mount any nilfs2 partition, there should be no need to manually start it.
Thank you for your suggestion. I understand how the nilfs-cleanerd is supposed to be started. However, as I reported in the the original post, the nilfs_cleanerd that's automatically started, doesn't actually clean the device that was mounted. I imagine that's a bug in the nilfs infrastructure, which should be discussed in that thread:
https://bbs.archlinux.org/viewtopic.php?id=155439
This particular post is about how to start services, and specifically, why I get an error message trying to start the service file I created. The reason I created it is as a work-around for the problem above.
I'd appreciate it if this thread actually managed to figure out why I get the error message when I try to start the service in question. Just running the given command line works fine.
Offline
I guess you should look into why it fails and not try to start nilfs-cleanerd yourself. I'm using nilfs2 as the root fs in a usb flash drive and nilfs-clean seems to be work just fine, the only difference here is that my root fs is encrypted.
I have tried 'nilfs-clean /dev/mapper/flash8g-root' and it didn't return any error. nilfs-cleanerd is running and was automatically launched at mount time I suppose.
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline