Systemd services seem to ignore "After=network.target" with NM

Hey, I've been having some trouble with services that require the network to be up running too early in the boot sequence. I'm running NetworkManager.
Looking at the journal shows them running before networkmanager starts the interfaces, and failing since there's no interface available yet.
For now I've discovered that running "systemctl enable NetworkManager-wait-online.service" seems to have solved it, but is this how it is supposed to work or is something going wrong?

MisterAnderson wrote:The service isn't exiting, it's that other services are starting whilst NetworkManager is starting, so the interfaces are initialised and named yet. After=network.target appears to only make other services wait until NetworkManager starts, not until it's finished.
OK. I guess the problem is that NM.service is Type=dbus. so systemd doesn't wait on it to finish but only for the dbus socket to appear (?). That's why you have to insert an additional ordering point NM-online.service which delays the start of network.target. I wonder though if you can avoid that by using type-forking and removing "--no-daemon" argument...

Similar Messages

  • Systemd service, make it response to network changes

    I'm using netctl and I'm trying to make my own service. The idea is that my service is restarted if I do a
    systemctl restart netctl@net0
    or if I unplug and plug again the network cable with the service netctl-ifplugd@net0 enabled. First case is easy, but I don't find a solution for both cases, any suggestions?

    I wrote service like this:
    [Unit]
    Description=Service on interface %I
    Wants=docker.service
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/usr/lib/project/my_script.sh start %I
    ExecStop=/usr/lib/project/my_script.sh stop %I
    [Install]
    WantedBy=multi-user.target
    What I want is restart this service if I do a restart of the network, with 'netctl restart mynetwork' or automatically via the 'netctl-ifplugd@mynetwork' service. Ideally my service restart would be independent from netctl and only dependent of the network interface.

  • [SOLVED] systemd services load slow/fail after forcing package install

    This is more of a PSA for those coming across this issue in the future. I think people should do more of these.
    I recently had problems installing packages where pacman told me several files already existed in the filesystem. This happened when I tried to install an individual official package, not a full system upgrade, so I couldn't find any relevant posts.
    I tried to --force install the package, thereby rewriting all such files. But I noticed the next time I rebooted and logged into my system, my Cinnamon session would load extremely slowly (~2 mins) and I had several failed services.
    Symptoms of the problem included:
    - non-root partitions not mounted on boot
    - users and groups added after initial system install were gone (including sudo)
    - difficulty connecting to networks
    - trying to start/restart services resulted in a Polkit-related error and a timeout
    So after a while I found this post: https://bbs.archlinux.org/viewtopic.php?id=151915
    It suggested that the polkit-related user and group were missing and I should check my /var/log/pacman.log around the time of my force installation, which I did. This revealed pacman overwrote several files in /etc including fstab, hosts, passwd, shadow and group.
    Luckily pacman backed up all those files under the suffix *.pacorig so I by renaming the backups and rebooting I was thankfully able to return my system to normal.

    I have another example of rc.local which is mainly about configuring power saving etc etc on a netbook
    hdparm -B254 /dev/sda
    grep -q '0' /sys/class/power_supply/ADP1/online && P="powersave" || P="ondemand"
    cpupower -c all frequency-set -g "$P"
    echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
    /usr/sbin/iw dev wlan0 set power_save on
    echo '0' > '/proc/sys/kernel/nmi_watchdog'
    echo '1' > '/sys/module/snd_hda_intel/parameters/power_save'
    echo 'auto' > '/sys/bus/pci/devices/0000:00:00.0/power/control'
    echo 'auto' > '/sys/bus/pci/devices/0000:00:02.0/power/control'
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.0/power/control'
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1b.0/power/control'
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.0/power/control'
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.1/power/control'
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.2/power/control'
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.3/power/control'
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.7/power/control'
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.2/power/control'
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.3/power/control'
    echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control'
    echo 'auto' > '/sys/bus/pci/devices/0000:02:00.0/power/control'
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.1/power/control'
    /usr/sbin/ethtool -s eth0 wol d
    what is the systemd way of doing this sort of thing?
    Also where should local units be put so that they can be enabled/disabled etc. If I put them in /usr/lib/systemd/system won't they interfere with pacman?

  • SCVMM Service Fails to start after SCOM Restore (with possible fix)

    Hi, 
    Found an issue today that SCVMM 2012 SP1 Service (with rollup's) would not start. Only think I was told was that recently the SCOM Database had been dropped and re-created. We did have SCVMM connected to SCOM. 
    I got some errors like this on the SCVMM Server
    Log Name:      VM Manager
    Source:        Virtual Machine Manager
    Date:          12/27/2013 12:45:29 PM
    Event ID:      19999
    Task Category: None
    Level:         Error
    Keywords:      Classic
    User:          N/A
    Computer:      SCVMM01.domain.local
    Description:
    Virtual Machine Manager (vmmservice:3036) has encountered an error and needed to exit the process. Windows generated an error report with the following parameters: 
    Event:VMM20
    P1(appName):vmmservice
    P2(appVersion):3.1.6032.0
    P3(assemblyName):E.MomDal.MOMFacadeFactory
    P4(assemblyVer):3.1.6011.0
    P5(methodName):M.V.E.M.FacadeFactory.Create[T]
    P6(exceptionType):System.NullReferenceException
    P7(callstackHash):42ec
    Any Ideas?

    I think I found the issue.  
    I found that because SCVMM had been tied into SCOM, it failed to start if SCOM was running with a fresh database and didn't know about SCVMM. 
    I got around this by
    * Turning off both SCOM servers in our environment
    * Starting the SCVMM Service
    * Disabling the connection from SCVMM to SCOM (Remove-SCOpsMgrConnection -force in VMM Powershell)
    Not sure if this is the correct way to resolve this issue but it seemed to. 
    Should this have been solved another way? 

  • [SOLVED] Trying to write HLDS systemd service file

    Hey,
    I want to write a systemd service file for my HLDS AUR package: https://aur.archlinux.org/packages/hlds/
    My environment file looks like this:
    HLDS_USER=root
    HLDS_WORKINGDIR=/opt/hlds
    HLDS_PARAMS="-game cstrike"
    HLDS_LOGFILE=/var/log/hlds_cstrike
    The service file like this:
    After=network.target
    [Service]
    #EnvironmentFile=/etc/conf.d/hlds
    #User=${HLDS_USER}
    #WorkingDirectory=${HLDS_WORKINGDIR}
    ExecStart=/opt/hlds/hlds_run -game cstrike
    ExecStop=/bin/kill $MAINPID
    [Install]
    WantedBy=multi-user.target
    But systemd fails to start the service:
    hlds.service - Half-Life Dedicated Server
              Loaded: loaded (/usr/lib/systemd/system/hlds.service; disabled)
              Active: failed (Result: exit-code) since Thu, 2013-01-03 06:20:49 CET; 2s ago
             Process: 567 ExecStop=/bin/kill $MAINPID (code=exited, status=1/FAILURE)
             Process: 564 ExecStart=/opt/hlds/hlds_run -game cstrike (code=killed, signal=INT)
              CGroup: name=systemd:/system/hlds.service
    Jan 03 06:20:49 playground systemd[1]: Starting Half-Life Dedicated Server...
    Jan 03 06:20:49 playground systemd[1]: Started Half-Life Dedicated Server.
    Jan 03 06:20:49 playground hlds_run[564]: Invalid game type 'cstrike' sepecified.
    Jan 03 06:20:49 playground hlds_run[564]: Thu Jan  3 06:20:49 CET 2013: Server Failed
    Jan 03 06:20:49 playground kill[567]: usage: kill [ -s signal | -p ] [ -a ] pid ...
    Jan 03 06:20:49 playground kill[567]: kill -l [ signal ]
    Jan 03 06:20:49 playground systemd[1]: Unit hlds.service entered failed state
    Running
    /opt/hlds/hlds_run -game cstrike
    manually works quote well
    Someone knows how to proceed? Thanks
    Last edited by onny (2013-01-03 05:43:49)

    Solved. It didn't recognized the workingdir correctly ...

  • Systemd services starting before network is up

    I have a couple services that need the network to be up before they start. I have After=network.target in my .service unit. I have also tried After=netctl@ovh_net_eth0.service both did not work. Services error because no network when they are started. I have tried Google and searching the forums here and I am stumped.
    Services
    systemctl --type=service
    UNIT LOAD ACTIVE SUB DESCRIPTION
    cronie.service loaded active running Periodic Command Scheduler
    dbus.service loaded active running D-Bus System Message Bus
    [email protected] loaded active running Getty on tty1
    kmod-static-nodes.service loaded active exited Create list of required static device nodes for the current kernel
    netctl@ovh_net_eth0.service loaded active exited A basic static ethernet connection
    sshd.service loaded active running OpenSSH Daemon
    systemd-backlight@backlight:acpi_video0.service loaded active exited Load/Save Screen Backlight Brightness of backlight:acpi_video0
    systemd-journal-flush.service loaded active exited Flush Journal to Persistent Storage
    systemd-journald.service loaded active running Journal Service
    systemd-logind.service loaded active running Login Service
    systemd-modules-load.service loaded active exited Load Kernel Modules
    systemd-random-seed.service loaded active exited Load/Save Random Seed
    systemd-remount-fs.service loaded active exited Remount Root and Kernel File Systems
    systemd-sysctl.service loaded active exited Apply Kernel Variables
    systemd-timesyncd.service loaded active running Network Time Synchronization
    systemd-tmpfiles-setup-dev.service loaded active exited Create Static Device Nodes in /dev
    systemd-tmpfiles-setup.service loaded active exited Create Volatile Files and Directories
    systemd-udev-trigger.service loaded active exited udev Coldplug all Devices
    systemd-udevd.service loaded active running udev Kernel Device Manager
    systemd-update-utmp.service loaded active exited Update UTMP about System Boot/Shutdown
    systemd-user-sessions.service loaded active exited Permit User Sessions
    systemd-vconsole-setup.service loaded active exited Setup Virtual Console
    [email protected] loaded active running User Manager for UID 1000
    UNIT LOAD ACTIVE SUB DESCRIPTION
    proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable File Formats File System Automount Point
    sys-devices-pci0000:00-0000:00:02.0-backlight-acpi_video0.device loaded active plugged /sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0
    sys-devices-pci0000:00-0000:00:1c.0-0000:01:00.0-net-eth0.device loaded active plugged 82574L Gigabit Network Connection
    sys-devices-pci0000:00-0000:00:1f.2-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda1.device loaded active plugged INTEL_SSDSA2CT040G3 1
    sys-devices-pci0000:00-0000:00:1f.2-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda2.device loaded active plugged INTEL_SSDSA2CT040G3 swap-sda2
    sys-devices-pci0000:00-0000:00:1f.2-ata1-host0-target0:0:0-0:0:0:0-block-sda.device loaded active plugged INTEL_SSDSA2CT040G3
    sys-devices-platform-serial8250-tty-ttyS2.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS2
    sys-devices-platform-serial8250-tty-ttyS3.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS3
    sys-devices-pnp0-00:08-tty-ttyS1.device loaded active plugged /sys/devices/pnp0/00:08/tty/ttyS1
    sys-devices-pnp0-00:09-tty-ttyS0.device loaded active plugged /sys/devices/pnp0/00:09/tty/ttyS0
    sys-module-configfs.device loaded active plugged /sys/module/configfs
    sys-subsystem-net-devices-eth0.device loaded active plugged 82574L Gigabit Network Connection
    -.mount loaded active mounted /
    dev-hugepages.mount loaded active mounted Huge Pages File System
    dev-mqueue.mount loaded active mounted POSIX Message Queue File System
    run-user-1000.mount loaded active mounted /run/user/1000
    sys-kernel-config.mount loaded active mounted Configuration File System
    sys-kernel-debug.mount loaded active mounted Debug File System
    tmp.mount loaded active mounted Temporary Directory
    systemd-ask-password-console.path loaded active waiting Dispatch Password Requests to Console Directory Watch
    systemd-ask-password-wall.path loaded active waiting Forward Password Requests to Wall Directory Watch
    session-c2.scope loaded active running Session c2 of user concopa
    cronie.service loaded active running Periodic Command Scheduler
    dbus.service loaded active running D-Bus System Message Bus
    [email protected] loaded active running Getty on tty1
    kmod-static-nodes.service loaded active exited Create list of required static device nodes for the current kern
    netctl@ovh_net_eth0.service loaded active exited A basic static ethernet connection
    sshd.service loaded active running OpenSSH Daemon
    systemd-backlight@backlight:acpi_video0.service loaded active exited Load/Save Screen Backlight Brightness of backlight:acpi_video0
    systemd-journal-flush.service loaded active exited Flush Journal to Persistent Storage
    systemd-journald.service loaded active running Journal Service
    systemd-logind.service loaded active running Login Service
    systemd-modules-load.service loaded active exited Load Kernel Modules
    systemd-random-seed.service loaded active exited Load/Save Random Seed
    systemd-remount-fs.service loaded active exited Remount Root and Kernel File Systems
    systemd-sysctl.service loaded active exited Apply Kernel Variables
    systemd-timesyncd.service loaded active running Network Time Synchronization
    systemd-tmpfiles-setup-dev.service loaded active exited Create Static Device Nodes in /dev
    systemd-tmpfiles-setup.service loaded active exited Create Volatile Files and Directories
    systemd-udev-trigger.service loaded active exited udev Coldplug all Devices
    systemd-udevd.service loaded active running udev Kernel Device Manager
    systemd-update-utmp.service loaded active exited Update UTMP about System Boot/Shutdown
    systemd-user-sessions.service loaded active exited Permit User Sessions
    systemd-vconsole-setup.service loaded active exited Setup Virtual Console
    [email protected] loaded active running User Manager for UID 1000
    -.slice loaded active active Root Slice
    system-getty.slice loaded active active system-getty.slice
    system-netctl.slice loaded active active system-netctl.slice

    I tried adding "Requires=" still not working as planned. OVH dedicated box that had networking installed out of the box. I wonder if I need to do some tweaking there.  I just looked at boot log and services are starting before the network is up. Removed some lines to make it more readable. Dec 29 15:35:52 systemd[254]: Starting autodl screen irssi... is what I need to wait for network to be up before starting.
    Dec 29 15:35:52 systemd[254]: pam_unix(systemd-user:session): session opened for user by (uid=0)
    Dec 29 15:35:52 systemd[254]: Starting Paths.
    Dec 29 15:35:52 systemd[254]: Reached target Paths.
    Dec 29 15:35:52 systemd[254]: Starting Timers.
    Dec 29 15:35:52 systemd[254]: Reached target Timers.
    Dec 29 15:35:52 systemd[254]: Starting -.slice.
    Dec 29 15:35:52 systemd[254]: Created slice -.slice.
    Dec 29 15:35:52 systemd[254]: Starting Sockets.
    Dec 29 15:35:52 systemd[254]: Reached target Sockets.
    Dec 29 15:35:52 systemd[254]: Starting Basic System.
    Dec 29 15:35:52 systemd[254]: Reached target Basic System.
    Dec 29 15:35:52 systemd[254]: Starting autodl screen irssi...
    Dec 29 15:35:52 systemd[254]: Started autodl screen irssi.
    Dec 29 15:35:52 systemd[254]: Starting Default.
    Dec 29 15:35:52 systemd[254]: Reached target Default.
    Dec 29 15:35:52 systemd[254]: Startup finished in 156ms.
    Dec 29 15:35:57 network[294]: Starting network profile 'ovh_net_eth0'...
    Dec 29 15:35:57 kernel: IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    Dec 29 15:35:58 kernel: e1000e: eth0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: None
    Dec 29 15:35:58 kernel: e1000e 0000:01:00.0 eth0: 10/100 speed: disabling TSO
    Dec 29 15:35:58 kernel: IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    Dec 29 15:36:00 network[294]: Started network profile 'ovh_net_eth0'

  • Start systemd service only after br0 receives IP address?

    I have a fairly complex setup involving  br0, hostapd service and a VM managing DHCP for br0.
    br0 receives IP from a pfSense running in a VM, but it takes some time before VM boots and assigns IP to br0 once the host system has started.
    The hostapd service must start only after the IP has been assigned to br0, otherwise it will not work properly. Therefore, I am looking for a way to start it only after that IP has been assigned.
    I cannot use something like
    After=network.target
    because it would make it start way to early.
    Any ideas welcome.

    tomk wrote:Try 'network-online.target', works here for mounting my NFS shares after the network comes up.
    This won't help because AFAIK it will start it as soon as eth0 gets an IP, which is about 1 minute earlier than br0 getting an IP.

  • Getting sasc-ng to work properly with systemd service files [SOLVED]

    This thread is intended for getting the following AUR packages to work with each other with systemd service scripts:
    https://aur.archlinux.org/packages/open-sasc-ng-dkms/
    https://aur.archlinux.org/packages/open-sasc-ng/
    https://aur.archlinux.org/packages/oscam-svn/   (this is a related package as it must properly execute prior to sasc-ng)
    So my server is now on a fresh Arch install with systemd. All is well (& very fast) except I cannot get sasc-ng to function with systemd service init files. Prior to systemd the system worked fine with the rc initscripts & was very stable with the following setup:
    rc.local
    /etc/rc.d/oscam start
    sleep 15
    /etc/rc.d/sasc-ng start
    sleep 4
    /etc/rc.d/mythbackend start
    /etc/conf.d/sasc-ng.conf
    SASCNG_ARGS="-j 0:3 -j 1:4 -j 2:5" -b 16M --sid-allpid --sid-nocache --cam-budget"
    DVBLOOPBACK_ARGS="num_adapters=3"
    LOGDIR="/home/mythtv/logs/"
    CAMDIR="/etc/camdir"
    /etc/camdir/cardclient.conf
    camd35:localhost:15050:1/0000/0000:mythtv:mythtv
    I'll leave out the oscam stuff as that loads fine and doesn't appear to be a part of the problem
    I've tried this with the systemd service file that comes with the open-sasc-ng-dkms package and when it was not sucessful I tried a bunch of variants including using "Type=simple" ect. "Type=Forked" seems to be only option that actually tries to start the processes. I also "hardcoded" the service files for the 2 sasc-ng components to find a few issues with the EnvironmentFile variables. The log variable has been removed for now as this seems to cause a fatal error but the rest of the variables load fine now. I also tested spliting up the DVB loopback module from the sasc-ng binary but this also gives similar results as the following script stands now. Running them manually with systemctl start commands doesn't make a difference but that is not surprising. The service file I'm fiddling with now which I feel has the best potential become working is:
    sasc-ng.service
    [Unit]
    Description=Sasc-ng
    After=oscam.service
    [Service]
    Type=forking
    EnvironmentFile=/etc/conf.d/sasc-ng
    ExecStartPre=/sbin/modprobe dvbloopback $DVBLOOPBACK_ARGS
    TimeoutSec=2
    ExecStart=/usr/sbin/sasc-ng -D $SASCNG_ARGS --cam-dir=$CAMDIR
    TimeoutSec=4
    [Install]
    WantedBy=multi-user.target
    Mythbackend always runs fine (even without DTV via sasc-ng) with the following mythbackend.service:
    [Unit]
    Description=MythTV_backend
    After=sasc-ng.service
    [Service]
    Type=simple
    Environment=MYTHCONFDIR=/etc/conf.d/mythbackend
    Environment=HOME=/usr/share/mythtv
    User=mythtv
    ExecStart=/usr/bin/mythbackend --logpath /var/log/mythtv
    [Install]
    WantedBy=multi-user.target
    oscam.service taken mostly from AUR package also seems fine. I added the TimeoutSec=15 to give time for oscam to load the SC and client protocol before moving on or else sasc-ng fails
    Unit]
    Description=An Open Source Conditional Access Module software
    After=network.target
    [Service]
    Type=forking
    EnvironmentFile=/etc/conf.d/oscam
    ExecStart=/usr/bin/oscam $OSCAM_ARGS
    TimeoutSec=15
    [Install]
    WantedBy=multi-user.target
    Below is the output of the systemctl status commands. Despite the noise in the sasc-ng binary status, it is the loopback module that is " inactive (dead)" and there are no virtual DVB devices being created:
    [mythtv@server ~]$ sudo systemctl status oscam.service
    oscam.service - An Open Source Conditional Access Module software
    Loaded: loaded (/usr/lib/systemd/system/oscam.service; enabled)
    Active: active (running) since Tue, 2012-11-27 21:10:17 CET; 1min 7s ago
    Process: 338 ExecStart=/usr/bin/oscam $OSCAM_ARGS (code=exited, status=0/SUCCESS)
    Main PID: 377 (oscam)
    CGroup: name=systemd:/system/oscam.service
    ├ 377 /usr/bin/oscam -b -c /etc/oscam
    └ 378 /usr/bin/oscam -b -c /etc/oscam
    Nov 27 21:10:17 server systemd[1]: Started An Open Source Conditional Acces...e.
    [mythtv@server ~]$ sudo systemctl status loopback.service
    loopback.service - Sasc-ng DVB Loopback Module
    Loaded: loaded (/etc/systemd/system/loopback.service; enabled)
    Active: inactive (dead) since Tue, 2012-11-27 21:10:28 CET; 1min 27s ago
    Process: 907 ExecStart=/sbin/modprobe dvbloopback num_adapters=3 (code=exited, status=0/SUCCESS)
    CGroup: name=systemd:/system/loopback.service
    Nov 27 21:10:28 server systemd[1]: Started Sasc-ng DVB Loopback Module.
    [mythtv@server ~]$ sudo systemctl status sasc-ng.service
    sasc-ng.service - Sasc-ng
    Loaded: loaded (/etc/systemd/system/sasc-ng.service; enabled)
    Active: failed (Result: exit-code) since Tue, 2012-11-27 21:10:47 CET; 1min 45s ago
    Process: 913 ExecStart=/usr/sbin/sasc-ng -D -j 0:3 -j 1:4 -j 2:5" -b 16M --sid-allpid --sid-nocache --cam-budget --cam-dir=/etc/camdir -l /home/mythtv/logs/sasc-ng.log (code=exited, status=0/SUCCESS)
    Main PID: 921 (code=exited, status=255)
    CGroup: name=systemd:/system/sasc-ng.service
    Nov 27 21:10:39 server sasc-ng[921]: [921] [general.error] failed open /etc...ry
    Nov 27 21:10:40 server sasc-ng[921]: [921] [general.error] failed open /etc...ry
    Nov 27 21:10:40 server sasc-ng[921]: [921] [general.error] failed open /etc...ry
    Nov 27 21:10:40 server sasc-ng[921]: [921] [general.info] loading cardclien...nf
    Nov 27 21:10:42 server sasc-ng[921]: [1062] Netwatcher thread started (pid=...6)
    Nov 27 21:10:42 server sasc-ng[921]: [921] [general.error] no keys loaded f...m!
    Nov 27 21:10:46 server sasc-ng[921]: [1098] SC housekeeper thread started (...2)
    Nov 27 21:10:47 server sasc-ng[921]: [1062] Netwatcher thread ended (pid=92...6)
    Nov 27 21:10:47 server systemd[1]: sasc-ng.service: main process exited, co.../a
    Nov 27 21:10:47 server systemd[1]: Unit sasc-ng.service entered failed state
    [mythtv@server ~]$ sudo systemctl status sasc-ng.service
    sasc-ng.service - Sasc-ng
    Loaded: loaded (/etc/systemd/system/sasc-ng.service; enabled)
    Active: failed (Result: exit-code) since Tue, 2012-11-27 21:10:47 CET; 2min 9s ago
    Process: 913 ExecStart=/usr/sbin/sasc-ng -D -j 0:3 -j 1:4 -j 2:5" -b 16M --sid-allpid --sid-nocache --cam-budget --cam-dir=/etc/camdir -l /home/mythtv/logs/sasc-ng.log (code=exited, status=0/SUCCESS)
    Main PID: 921 (code=exited, status=255)
    CGroup: name=systemd:/system/sasc-ng.service
    Nov 27 21:10:39 server sasc-ng[921]: [921] [general.error] failed open /etc/camdir/smartcard.conf: No such file or directory
    Nov 27 21:10:40 server sasc-ng[921]: [921] [general.error] failed open /etc/camdir/cardslot.conf: No such file or directory
    Nov 27 21:10:40 server sasc-ng[921]: [921] [general.error] failed open /etc/camdir/SoftCam.Key: No such file or directory
    Nov 27 21:10:40 server sasc-ng[921]: [921] [general.info] loading cardclient config from /etc/camdir/cardclient.conf
    Nov 27 21:10:42 server sasc-ng[921]: [1062] Netwatcher thread started (pid=921, tid=140074379712256)
    Nov 27 21:10:42 server sasc-ng[921]: [921] [general.error] no keys loaded for softcam!
    Nov 27 21:10:46 server sasc-ng[921]: [1098] SC housekeeper thread started (pid=921, tid=140074371319552)
    Nov 27 21:10:47 server sasc-ng[921]: [1062] Netwatcher thread ended (pid=921, tid=140074379712256)
    Nov 27 21:10:47 server systemd[1]: sasc-ng.service: main process exited, code=exited, status=255/n/a
    Nov 27 21:10:47 server systemd[1]: Unit sasc-ng.service entered failed state
    [mythtv@server ~]$
    Any ideas?
    Last edited by wdirksen (2012-12-10 19:54:43)

    After some head scratching it seems to be all good now. Considering there have been no replies to this I've come to wonder if I might be the only one with this issue. I could get it working somewhat using service files but never ideal, ex. sasc-ng only using a few of the entitlements from oscam because it started too quick etc. Anyway this might help a few and I'm hoping the linux savvy who find what I'm writing here painfully newbie like or flawed will reply and educate me a bit if what's provided here needs some sharpening up:
    1) Systemd was confusing the sasc-ng binary shorthand arguments with Linux init arguments and a few were misinterpreted if they were not nested into the environment specifiers. So the -l (log) was causing problems and -b (buffer) wasn't loading. To be safe I'm using only the sasc-ng longhand specifiers from now on (two "--" and more verbose) so that they can never be confused even if safely nested in an environment parameter. That means that /etc/conf.d/sasc-ng will also need to be changed to reflect this. I also decided to simplify the LOGFILE parameter to include the whole argument syntax.
    2) Oscam.service needs to be initiated with oneshot and RemainAfterExit=yes to make sure the delay (15 seconds in my config) gets counted out before sasc-ng initiates.
    [EDIT 12/12/2012: Initially I had a second TimeoutSec=2 after ExecStart in sasc-ng.service but this had no function. Turns out that it almost always does work without this delay but not always with my setup. Adding TimeoutSec=2 to mythbackend.service prior to ExecStart command does function and makes things init more consistant]
    sasc-ng.service
    [Unit]
    Description=Sasc-ng
    After=oscam.service
    [Service]
    Type=simple
    EnvironmentFile=/etc/conf.d/sasc-ng
    ExecStartPre=/sbin/modprobe dvbloopback $DVBLOOPBACK_ARGS
    TimeoutSec=2
    ExecStart=/usr/sbin/sasc-ng $SASCNG_ARGS --cam-dir $CAMDIR --log $LOGFILE
    [Install]
    WantedBy=multi-user.target
    /etc/conf.d/sasc-ng
    SASCNG_ARGS="--join 0:3 --join 1:4 --join 2:5 --buffer 16M --sid-allpid --sid-nocache --cam-budget"
    DVBLOOPBACK_ARGS="num_adapters=3"
    LOGFILE="/home/mythtv/logs/sasc-ng.log"
    CAMDIR="/etc/camdir"
    oscam.service
    [Unit]
    Description=An Open Source Conditional Access Module software
    After=network.target
    [Service]
    Type=oneshot
    EnvironmentFile=/etc/conf.d/oscam
    ExecStart=/usr/bin/oscam $OSCAM_ARGS
    TimeoutSec=15
    RemainAfterExit=yes
    [Install]
    WantedBy=multi-user.target
    mythbackend.service
    [Unit]
    Description=MythTV_backend
    After=sasc-ng.service
    [Service]
    Type=simple
    TimeoutSec=2
    Environment=MYTHCONFDIR=/etc/conf.d/mythbackend
    Environment=HOME=/usr/share/mythtv
    User=mythtv
    ExecStart=/usr/bin/mythbackend --logpath /var/log/mythtv
    [Install]
    WantedBy=multi-user.target
    I will make the related changes to the open-sasc-ng AUR package which I currently maintain
    Last edited by wdirksen (2012-12-23 14:40:43)

  • [SOLVED] systemd service not starting

    Hi,
    Been using Arch for just over a week now moving from Ubuntu and loving it. Achieved so much more on Arch in this short time until this evening.
    I am trying to run a shell script at startup. I added the service file under /etc/systemd/system/myapp.service
    With the following content:
    [Unit]
    Description=Notification
    [Service]
    ExecStart=/usr/bin/myscript
    [Install]
    WantedBy=multi-user.target
    As it is I can run "systemctl restart myapp.service" and the script execute flawlessly however on reboot it does nothing and I get this error when I run systemctl status myapp.service:
    systemctl status myapp.service
    myapp.service - Notification
       Loaded: loaded (/etc/systemd/system/myapp.service; enabled)
       Active: failed (Result: exit-code) since Thu 1970-01-01 10:00:08 EST; 14s ago
      Process: 116 ExecStart=/usr/bin/myscript (code=exited, status=6)
    Other info:
    Script starts with #!/bin/sh
    Script permissions 755
    Tried adding After=network.target under unit.
    Tried Type=oneshot and forking
    O yes /var/log/messages.log | grep myapp
    Sep  6 14:25:56 alarm systemd[1]: [/etc/systemd/system/myapp.service:1] Unknown section 'unit'. Ignoring.
    Sep  6 14:25:56 alarm systemd[1]: [/etc/systemd/system/myapp.service:2] Assignment outside of section. Ignoring.
    Jan  1 01:00:11 alarm systemd[1]: myapp.service: main process exited, code=exited, status=6/NOTCONFIGURED
    Jan  1 01:00:11 alarm systemd[1]: Unit myapp.service entered failed state.
    Jan  1 01:00:11 alarm [    3.243318] systemd[1]: [/etc/systemd/system/myapp.service:1] Unknown section 'unit'. Ignoring.
    Jan  1 01:00:11 alarm [    3.243490] systemd[1]: [/etc/systemd/system/myapp.service:2] Assignment outside of section. Ignoring.
    Only thing I dont get is the date difference? I have set the timezone correctly..
    Any suggestions?
    thanks
    Last edited by blueteq (2013-09-10 10:01:11)

    Reaching the network.target does not necessarily mean that an active connection has been reached.  For example, if you use wicd or netctl-auto, it will report the stating of the service as successful after the daemon itself has started, but starting the daemon simply means that it is ready to start scanning for wireless networks and then connect.
    If you want to be absolutely sure that there is a network connection before the service starts, you should use NetworkManager.service.  That will also pull in the NetworkManager-wait-online.service which will not complete until a full connection has been reached.  At that point the startup will have reached the network-online.target.  So you should order the service after that instead.  In reality, you should order it after that anyway, no matter what netowrk connection service you use, as that is a built in target to systemd.
    Even though you have the RestartSec=35 and Restart=on-failure (which is a sane thing to do IMO), it is probably a good idea to order it After=netowrk-online.target anyway, as that will cause the service to start a bit later and at least attempt to order itself correctly.  That way it will also ensure that the service is stopped before the network is taken down as well, hopefully ensuring a clean disconnect as well.

  • Systemd service failing on boot

    Hello, im new to Arch and systemd
    When I boot my computer the sabnzbd service fails to start, but if i start it manually afterwards it works fine.
    I can make it work by adding a 'sleep 10' to the .service file but that seems like a hack and I'd like to learn the correct way.
    It seems as though the sabnzbd.service is starting before the /run tmpfs partition has been mounted but I dont know. 
    I'm hoping someone smarter than me knows the answer to this
    Thanks
    Dave
    Below is the messages.log
    Oct 24 19:58:35 winter systemd[1]: PID file /run/sabnzbd/sabnzbd-8080.pid not readable (yet?) after start.
    Oct 24 19:58:36 winter systemd[1]: sabnzbd.service never wrote its PID file. Failing.
    Oct 24 19:58:36 winter systemd[1]: Unit sabnzbd.service entered failed state.
    Oct 24 19:58:36 winter systemd[1]: Starting Multi-User.
    Oct 24 19:58:36 winter systemd[1]: Reached target Multi-User.
    Oct 24 19:58:36 winter systemd[1]: Starting Graphical Interface.
    Oct 24 19:58:36 winter systemd[1]: Reached target Graphical Interface.
    Oct 24 19:58:36 winter systemd[1]: Starting Update UTMP about System Runlevel Changes...
    Oct 24 19:58:36 winter systemd[1]: Started Update UTMP about System Runlevel Changes.
    Oct 24 19:58:36 winter systemd[1]: Startup finished in 4s 330ms 255us (kernel) + 8s 66ms 514us (userspace) = 12s 396ms 769us.
    Oct 24 19:58:36 winter ifplugd[282]: Executing '/etc/ifplugd/netcfg.action eth0 up'.
    Oct 24 19:58:36 winter ifplugd[282]: client: up
    Oct 24 19:58:36 winter ifplugd[282]: client: loading ethernet-static
    Oct 24 19:58:36 winter ifplugd[282]: client: :: ethernet-static up [done]
    Oct 24 19:58:36 winter ifplugd[282]: Program executed successfully.
    sabnzbd.service:
    [Unit]
    Description=SABnzbd binary newsreader
    After=network.target
    [Service]
    EnvironmentFile=/etc/conf.d/sabnzbd_systemd
    #ExecStartPre=/usr/bin/sleep 10
    ExecStart=/bin/sh/ -c "python2 ${SABNZBD_DIR}/SABnzbd.py ${SABNZBD_ARGS} --pid /run/sabnzbd"
    ExecStop=/usr/bin/curl -f "${SABNZBD_PROTOCOL}://${SABNZBD_USPW}${SABNZBD_IP}:${SABNZBD_PORT}/sabnzbd/api?mode=shutdown&apikey=${SABNZBD_KEY}"
    Type=forking
    PIDFile=/run/sabnzbd/sabnzbd-8080.pid
    User=sabnzbd
    Group=sabnzbd
    [Install]
    WantedBy=multi-user.target

    For diagnostics try:
    # systemctl status sabnzbd.service

  • Slow start up - network.target 1min 30sec delayed

    Hope i'm in the right forum.
    I've been using Arch for 3 years now and enjoying every second.
    recently my start-up time has gone up significantly, mainly the user space:
    Startup finished in 3.295s (kernel) + 1min 31.196s (userspace) = 1min 34.491s
    there seems to be a long delay between NetworkManager.service loading (@6.954s +3.766s) and network.target loading network.target (1min 30.869s):
    # systemd-analyze critical-chain
    The time after the unit is active or started is printed after the "@" character.
    The time the unit takes to start is printed after the "+" character.
    graphical.target @1min 31.196s
    `-multi-user.target @1min 31.196s
      `-autofs.service @1min 30.905s +290ms
        `-network.target @1min 30.869s
          `-NetworkManager.service @6.954s +3.766s
            `-basic.target @6.951s
              `-timers.target @6.949s
                `-systemd-tmpfiles-clean.timer @6.949s
                  `-sysinit.target @6.946s
                    `-sys-fs-fuse-connections.mount @32.751s +1ms
                      `-systemd-modules-load.service @937ms +550ms
                        `-systemd-journald.socket @869ms
                          `--.mount @867ms
                            `-system.slice @1.478s
                              `--.slice @963ms
    any idea what can i do to re-sequence the services so the startup does not take so much time?

    With systemd you dont need to "re-sequence" anything cause is booting psedo-parallel.
    You need to identify the service (or services) that slow you down.
    Try adding debug on your kernel parameter boot loader (remove quiet) and see with journactl -b for errors in booting services.

  • [SOLVED]Correct way to restart a systemd service on resume from susp?

    I have offlineimap setup to run as a daemon. It doesn't correctly resume operations after a resume from suspend to RAM without being restarted. The 'Conflicts=' line in the service file makes sure it is stopped when the machine suspends, but I can't figure out how to get it restarted again. Here is the service file:
    [Unit]
    Description=Start offlineimap as a daemon
    Requires=network.target
    Conflicts=suspend.target
    After=network.target
    [Service]
    User=%i
    EnvironmentFile=/home/%i/.gnupg/gpg-agent-info
    ExecStart=/usr/bin/offlineimap
    KillSignal=SIGUSR2
    Restart=always
    RestartSec=15
    [Install]
    WantedBy=multi-user.target
    I found an email thread here that seemed to imply that I could add sleep.target to 'WantedBy=' and sleep.target to 'After=' to get service to startup again after resume, but that didn't seem to work.
    Any ideas? Thanks!
    Scott
    Last edited by firecat53 (2014-07-01 16:40:20)

    tomk wrote:
    firecat53 wrote:It doesn't correctly resume operations after a resume from suspend to RAM without being restarted.
    Is this just something you have observed on your own system, or is it a known bug?
    Something I noticed and figured it was just due to frequently switching networks with VPN on/off again. After a quick search, I discovered the 'socktimeout' option, which I'm testing now to see if that solves the problem. It appears (although I _just_  found this, that it is a known bug. Some have had luck with setting socktimeout, others haven't. I'll post back if I see a difference or not.
    Thanks for the nudge
    Scott

  • Systemd service delay

    I'm trying have the following sequence occur on startup:
    1) Load dvb_hdhomerun module
    2) Wait for networking
    3) Start userhdhomerun.service
    4) Wait for userhdhomerun to find network devices
    5) Start tvheadend.service
    If I manually start the two services after reboot, everything works fine.
    If I enable userhdhomerun.service, it has to restart itself several times before succeeding (I had to increase the RestartSec to 5):
    Aug 10 09:41:15 xbmc systemd-modules-load[96]: Inserted module 'dvb_hdhomerun'
    Aug 10 09:41:16 xbmc systemd[1]: userhdhomerun.service: main process exited, code=exited, status=255/n/a
    Aug 10 09:41:16 xbmc systemd[1]: Unit userhdhomerun.service entered failed state.
    Aug 10 09:41:21 xbmc systemd[1]: userhdhomerun.service holdoff time over, scheduling restart.
    Aug 10 09:41:22 xbmc systemd[1]: userhdhomerun.service: main process exited, code=exited, status=255/n/a
    Aug 10 09:41:22 xbmc systemd[1]: Unit userhdhomerun.service entered failed state.
    Aug 10 09:41:27 xbmc systemd[1]: userhdhomerun.service holdoff time over, scheduling restart.
    Aug 10 09:41:28 xbmc kernel: hdhomerun: userhdhomerun connected
    Aug 10 09:41:28 xbmc kernel: hdhomerun: userhdhomerun connected
    I think this is related to the network not being ready? userhdhomerun needs to find a device on the LAN to work correctly
    Now if I also enable tvheadend, it restarts with userhdhomerun, but it finishes before userhdhomerun discovers the device on the LAN.
    Relevant service files:
    [Unit]
    Description=Userspace daemon of the HDHomerun DVB driver
    After=network.target
    [Service]
    ExecStart=/usr/bin/userhdhomerun -d
    Restart=always
    RestartSec=5
    [Install]
    WantedBy=multi-user.target
    [Unit]
    Description=tvheadend
    After=tmp.mount network.target userhdhomerun.service
    Requires=userhdhomerun.service
    [Service]
    Type=forking
    PIDFile=/run/tvheadend.pid
    ExecStart=/usr/bin/tvheadend -f -p /run/tvheadend.pid -C -u hts -g video
    ExecStop=/usr/bin/rm /run/tvheadend.pid
    Restart=always
    RestartSec=5
    [Install]
    WantedBy=multi-user.target
    Is there a way to really delay the start of userhdhomerun.service until after the network is really operational?
    Is there a way to delay the start of tvheadend.service until userhdhomerun has had a chance to discover devices on the netowork?

    Here is a full dump of journalctl -b : http://pastebin.com/wxMAWk8v
    and here is an annotated version:
    Aug 10 09:41:15 #######booting
    Aug 10 09:41:15 #######dvb_hdhomerun module added
    Aug 10 09:41:15 xbmc kernel: HDHomeRun: Begin init, version 0.0.16
    Aug 10 09:41:15 xbmc kernel: HDHomeRun: Waiting for userspace to connect
    Aug 10 09:41:15 xbmc kernel: HDHomeRun: End init
    Aug 10 09:41:15 xbmc systemd-modules-load[96]: Inserted module 'dvb_hdhomerun'
    Aug 10 09:41:15 xbmc systemd[1]: Started dhcpcd on all interfaces.
    Aug 10 09:41:15 xbmc systemd[1]: Starting Network.
    Aug 10 09:41:15 xbmc systemd[1]: Reached target Network.
    Aug 10 09:41:15 ########userhdhomerun starts immediately after dhcpcd service starts? this could be my problem
    Aug 10 09:41:15 xbmc systemd[1]: Starting Userspace daemon of the HDHomerun DVB driver...
    Aug 10 09:41:15 xbmc systemd[1]: Started Userspace daemon of the HDHomerun DVB driver.
    Aug 10 09:41:15 ########tvheadend starts directly after userhdhomerun.service? this could be my problem
    Aug 10 09:41:15 xbmc systemd[1]: Starting tvheadend...
    Aug 10 09:41:15 xbmc systemd[1]: Started tvheadend.
    Aug 10 09:41:15 ########userhdhomerun fails, maybe because i don't have an IP address yet
    Aug 10 09:41:16 xbmc systemd[1]: userhdhomerun.service: main process exited, code=exited, status=255/n/a
    Aug 10 09:41:16 xbmc systemd[1]: Unit userhdhomerun.service entered failed state.
    Aug 10 09:41:15 ########userhdhomerun restarts, tvheadend restarts
    Aug 10 09:41:21 xbmc systemd[1]: userhdhomerun.service holdoff time over, scheduling restart.
    Aug 10 09:41:21 xbmc systemd[1]: Stopping tvheadend...
    Aug 10 09:41:22 xbmc systemd[1]: Starting tvheadend...
    Aug 10 09:41:22 xbmc systemd[1]: Started tvheadend.
    Aug 10 09:41:22 ########userhdhomerun fails again
    Aug 10 09:41:22 xbmc systemd[1]: userhdhomerun.service: main process exited, code=exited, status=255/n/a
    Aug 10 09:41:22 xbmc systemd[1]: Unit userhdhomerun.service entered failed state.
    Aug 10 09:41:26 ###finally got IP
    Aug 10 09:41:26 xbmc dhcpcd[188]: enp2s0: leased 10.10.1.22 for 86400 seconds
    Aug 10 09:41:26 xbmc dhcpcd[188]: enp2s0: adding host route to 10.10.1.22 via 127.0.0.1
    Aug 10 09:41:26 xbmc dhcpcd[188]: enp2s0: adding route to 10.10.1.0/24
    Aug 10 09:41:26 xbmc dhcpcd[188]: enp2s0: adding default route via 10.10.1.1
    Aug 10 09:41:27 ########userhdhomerun restarts, tvheadend restarts
    Aug 10 09:41:27 xbmc systemd[1]: userhdhomerun.service holdoff time over, scheduling restart.
    Aug 10 09:41:27 xbmc systemd[1]: Stopping tvheadend...
    Aug 10 09:41:28 xbmc systemd[1]: Starting tvheadend...
    Aug 10 09:41:28 xbmc systemd[1]: Started tvheadend.
    Aug 10 09:41:28 ########tvheadend completely executes, before DVB devices are created
    Aug 10 09:41:28 ########hdhomerun finally finds the network device
    Aug 10 09:41:28 xbmc kernel: hdhomerun: userhdhomerun connected
    Aug 10 09:41:28 xbmc kernel: hdhomerun: userhdhomerun connected
    Aug 10 09:41:28 xbmc kernel: hdhomerun: creating dvb device for 103BABA3-0
    Aug 10 09:41:28 xbmc kernel: DVB: registering new adapter (HDHomeRun)
    Aug 10 09:41:28 xbmc kernel: HDHomeRun HDHomeRun.0: DVB: registering adapter 0 frontend 0 (HDHomeRun ATSC)...
    Aug 10 09:41:28 xbmc kernel: HDHomeRun0: DVB Frontend registered
    Aug 10 09:41:28 xbmc kernel: HDHomeRun0: Registered DVB adapter0
    Aug 10 09:41:28 xbmc kernel: hdhomerun: device /dev/hdhomerun_data0 created
    Aug 10 09:41:28 xbmc kernel: hdhomerun: userhdhomerun connected

  • [SOLVED] Help with systemd .service script

    Hello,
    I have been using ArchLinux (ARM version) on some “plug computers” for over a year and love it.  Recently I forced myself to move to systemd by upgrading all my computers from scratch.  I migrated all my applications and learned new ways of doing things but am having trouble with one last migration.  I run a c++ communication program that monitors a TCP port for traffic.  In the past I started this program (daemon) from an entry in rc.conf.  I have read all I can about systemd’s new approach to starting daemons (https://wiki.archlinux.org/index.php/Systemd and https://wiki.archlinux.org/index.php/Systemd/Services)
    So far I created what I thought is the correct systemd .service file listed below.
    [Unit]
    Description=EQBCS
    After=network.target
    [Service]
    Type=simple
    ExecStart=/home/public/EQBCS/eqbcs -p 12947 -d &> /dev/null
    [Install]
    WantedBy=multi-user.target
    I put this file in /usr/lib/systemd/system/eqbcs.service.  I then ran the following commands in the following order:
    systemctl daemon-reload
    systemctl enable eqbcs.service (created a link in /etc/systemd/system/multi-user.target.wants)
    systemctl start eqbcs.service
    Here is output from systemctl (status)
    eqbcs.service                                 loaded failed failed    EQBCS
    I thought this would start the service but no luck.  I also thought maybe a reboot would work but no luck.  I verified I can start the daemon manually if I run /home/public/EQBCS/eqbcs -p 12947 -d &> /dev/null from the command line.
    I think I am close, but after several hours of looking at examples of .service files and other posts, I am at a loss.  I am not one of those types who posts a question without taking the time to read the wealth of information on these boards, but I am truly out of ideas and can’t figure out what to do next.  I sincerely could use some help/advice.
    Last edited by calzon65 (2013-06-01 21:18:20)

    Thank you for the suggestions, I believe I am getting closer to success. When I run systemctl start eqbcs.servcie it starts the service but the only way I can get out of systemctl is to ^c out.
    Here is my current .service file:
    [Unit]
    Description=EQBCS
    After=network.target
    [Service]
    ExecStart=/home/public/EQBCS/eqbcs -p 12947
    Type=forking
    [Install]
    WantedBy=multi-user.target
    Output from systemctl status eqbcs:
    eqbcs.service - EQBCS
       Loaded: loaded (/etc/systemd/system/eqbcs.service; enabled)
       Active: failed (Result: timeout) since Sat 2013-06-01 12:48:43 PDT; 2min 11s ago
      Process: 427 ExecStart=/home/public/EQBCS/eqbcs -p 12947 (code=killed, signal=TERM)
    Main PID: 396 (code=killed, signal=KILL)
       CGroup: name=systemd:/system/eqbcs.service
    Jun 01 12:47:13 alarm systemd[1]: Starting EQBCS...
    Jun 01 12:47:13 alarm eqbcs[427]: WARNING: Running as root NOT recommended.
    Jun 01 12:47:13 alarm eqbcs[427]: EQ Box Chat Server 10.12.18
    Jun 01 12:47:13 alarm eqbcs[427]: Waiting for connections on port: 12947...
    Jun 01 12:48:43 alarm systemd[1]: eqbcs.service operation timed out. Terminating.
    Jun 01 12:48:43 alarm systemd[1]: Failed to start EQBCS.
    Jun 01 12:48:43 alarm systemd[1]: Unit eqbcs.service entered failed state.
    Are there any other suggestions for settings in my .service file?

  • Run custom systemd service before NetworkManager

    Hi, I am trying to write a systemd service that runs and completes before NetworkManager.service starts.
    I tried this:
    [Unit]
    Description=Custom service test
    Before=NetworkManager.service
    [Service]
    Type=oneshot
    ExecStart=/usr/bin/echo Custom service test 1
    ExecStart=/usr/bin/sleep 5
    ExecStart=/usr/bin/echo Custom service test 2
    [Install]
    WantedBy=network.target
    While the custom service does start, I got this rather strange output:
    Jan 22 00:12:46 localhost echo[1166]: Custom service test 1
    Jan 22 00:12:48 localhost kernel: NVRM: GPU at 0000:02:00: GPU-(snip)
    ... some unrelated messages (acpid, kdm, etc) ...
    Jan 22 00:12:49 localhost systemd-logind[1170]: Linked /tmp/.X11-unix/X0 to /run/user/1000/X11-display.
    Jan 22 00:13:13 localhost echo[1254]: Custom service test 2
    Jan 22 00:12:50 localhost systemd[1]: Started Custom service test.
    Jan 22 00:12:50 localhost systemd[1]: Starting Network Manager...
    As you can see, while everything appears in the expected order in the log, the timestamps look very wrong. The "Custom service test 2" says "00:13:13", yet it is in the middle of "00:12:49" and "00:12:50". What gives?
    Also, notice that the first echo was at 00:12:46, but NetworkManager started at 00:12:50, which is only 4 seconds later. The "sleep" in the custom services should have made it start at 00:12:51 at the earliest. I don't understand why things are not being respected.
    The output I'd expect to see is something like this:
    Jan 22 00:12:46 localhost echo[1166]: Custom service test 1
    Jan 22 00:12:51 localhost echo[1254]: Custom service test 2
    Jan 22 00:12:51 localhost systemd[1]: Started Custom service test.
    Jan 22 00:12:51 localhost systemd[1]: Starting Network Manager...
    I have also made sure that it shows up in NetworkManager.service's After list:
    $ systemctl show -p After NetworkManager.service
    After=mycustomservice.service syslog.target systemd-journald.socket dbus.socket basic.target

    falconindy wrote:Sooooo this begs the question: what are you really trying to do?
    I'm trying to write a script that changes the interface's MAC address before NetworkManager gets a chance to take over the network interface. I'm aware that there's a page about exactly that on the wiki. I started with the systemd service from the bottom of the page, which says "Before=dhcpcd@%i.service". I changed that line to use "NetworkManager.service", and I changed the ExecStart line to "/usr/bin/macchanger -A myinterface" in order to get a random MAC address, instead of setting a fixed one like the example shows. Then I saw that macchanger's output was being mixed with NetworkManager's output in the journal, so I decided to try and write a custom service just for testing, making it start before NetworkManager, in order to see if it really was systemd's fault or if it was something macchanger-specific. Then I noticed the strange behavior described in the OP, didn't really know what to do about it, so I posted this topic. That's the story so far...
    Last edited by WindPower (2013-01-23 00:13:22)

Maybe you are looking for

  • How to hide iBooks in family sharing?

    I am attempting to hide specific books from being downloaded or even being able to be seen in iBooks from family sharing.  I really don't want the kids to see the books my wife is downloading and reading, not even the title when they attempt to go in

  • Badi/user exit for sales and purchase order

    HI folks, I have to export the value of order type to a memory id for create and change transaction of sales order and the purchase order, I serached a lot for badis in purchase order and created implementation for that, but it didnt work. Please hel

  • Column display on shared librarys

    Ok I have a Mac as a Itunes server and a Mac Mini as an AV computer, great so far, however ever since one of the latter 9.x iTunes upgrades it ability to freely arrange the column's e.g. artist album track display order of the shared library has now

  • How to get information about time of triggering and entire time waveform

    I have been trying to capture a certain portion of waveform from Textronix DPO2024 using triggering in Labview. Further, I want to save the the entire triggered waveform (triggered time as one array and triggered signal amplitude as second array)  in

  • Anyway to install Suretype on a Curve?

    Would be nice technology to have... Thanks, Rob