[Solved] Overriding systemd Unit Files Isn't Working

I'm trying to set up some custom dependencies for various services, some of which are supported packages, some are custom packages I've developed. I am running into problems following the procedure described here - specifically, service files in /etc/systemd/system are ignored, and the only way to override them is to edit the files in /usr/lib/systemd/system. I have verified this issue on both a VPS instance and my desktop. Both systems were originally built well before systemd and have been converted to pure systemd systems. Does anyone else see these issues, or know of any reason this would be happening and/or how to resolve it?
Steps to reproduce. This example uses httpd and mysql, but I've tested it with several other services, always with the same results:
Enable the service unit and create a new override:
systemctl enable httpd.service
rm /etc/systemd/system/multi-user.target.wants/httpd.service
cp /usr/lib/systemd/system/httpd.service /etc/systemd/system/multi-user.target.wants/httpd.service
Edit /etc/systemd/system/multi-user.target.wants/httpd.service, adding a line 'Wants=mysqld.service' to the [Unit] section.
Make systemd changes effective, and verify them. The first command results in an error that says "Failed to issue method call: Invalid argument". The final command will show an empty list  ("Wants="), when it should list mysqld. Running systemd-delta also shows no override.
systemctl reenable httpd
systemctl daemon-reload
systemctl show -p "Wants" httpd.service
Change the replacement unit file to .include the packaged unit file:
cat > /etc/systemd/system/multi-user.target.wants/httpd.service << __EOF
.include /usr/lib/systemd/system/httpd.service
[Unit]
Wants=mysqld.service
__EOF
Repeat step #3, with the same results
Reenable the package's unit:
rm /etc/systemd/system/multi-user.target.wants/httpd.service
systemctl enable httpd.service
Edit the original unit file in /usr/lib/systemd/system/httpd.service, adding the 'Wants=myslqd.service' to the Unit section
Repeat step 3
Result is the correct and expected one this time ("Wants=myslqd.service")
Last edited by dwheeler (2012-11-14 19:53:10)

Well...
I'm still having problems with .service custom files!
I want to customize the ExecStart from original cronie.service file, like this:
# cat /etc/systemd/system/cronie.service                                                                                         
.include /usr/lib/systemd/system/cronie.service                                                                                               
[Service]                                                                                                                                     
ExecStart=/usr/sbin/crond -n -s -m off
==============================
# systemctl restart cronie.service                                                       
Failed to issue method call: Unit cronie.service failed to load: Invalid argument. See system logs and 'systemctl status cronie.service' for details.
==============================
# systemd-delta                                                                                             
[OVERRIDDEN] /etc/systemd/system/cronie.service → /usr/lib/systemd/system/cronie.service
--- /usr/lib/systemd/system/cronie.service      2012-11-22 20:04:00.000000000 -0200
+++ /etc/systemd/system/cronie.service  2012-11-27 16:09:49.944085437 -0200
@@ -1,10 +1,3 @@
-[Unit]
-Description=Periodic Command Scheduler
+.include /usr/lib/systemd/system/cronie.service
[Service]
-ExecStart=/usr/sbin/crond -n
-ExecReload=/bin/kill -HUP $MAINPID
-Restart=always
-[Install]
-WantedBy=multi-user.target
+ExecStart=/usr/sbin/crond -n -s -m off
==============================
# systemctl status cronie.service
cronie.service - Periodic Command Scheduler                                                                                                   
          Loaded: error (Reason: Invalid argument)
          Active: inactive (dead)
          CGroup: name=systemd:/system/cronie.service
Nov 27 13:52:59 xpto systemd[1]: Starting Periodic Command Scheduler...
Nov 27 13:52:59 xpto systemd[1]: Started Periodic Command Scheduler.
Nov 27 13:52:59 xpto /usr/sbin/crond[309]: (CRON) INFO (running with inotify support)
Nov 27 14:01:01 xpto /usr/sbin/crond[8216]: pam_unix(crond:session): session opened for user root by (uid=0)
Nov 27 14:01:01 xpto /USR/SBIN/CROND[8217]: (root) CMD (run-parts /etc/cron.hourly)
==============================
What am I doing wrong?
Thanks in advance.

