[systemd-devel] systemctl enable myunit.service ---> Failed to execute operation: Invalid argument

bobafetthotmail starshipeleven at hotmail.it
Tue Dec 29 07:30:43 PST 2015


Finally found a workaround, bypassing systemctl.

I'm making myself (having the script autoinstall routine do, actually) 
the symlink that systemctl refuses to make, as that's the only thing 
that "systemctl enable XXX.service" seems to do.

ln -s /etc/folder2ram/folder2ram.service 
/lib/systemd/system/local-fs.target.wants/folder2ram.service

(from the service file wherever it is, to the folder of the target 
stated in "WantedBy=foo-bar.target" in the install section)

Ran some tests, and my script is indeed called on startup and shutdown, 
no error reported anywhere.

So this issue was confined to systemctl (thankfully).

-Albert


On 12/28/2015 04:21 PM, bobafetthotmail wrote:
>
> On 12/28/2015 04:55 AM, Andrei Borzenkov wrote:
>> 27.12.2015 22:23, bobafetthotmail пишет:
>>> I'm still trying to understand why my unit (see the quote below) that
>>> calls a script can be started/stopped but cannot be enabled..
>>>
>>> I tried changing everything in the unit, it still fails.... any help?
>>>
>>> I googled and the only thing I found is a guy having a similar 
>>> problem here
>>> http://ubuntuforums.org/showthread.php?t=2287364
>>> but none answered him and he had to fall back to add a line to the
>>> /etc/rc.local
>>>
>> Do you have any initscript with the same name (I do not know where they
>> are located in Debian)?
>
> No, I have no initscript with the same name.
>
> On Debian they are located in /etc/init.d
>
> Thanks.
>
> -Albert
>
>
>>> -Albert
>>>
>>>
>>> On 12/13/2015 07:09 PM, bobafetthotmail wrote:
>>>> Hi, it's me again. :)
>>>>
>>>> I made a systemd unit called "folder2ram.service", with these 
>>>> contents:
>>>>
>>>> ------
>>>> [Unit]
>>>> Description=folder2ram systemd service
>>>>
>>>> [Service]
>>>> Type=oneshot
>>>> ExecStart=/sbin/folder2ram -mountall
>>>> ExecStop=/sbin/folder2ram -umountall
>>>> RemainAfterExit=yes
>>>>
>>>> [Install]
>>>> WantedBy=multi-user.target
>>>> -----
>>>>
>>>> /sbin/folder2ram is a shell script, that is, its shebang is #! /bin/sh
>>>>
>>>> If I place the systemd unit in either /lib/systemd/system/ or
>>>> /etc/systemd/system/
>>>>
>>>> when I write: "systemctl enable folder2ram"
>>>>
>>>> It returns:
>>>> ----
>>>> Failed to execute operation: Invalid argument
>>>> ----
>>>>
>>>> But I can start or stop it normally with "systemctl start/stop
>>>> folder2ram".
>>>>
>>>> This is the output of "systemctl status folder2ram" when stopped:
>>>> -----
>>>>   folder2ram.service - folder2ram systemd service
>>>>     Loaded: loaded (/lib/systemd/system/folder2ram.service; disabled)
>>>>     Active: inactive (dead)
>>>> -----
>>>>
>>>> This is the output when started:
>>>> -----
>>>>   folder2ram.service - folder2ram systemd service
>>>>     Loaded: loaded (/lib/systemd/system/folder2ram.service; disabled)
>>>>     Active: active (exited) since Sun 2015-12-13 18:54:16 CET; 1min 
>>>> 4s ago
>>>>    Process: 21257 ExecStart=/sbin/folder2ram -mountall (code=exited,
>>>> status=0/SUCCESS)
>>>>   Main PID: 21257 (code=exited, status=0/SUCCESS)
>>>>
>>>> Dec 13 18:54:16 alby-xeon folder2ram[21257]: will now start all
>>>> mountpoints
>>>> -----
>>>>
>>>> I'm on Debian Jessie, using Systemd 215 (the normal Debian Jessie 
>>>> one).
>>>>
>>>> Can someone give me some hints to understand what I'm doing wrong?
>>>>
>>>> Also, could it be possible to have more verbose error text?
>>>>
>>>> Where and/or what is the invalid argument?
>>>>
>>>> Thanks
>>>>
>>>> -Albert
>>>> _______________________________________________
>>>> systemd-devel mailing list
>>>> systemd-devel at lists.freedesktop.org
>>>> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>>> _______________________________________________
>>> systemd-devel mailing list
>>> systemd-devel at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel



More information about the systemd-devel mailing list