Similar Messages

  • Why blocking sites using Hosts file isn't working?

    Hello 
    I need to block a few websites on my home computer. Did a quick search and found out I had to work with the hosts files. So opened up Notepad, ran it as Admin and then opened Hosts and at the bottom added ' 127.0.0.1 facebook.com' then saved the file. But
    facebook is still opening when I go to the page. 
    can someone tell me why  using the Hosts file isn't working?
    I did read somewhere that it might have something to do with security features on my system. FYI, I m using a trial version of Norton Anti Virus and I am running a Windows 7 machine. 
    Thanks. Any help would be appreciated. 

    Are you sure your entry was in fact saved to the hosts file?  The hosts file on my computer blocks unwanted sites.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
    Yes
    This is a copy paste of CMD.exe. It shows what's in the host files. 
    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
    C:\Users\mehdi>cd C:\windows\system32\drivers\etc
    C:\Windows\System32\drivers\etc>dir \a-d
     Volume in drive C is Gateway
     Volume Serial Number is B291-A8C6
     Directory of C:\
    File Not Found
    C:\Windows\System32\drivers\etc>dir /a-d
     Volume in drive C is Gateway
     Volume Serial Number is B291-A8C6
     Directory of C:\Windows\System32\drivers\etc
    10/23/2010  01:06 PM               846 hosts
    06/10/2009  02:00 PM             3,683 lmhosts.sam
    06/10/2009  02:00 PM               407 networks
    06/10/2009  02:00 PM             1,358 protocol
    06/10/2009  02:00 PM            17,463 services
                   5 File(s)         23,757 bytes
                   0 Dir(s)  936,919,461,888 bytes free
    C:\Windows\System32\drivers\etc>type hosts
    # Copyright (c) 1993-2009 Microsoft Corp.
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    # This file contains the mappings of IP addresses to host names. Each
    # entry should be kept on an individual line. The IP address should
    # be placed in the first column followed by the corresponding host name.
    # The IP address and the host name should be separated by at least one
    # space.
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    # For example:
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host
    # localhost name resolution is handled within DNS itself.
    #       127.0.0.1       localhost
    #       ::1             localhost
    127.0.0.1 facebook.com
    C:\Windows\System32\drivers\etc>

  • Ninit Boot Preparation Automation and Systemd Unit File Converter

    I figured I should try to learn more about init systems and started looking at ninit (AUR entry). Now, I know there's other init systems like ignite, runit, OpenRC, etc., but I haven't gotten around to trying those yet. Furthermore, I also looked at ninit's little brother minit and really liked it, but it didn't have all of the features I was looking for before starting to experiment.
    So during my experiments in my virtual machine (I discovered that my classes were not as fast paced as I thought they would be, except for the labs), I decided that I should write up a basic boot-up, some sample daemons, and a script to convert systemd units to other services for other files. Both still largely in the works, but the boot prep stuff DOES work. A few other things were taken into consideration, such as not having to copy one's /etc/modules-load.d/'s contents into some other file because the stuff at the end of the udev prep stage will read those in and killing off all the daemons configured in daemons/depends before bringing down the system (note: I haven't checked to see if it's intelligent to try backtracking the dependencies of those stopped daemons to make sure any daemons brought in with deps are down).
    I don't think I've got the clock-related preparation set up right just yet or some of the other boot stages that I haven't considered (eg: raids, volume groups, etc), but other than that, it should be usable. If anyone wants to do further testing with the unit converter script or the ninit stuff, do let me know. The unit converter script only converts Service files for now, and some of the additional details about services files haven't been considered yet. I do plan on expanding the unit file converter to other init systems once I get the nitpicks with ninit sorted out so people who want to move away from systemd have plenty of choices with less typing.
    For an example of what you'd get (sans the Compiz 0.9.X testing stuff) with this setup, here's what the nsvc -L command'll put out:
    Last edited by ShadowKyogre (2014-02-26 07:03:02)

    Ok i solved in the easiest way, reading better the wiki, obviously -.- .
    archwiki wrote:The user will be logged out when X is killed. In order to avoid this, remove the exec part from the script.
    EDIT: so, i set up my new bash_profile according to this:
    . $HOME/.bashrc
    if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
    startx
    #logout
    fi
    then change
    Restart=no
    in
    Restart=always
    Perfect!
    I'd like only to know how can i achieve this: i want that if it is my first login, i'm autologged in, but if that's not my first login, i'd like to have autologin stopped.
    Is there a way? The only i came up with is something like: wrote 1 to a file during first login, and then check that file during later logins. If there's a 1, then do not autologin, else autologin...but it is so stupid idea!
    Last edited by nierro (2012-07-19 19:04:55)

  • About the autologin@.service systemd unit file

    Hi!
    I switched some days ago, from slim to [email protected] (in systemd), and i'm really happy with my choice.
    But I'm having a problem: autologin works perfectly, but if i exit the session from xfce4 menu (if i kill xserver), tty1 will stay black, and i can't login there again, but i have to switch to another tty and login there.
    Is anyone else experiencing this problem?
    cat /etc/systemd/system/[email protected]
    # This file is part of systemd.
    # systemd is free software; you can redistribute it and/or modify it
    # under the terms of the GNU Lesser General Public License as published by
    # the Free Software Foundation; either version 2.1 of the License, or
    # (at your option) any later version.
    [Unit]
    Description=Getty on %I
    Documentation=man:agetty(8)
    After=systemd-user-sessions.service plymouth-quit-wait.service
    After=rc-local.service
    # If additional gettys are spawned during boot then we should make
    # sure that this is synchronized before getty.target, even though
    # getty.target didn't actually pull it in.
    Before=getty.target
    IgnoreOnIsolate=yes
    # On systems without virtual consoles, don't start any getty. (Note
    # that serial gettys are covered by [email protected], not this
    # unit
    ConditionPathExists=/dev/tty0
    [Service]
    Environment=TERM=linux
    # the VT is cleared by TTYVTDisallocate
    ExecStart=-/sbin/agetty -a federico %I 38400
    Type=idle
    Restart=no
    RestartSec=0
    UtmpIdentifier=%I
    TTYPath=/dev/%I
    TTYReset=yes
    TTYVHangup=yes
    TTYVTDisallocate=yes
    KillMode=process
    IgnoreSIGPIPE=no
    # Unset locale for the console getty since the console has problems
    # displaying some internationalized messages.
    Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=
    # Some login implementations ignore SIGTERM, so we send SIGHUP
    # instead, to ensure that login terminates cleanly.
    KillSignal=SIGHUP
    [Install]
    Alias=getty.target.wants/[email protected]
    and
    cat .bash_profile
    . $HOME/.bashrc
    if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
    . startx
    logout
    fi
    Anyone can help?
    Thanks!

    Ok i solved in the easiest way, reading better the wiki, obviously -.- .
    archwiki wrote:The user will be logged out when X is killed. In order to avoid this, remove the exec part from the script.
    EDIT: so, i set up my new bash_profile according to this:
    . $HOME/.bashrc
    if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
    startx
    #logout
    fi
    then change
    Restart=no
    in
    Restart=always
    Perfect!
    I'd like only to know how can i achieve this: i want that if it is my first login, i'm autologged in, but if that's not my first login, i'd like to have autologin stopped.
    Is there a way? The only i came up with is something like: wrote 1 to a file during first login, and then check that file during later logins. If there's a 1, then do not autologin, else autologin...but it is so stupid idea!
    Last edited by nierro (2012-07-19 19:04:55)

  • [solved] writing systemd service file to run script

    i have completely migrated to systemd. now, i am trying to write a service file to run a startup script (~/.startup.sh). one of the functions of the script is to set the brightness of the screen:
    echo "95" > /sys/class/backlight/intel_backlight/brightness
    i created /etc/systemd/system/startup.service:
    [Unit]
    Description=Run startup script
    [Service]
    Type=oneshot
    ExecStart=~/.startup.sh
    [Install]
    WantedBy=multi-user.target
    but i get the following error:
    Failed to issue method call: Unit startup.service failed to load: Invalid argument. See system logs and 'systemctl status startup.service' for details.
    i have two questions:
    1. what am i missing?
    2. how can i avoid permission issues associated with modifying the brightness file (e.g., permission denied errors, the need to put in the password, etc.)?
    thanks.
    Last edited by anti-destin (2012-08-01 22:26:04)

    thanks for the replies.
    just a note: using an absolute path didn't fix the issue.
    but i went ahead and created the file /etc/tmpfiles.d/backlight.conf:
    w /sys/class/backlight/intel_backlight/brightness - - - - 95
    and that worked.
    is there a reason for recommending using a tmpfile rather than a service?
    in any case, i'm marking this as solved.

  • [solved] Writing systemd service file - forking no pidfile

    Hey all,
    I am trying to write .service files for TORQUE, but am having some difficulty and quite can't understand the docs.  Here's what I have so far for the server
    [Unit]
    Description=TORQUE server
    Wants=basic.target
    After=basic.target network.target
    [Service]
    Type=forking
    PIDFile=/run/torque-server.pid
    ExecStart=/usr/sbin/pbs_server
    [Install]
    WantedBy=multi-user.target
    The problem I'm having is with the PIDFile - pbs_server doesn't provide an option (as far as I can see) to specify a pid file... is this something that systemd can generate on its own, or what's the normal solution here?
    Without the PIDFile specified systemctl start returns immediately and no process exists, with the PIDFile systemctl start stalls for a while and then has an error saying it couldn't find the pid file (surprise), but pbs_server is left running.
    Thanks for any help
    Last edited by dandaman0061 (2012-12-13 19:58:36)

    Nevermind - it appears that pbs_server creates a pid file at $TORQUE_HOME/server_priv/server.lock where using torque from the AUR is /var/spool/torque
    Chaging the pidfile setting in the service file to this now works.

  • [SOLVED]Pacman systemd missing file

    Everytime when I run pacman I get this error:
    error: could not open file /var/lib/pacman/local/systemd-217-8/desc: No such file or directory
    I think i messed up something when upgrading system.
    Can you help me to solve this issue?
    Thanks
    Last edited by Arch3R (2014-11-29 19:14:08)

    Just reinstall systemd:
    pacman -S systemd
    select yes if it prompts due to it already being installed.
    You might also want to run `pacman -Qk` to see if any other packages have been damaged.
    EDIT: I just did some silly trial and error and deleted that file from my system (probably would have been smarter to move/rename it).  Reinstalling systemd failed due to a conflicting file error as all the files for the package are there, but the pacman database doesn't realize they belong to that package.  In this case I used --force with the single specific package:
    pacman -S --force systemd
    Note that this use of --force is an apparent necessity to fix this specific problem.  This does not support using it when uncertain why something fails - I knew why it was failing.
    Last edited by Trilby (2014-11-29 19:01:55)

  • .swf file isn't working in a wrapper that was created in Director::

    I'm working with a client that uses an in house "wrapper" that houses their training courses and has some back end reporting built into it.  The wrapper basically is the shell that consists of the navigation so users can get through the different files and courses that are housed within the wrapper.  It's a jerry.rigged lms.  I create courses for this client using captivate 4.0 and publish out to .swf files.  All my files have worked for them.  However,  I have created a new type of interaction for them and it's not working for them once the bring it into the director wrapper.  It's a screen that has 6 clickable areas on it and when the learner clicks, they should get a .pdf document that opens in a new window.  What's happening is the screen shows up, but the documents aren't pulling up when they click on the links.
    FYI--the interaction works perfectly until it is loaded into the wrapper.
    Any thoughts?
    Thank you!

    Director mx2004 10.1
    You need 10.1.1
    This quote is from the download page:
    <quote>
    Download the appropriate developer update file based on your platform and language of use so you can drag-install the necessary files to update both Director MX 2004 and your Shockwave Player to version 10.1.1. This latest update contains fixes for a number of known issues in addition to providing support for Flash 8 SWF files.
    </quote>

  • Unzip'ing a split zipped file isn't working--.

    Trying to split file using zip. I've used the -s to split the file (which worked fine).  But unzip will not put the file back together. Why?

    Trying to split file using zip. I've used the -s to split the file (which worked fine).  But unzip will not put the file back together. Why?

  • After upgrading audio on video files isn't working

    After "Upgrading" to 6.0.2.23 the audio on video files is screwed up. The video image is fine but it sounds like a CD player that's stuck. Audio only files and streaming audio files play fine. Any ideas?
    Dell Workstation   Windows 2000  

    Solved!
    codecs were missing...should have thought about it!
    Jsut install the perian app for quicktime....fixed. 

  • Sent mail file isn't working

    When I check my send mail folder I receive the following message:
    The message from...... concerning..... has not been downloaded from the server. You need to take this account online in order to download it.
    Last week everything was working fine now suddenly this message. Can someone please help me fix this problem?

    OPEN LETTER TO THE MAIL 2.0 CODING TEAM. RSVP.
    with thanks to DAVID GIMENO GOST, for answering so many people's posts about all the mail 2.0 bugs.
    hi guys,
    i love all things apple, and i have done for twenty years.
    but with respect, your build of mail 2.0 really could be a lot better.
    moving my mail from 1.0 on an ibook g3 running os X 10.3.9, over to mail 2.0 on an intel macbook 1.83 running os X 10.4.7 has been a nightmare.
    the discussion boards of many mac sites feature countless cases of people making the move from 1.0 to 2.0, with all their e-mails disappearing.
    having spent two weeks reading the knowledge forums, and learning about emailchemy, plus all the complications which, even with that third party program, still exist in moving one's mail over from version 1.0 over to 2.0, are both massive and horrendous.
    and that's for me, who has twenty years of finding my way around mac bugs.
    but this one is the most difficult i've ever seen, as well as being one of the most widespread problems in a FULL VERSION RELEASE of an apple program, which apple has done nothing to resolve during the six months in which this problem has been widespread in the mac community worldwide.
    so thank god for DAVID GIMENO GOST !
    i'm amazed that apple still hasn't come up with a patch for moving mail from 1.0 to 2.0.
    even now, while i've finally got all my mail back today, 95% is showing as unread, due to the last obstacles in the process, which i can no longer face solving.
    i've also lost hundreds of red mail flags during the transfer :o(.
    PLEASE PLEASE PLEASE, guys:
    we shouldn't need to be buying third party software to move our e-mails from apple mail 1.0 up to apple mail 2.0, and even then be faced by massive hurdles to overcome, which take weeks for someone who at least has SOME idea of what he's doing.
    i pity all the people who read the numerous forum posts about how difficult it is to transfer their mail from 1.0 to 2.0, and simply give up on the spot, and have to start their e-mail history TODAY, unable to access their previous e-mail again - potentially now for ever.
    because the ironic joke is that we can't even have an access copy of mail 1.0 on our macs to read our old e-mails, unless we hack that program out of the 10.3 cd installation set, which the gurus on your own web site recommend us NOT to do !
    so what are we supposed to do, to access our old e-mail, which we can't open, even though YES, it is in our mail folder, and YES, we did full rebuilds of every mail folder, and YES, we trashed our mail preferences first.
    e-mail is now at the very center of the average mac user's digital life.
    a user's most important program should not require countless hours scrolling through the astonishing number of problems within mail 2.0, which the apple.com discussion boards evidence, with new problems being added every day.
    please sort this out, and build a patch, for the sanity of the many people who love apple, but who are unable to access any of their old e-mails.
    because i wouldn't wish the last fortnight on anyone else.
    RSVP, APPLE.
    with best wishes to everyone on the infinity loop,
    michael thorne
    london, england
    [email protected]
    ps: if you're a mac user who has been affected by the mail 2.0 disappearing bug, please post a reply to this message, and send me an e-mail to: [email protected], so that we can draw apple's increasing attention to it. thanks.
    MacBook1. 1.83 GHz. 512 MB.   Mac OS X (10.4.7)  

  • Exporting using share to file isn't working in my iMovie.

    When I use Share > File to export my movie I get the notification saying it's successful. But when I go and look in the folder I saved the movie to it's not there. How do I fix this problem and actually get the iMovie to export my project to a regular folder?

    Reboot.
    try copy & pasting of some @
    try a different email  client see app store
    use a web browser to access the email on a server
    re-boot ipad.
    Press and hold the Sleep/Wake button until a red slider appears, then drag the slider. Then press and hold the Sleep/Wake button until the Apple logo appears.  page 128 iPad user manual.
    more details on re-booting:
    http://ipad.about.com/od/iPad_Guide/ss/How-To-Reboot-Your-iPad-Power-Off.htm

  • Compressing files isn't working for me

    I have a 46mb movie file. Too big to attach to my email. I compressed it in Finder, and it showed me a progress bar grinding away, and then displayed my file with a .zip extension. However, the zipped file is the same size as the original.
    What should I be doing to get this file shrunk down to a smaller size?
    Thanks in advance.

    What should I be doing to get this file shrunk down to a smaller size?
    Re-encode it using a greater compression settings.
    Videos are already compressed, so zipping them has no effect.

  • [Solved]With systemd on install media, systemctl works during install?

    When I upgrading my current machine from sysvinit to systemd, in order to use systemctl to enable services, I first had to reboot the system.
    With the new install media for October using systemd, is it possible to enable these services using systemctl during the install (ie, so I could add 'systemctl enable foo.service' to install scripts)?
    I do realize that I could just manually symlink, but it feel much nicer to use systemctl.
    Last edited by Morrad (2012-10-08 05:12:39)

    I do exactly that in my install script...
    systemctl enable cronie.service
    systemctl enable [email protected]
    systemctl enable UEFIstubMOVE.path
    systemctl start UEFIstubMOVE.path
    ...but see below for the message I get when I try to start one of the services...
    ln -s '/usr/lib/systemd/system/cronie.service' '/etc/systemd/system/multi-user.target.wants/cronie.service'
    ln -s '/usr/lib/systemd/system/[email protected]' '/etc/systemd/system/multi-user.target.wants/[email protected]'
    ln -s '/etc/systemd/system/UEFIstubMOVE.path' '/etc/systemd/system/multi-user.target.wants/UEFIstubMOVE.path'
    Running in chroot, ignoring request.

  • I'm having trouble installing firefox 5 on my laptop. The installation file isn't working!!

    every time run the installation file it starts extracting and after that the program exits without installing firefox.

    Please send me an update when this is fixed! I would like to use the browser as I'm fed up with IE, but I can't even FIND the files after they "extract". I'm a VERY good 'end user', and can usually find just about anything, but I'm at a loss.
    Thanks for your PROMPT attention!
    Olaina aka "blogfoxy"

Maybe you are looking for

  • How to make ROUNDED rectangle default style cp8?

    Hi, I want my smart shape style to be rounded rectangle, not squared. I have set up my object styles with color and all that good stuff, but there is no way I can see to make it the rounded shape instead of the squared off shape.  I also tried to cha

  • Newb Question regarding Same InDesign CS4 file used on two different computers.

    Probably been answered 1,000 times or is common knowledge, but I could not get it narrowed down using the search feature. I would like to take an InDesign CS4 file ( a book) created on my imac, and work on it while away on a macbook pro with identica

  • Log trapping with daignostic module

    I am using a WebLogic mail session and diagnostic module to trap an occasional error in my server logs and it works great. However, now I have another requirement of trapping an error that is not in one of the WebLogic logs. This is a custom log writ

  • Detects wrong display at startup

    I am running 10.5 and every now and then on start up my MBP will detect a VGA display and mess up the resolution of the screen. I have to restart and then it will work again and return to my normal display mode. I do not have another display connecte

  • Idoc generation and reprint for smartforms and sapscripts

    Dear Experts, Currently our scenario is as below. We are using XML for all outputs. once IDOC is generated it is passed to XML port and print is issued. To reprint IDOC we have a customised program where in we can enter idoc number and print output.