[Solved] systemd - To fork or not to fork when writing services

Hello,
Many of the programs i write services for have the option to fork or not to fork. Or are
advertised as daemons but have the ability to not fork into the background.
I don't understand which i should choose when writing a new service unit.
When do you want a program to run in 'daemon-mode' and when don't you?
Do i lose/gain anything when i make such a choice?
Thank you.
Last edited by captaincurrie (2015-01-01 12:32:11)

falconindy wrote:
anatolik wrote:
[If you have a choice then use Type=simple for your systemd services. It is simpler and systemd will take care or proper process deamonizing, restarts and shutdowns.
Type=forking is for historical services that cannot be run in foreground. In this case process itself will take care of its deamonizing, but systemd should know the child pid somehow so you need to provide PIDFile= option as well.
Historical or not, Type=forking is necessary if you need to be able to order other services on the Type=forking service. Type determines the readiness protocol used by systemd. In the case of Type=simple, there is no protocol. systemd assumes that as soon as the binary is exec'd, the service is available. For Type=forking, services are considered ready after the MainPID exits (after the double fork), allowing for time to setup sockets or other resources needed to handle client requests (e.g. a database server or a web server). If you use the Type, you may find that dependent services fail to startup properly, as their dependencies aren't actually ready when systemd declares them to be.
Thank you, that really cleared it up for me
After your response, and re-reading the manual, it all makes sense now!

Similar Messages

  • [Solved] Systemd in user mode not working properly

    Hello.
    I wrote this Systemd service that I would like to run as normal user.
    [Unit]
    Description=Google Drive mount
    After=network-online.target
    Wants=network-online.target
    [Service]
    ExecStart=/usr/bin/google-drive-ocamlfuse -m '/home/egidio/Google Drive'
    ExecStop=/usr/bin/fusermount -u '/home/egidio/Google Drive'
    [Install]
    WantedBy=default.target
    I start it and everything seems fine, but when I try to access the mounted point, I get this error.
    [egidio@egidiolaptop user]$ ls -la ~/Google\ Drive
    ls: cannot access /home/egidio/Google Drive: Transport endpoint is not connected
    If I run the ExecStart command manually everything works perfectly.
    Can you please help me?
    Last edited by Aegidius (2015-05-13 18:17:12)

    This is the output of journalctl --all
    May 12 20:55:04 egidiolaptop /usr/lib/gdm/gdm-x-session[19552]: Activating service name='org.gnome.Terminal'
    May 12 20:55:04 egidiolaptop /usr/lib/gdm/gdm-x-session[19552]: Successfully activated service 'org.gnome.Terminal'
    May 12 20:55:26 egidiolaptop gnome-session[19563]: 1431456926458 addons.update-checker WARN Update manifest for {972ce4c6-7e08-4474-a285-3208198ce6fd} did not contain an updates property
    May 12 20:56:03 egidiolaptop systemd[19544]: [/home/egidio/.config/systemd/user/googledrive.service:2] Unknown lvalue 'Type' in section 'Unit'
    May 12 20:56:03 egidiolaptop systemd[19544]: Cannot add dependency job for unit network-online.target, ignoring: Unit network-online.target failed to load: No such file or directory.
    May 12 20:56:03 egidiolaptop systemd[19544]: Created slice -.slice.
    May 12 20:56:03 egidiolaptop systemd[19544]: Starting -.slice.
    May 12 20:56:03 egidiolaptop systemd[19544]: Started Google Drive mount.
    May 12 20:56:03 egidiolaptop systemd[19544]: Starting Google Drive mount...
    May 12 20:56:03 egidiolaptop fusermount[20547]: /usr/bin/fusermount: failed to unmount /home/egidio/Google Drive: Device or resource busy
    May 12 20:56:03 egidiolaptop systemd[19544]: googledrive.service: control process exited, code=exited status=1
    May 12 20:56:03 egidiolaptop systemd[19544]: Unit googledrive.service entered failed state.
    May 12 20:56:03 egidiolaptop systemd[19544]: googledrive.service failed.

  • [Solved] systemd-networkd netdev files not working

    I'm trying to setup a VLAN interface using networkd. I have verified the VLAN works with a manually created interface, but when I try to create an interface with networkd I just get an error.
    Jun 05 11:26:02 files systemd[1]: Starting Network Service...
    Jun 05 11:26:02 files systemd-networkd[880]: NetDev with invalid Kind configured in /etc/systemd/network/eno1.10.netdev. Ignoring
    Jun 05 11:26:02 files systemd-networkd[880]: [/etc/systemd/network/eno1.network:6] VLAN could not be found, ignoring assignment: eno1.10
    Jun 05 11:26:02 files systemd-networkd[880]: Enumeration completed
    Jun 05 11:26:02 files systemd[1]: Started Network Service.
    Jun 05 11:26:02 files systemd-networkd[880]: eno1            : link configured
    I have followed the VLAN setup in the wiki.
    /etc/systemd/network/eno1.network
    [Match]
    Name=eno1
    [Network]
    DNS=192.168.1.1
    VLAN=eno1.10
    [Address]
    Address=192.168.1.10
    [Route]
    Gateway=192.168.1.1
    /etc/systemd/network/eno1.10.netdev
    [Netdev]
    Name=eno1.10
    Kind=vlan
    [VLAN]
    Id=10
    For what it is worth I get the same error even If i just set the Netdev kind to dummy. I am not sure if netdevs are broken or if I'm missing something
    Last edited by evilhamsterman (2015-06-05 20:45:09)

    evilhamsterman wrote:That did fix it. Looks like there is a small error on the wiki then because I literally copied those files from the wiki.
    I'm glad you got this sorted, have you thought of editing the wiki so that no-one else runs into the same problem?
    Last edited by slithery (2015-06-05 21:07:19)

  • Failover Cluster in SQL 2012 in not auto switch when stop service SQL

    Good Morning to all,
    I'm Mr.Tuyen from VietNam. I have a big problem with AlwaysOn High Availabity in SQL 2012.
    I setup 3 server and join Availabilty Group. Ex: Server A (Primary), Server B (Secondary), Cluster Qourum is only node. I have test:
    1. Stop service SQL server A, immediately server B is Primary
    Start servicel SQL server A, Server A is secondary
    2. Stop service SQL server B, server is not Primary and "status is Resloving" and role cluster failed with error as belows
    [i]Clustered role 'XXX' has exceeded its failover threshold. It has exhausted the configured number of failover attempts within the failover period of time allotted to it and will be left in a failed state. No additional attempts will be made to bring the role
    online or fail it over to another node in the cluster. Please check the events associated with the failure. After the issues causing the failure are resolved the role can be brought online manually or the cluster may attempt to bring it online again after
    the restart delay period.[/i]
    or 
    The Cluster service failed to bring clustered role 'XXX' completely online or offline. One or more resources may be in a failed state. This may impact the availability of the clustered role.
    Do you have same error?

    http://blogs.msdn.com/b/sqlserverfaq/archive/2012/03/15/inf-alwayson-the-secondary-database-doesn-t-come-automatically-when-the-primary-instance-of-sql-server-goes-down.aspx
    Balmukund Lakhani
    Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
    This posting is provided "AS IS" with no warranties, and confers no rights.
    My Blog |
    Team Blog | @Twitter
    | Facebook
    Author: SQL Server 2012 AlwaysOn -
    Paperback, Kindle

  • Java Does Not Throw Exception When Writing To Read-Only Files

    I have noticed that when I try to write to a read-only file in a window environment, Java does not throw an IOExcpetion, it just dosn't write to the file.
    I am writing an FTP server and here is the code:
         public static long copyStream(InputStream in, OutputStream out)throws IOException
              IOException exception = null;
              long copied = 0;
              try
                   byte buffer[] = new byte[1024];
                   int read;
                   while((read = in.read(buffer)) != -1)
                        out.write(buffer, 0, read);
                        copied += read;
              catch(IOException e)
                   //ensures that the streams are closed.
                   exception = e;
              try
                   in.close();//ensures output stream gets closed, even if there is an
                   //excption here.
              catch(IOException e){exception = e;}
              out.close();//try to close output.
              if(exception != null)
                   //exception is not null, an exception has occured.
                   //rethrow exception.
                   throw exception;
              return copied;//all ok, return bytes copied.
         }Is this a bug in JAVA VM? Is so, how should I report it?

    I have noticed that when I try to write to a read-only file in a window environment,
    Java does not throw an IOExcpetion, it just dosn't write to the file.C:\source\java\Markov>attrib readonly.out
    A R C:\source\java\Markov\readonly.out
    �C:\source\java\Markov>java b
    java.io.FileNotFoundException: readonly.out (Access is denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at b.main(b.java:5)
    import java.io.*;
    public class b {
        public static void main(String[] args) {
         try     {
              OutputStream os = new FileOutputStream ( "readonly.out");
         catch (Exception e) {
              e.printStackTrace();
    }

  • VBAP-ANZSN not getting updated when writing serial number to order

    Hey ABAP,
    i got some Problem with serial numbers.
    We have a rental process, where user gives in serial number at time of delivery.
    Since we need to create orders based on original order, we need to take the serialnumber from the delivery and write it back to the order, so when order is copied, serial number will be copied as well.
    I use following Code to write that serial number into the order, and it works:
    code -> next post
    FYI: This coding is in a rouitine which is called by perform on commit, in an own update task function module which is beeing called in MV50AFZ1.
    So where is the Problem?
    The order gets correctly updated with the serial number which got input in the delivery.
    When looking at it through VA02 all if fine. You can see the serial number, and you also can see that there is 1 serialnumber of 1 serial numbers.
    BUT when having a look at the corresponding VBAP record for this order, VBAP-ANZSN stays empty.
    in copy routines, serialnumbers will only get copied as well if VBAP-ANZSN > 0.
    Cause if its 0 the system thinks: "yikes there are no serial numbers i got nothing to do".
    any ideas?
    Edited by: Florian Kemmer on Sep 30, 2009 12:43 PM

    DATA: lt_ser01            TYPE TABLE OF ser01,
            ls_ser01            TYPE ser01,
            lv_equnr            TYPE equnr,
            lv_sernr            TYPE sernr,
            lv_matnr            TYPE matnr,
            lt_riwol            TYPE TABLE OF riwol1,
            ls_riwol            TYPE riwol1,
            lv_vbeln            TYPE vbeln,
            lv_posnr            TYPE posnr,
            lt_serxx            TYPE TABLE OF rserxx,
            ls_serxx            TYPE rserxx,
            ls_lips             TYPE lips,
            ls_likp             TYPE likp,
            ls_vbak             TYPE vbak,
            ls_vbap             TYPE vbap.
      break fis-kemmer.
      " Lieferdaten besorgen
      SELECT SINGLE *
      FROM   likp
      INTO   CORRESPONDING FIELDS OF ls_likp
      WHERE  vbeln = gv_vbeln_vl.
      SELECT SINGLE *
      FROM   lips
      INTO   CORRESPONDING FIELDS OF ls_lips
      WHERE  vbeln = gv_vbeln_vl
      AND    posnr = gv_posnr_vl.
      " Serialnummer aus der Lieferung besorgen
      SELECT SINGLE *
      FROM   ser01
      INTO   CORRESPONDING FIELDS OF ls_ser01
      WHERE  lief_nr = gv_vbeln_vl
      AND    posnr   = gv_posnr_vl.
      SELECT SINGLE equnr
      FROM   objk
      INTO   lv_equnr
      WHERE  obknr = ls_ser01-obknr.
      SELECT SINGLE sernr
      FROM   equi
      INTO   lv_sernr
      WHERE  equnr = lv_equnr.
      CHECK NOT lv_sernr IS INITIAL.
      " Matrialnummer aus der Lieferung besorgen
      SELECT SINGLE matnr
      FROM   lips
      INTO   lv_matnr
      WHERE  vbeln = gv_vbeln_vl
      AND    posnr = gv_posnr_vl.
      CHECK NOT lv_matnr IS INITIAL.
      SELECT SINGLE vbelv posnv
      FROM   vbfa
      INTO   (lv_vbeln, lv_posnr)
      WHERE  vbeln    = gv_vbeln_vl
      AND    posnn    = gv_posnr_vl
      AND    vbtyp_v  = 'C'.
      " Auftragsdaten besorgen
      SELECT SINGLE *
      FROM   vbak
      INTO   CORRESPONDING FIELDS OF ls_vbak
      WHERE  vbeln = lv_vbeln.
      SELECT SINGLE *
      FROM   vbap
      INTO   CORRESPONDING FIELDS OF ls_vbap
      WHERE  vbeln = lv_vbeln
      AND    posnr = lv_posnr.
      ls_riwol-sernr = lv_sernr.
      ls_riwol-matnr = lv_matnr.
      APPEND ls_riwol TO lt_riwol.
      ls_serxx-anzsn      = ls_ser01-anzsn.
      ls_serxx-vbtyp      = ls_ser01-vbtyp.
      ls_serxx-sdaufnr    = lv_vbeln.
      ls_serxx-lief_nr    = gv_vbeln_vl.
      ls_serxx-posnr      = gv_posnr_vl.
      ls_serxx-kunde      = ls_likp-kunnr.
      ls_serxx-obknr      = ls_ser01-obknr.
      ls_serxx-datum      = ls_ser01-datum.
      ls_serxx-letznr     = ls_ser01-letznr.
      ls_serxx-vorgang    = ls_ser01-vorgang.
      ls_serxx-uzeit      = ls_ser01-uzeit.
      ls_serxx-vbtyp      = ls_ser01-vbtyp.
      ls_serxx-bwart      = ls_ser01-bwart.
      ls_serxx-vkorg      = ls_ser01-vkorg.
      ls_serxx-vtweg      = ls_ser01-vtweg.
      ls_serxx-spart      = ls_ser01-spart.
      ls_serxx-ltsps      = ls_ser01-ltsps.
      ls_serxx-sd_auart   = ls_vbak-auart.
      ls_serxx-sd_postyp  = ls_vbap-pstyv.
      ls_serxx-werk       = ls_vbap-werks.
      break fis-kemmer.
      APPEND ls_serxx TO lt_serxx.
      CALL FUNCTION 'IWOL_WV_ADD_OBJECTS'
        EXPORTING
          i_sdaufnr           = lv_vbeln
          i_sdposnr           = lv_posnr
          to_type             = 'SD'
        TABLES
          t_riwol1            = lt_riwol
          t_ser02             = lt_serxx
        EXCEPTIONS
          no_object_list      = 1
          entry_exists        = 2
          invalid_material    = 3
          invalid_serialnr    = 4
          invalid_equipment   = 5
          invalid_location    = 6
          invalid_assembly    = 7
          status_not_allowed  = 8
          equi_foreign_key    = 9
          equi_system_failure = 10
          customer_exit_error = 11
          OTHERS              = 12.
      IF sy-subrc = 0.
        CALL FUNCTION 'IWOL_WV_POST_OBJECT_LIST'
          EXPORTING
            i_sdaufnr      = lv_vbeln
            i_sdposnr      = lv_posnr
          EXCEPTIONS
            no_object_list = 1
            other_errors   = 2
            OTHERS         = 3.
      ENDIF.
    Edited by: Florian Kemmer on Sep 30, 2009 12:46 PM

  • [SOLVED]systemd service doesn't play sound

    I have a bash script which play via 'sox' a sound file. Something like this:
    play someFile -t alsa -q
    I set up a 'systemd --user' timer which calls this script at certain time. The timer is successfully called and the corresponding service is also successfully called and exits with SUCCESS code. The problem is that sound is not heared.
    When the service is called manually from the bash with
    systemctl start mySoundTimer.service
    the sound is played OK.
    The service file is as follows:
    [Unit]
    Description= A sound timer.
    [Service]
    Type=simple
    ExecStart=/usr/bin/bash /path/to/my/script.sh
    I tried several other combinations in ExecStart:
    ExecStart=/usr/bin/bash -c /path/to/my/script.sh
    ExecStart=/usr/bin/bash "-c /path/to/my/script.sh"
    ExecStart=/usr/bin/bash -c "/path/to/my/script.sh"
    No one is working. What can be the cause of the problem?
    EDIT:
    The cause of this is a different timing behaviour of systemd timer as compared to cron which I used before. (It seemingly takes into account the time of the last run and does not run again if it is called in less than the interval between runs specified in the timer file. And I tested the timer by setting the system date to several seconds before the timer's planned times.)
    Last edited by nbd (2014-08-05 20:23:39)

    msthev wrote:$ man systemd.service
    ExecStart=
    Note that this setting does not directly support shell command
    lines. If shell command lines are to be used they need to be passed
    explicitly to a shell implementation of some kind. Example:
    ExecStart=/bin/sh -c 'dmesg | tac'
    Thanks, changing ExecStart line to
    ExecStart=/bin/bash -c '/bin/echo 100 > /sys/class/backlight/intel_backlight/brightness'
    solved the issue. Though I can recall seeing ExecStart lines with direct shell commands.
    Raynman wrote:
    You should look at tmpfiles.d.
    https://wiki.archlinux.org/index.php/Sy … rary_files
    I'll do that, thanks!

  • [SOLVED] systemd adsl service does not start

    After the today's upgrade of my system I get lines like this in my journal, as the adsl service does not want to start.
    # router systemd[522]: Failed at step EXEC spawning /usr/sbin/pppoe-start: No such file or directory
    The problem is, that pppoe-start is in /usr/bin/ and not in /usr/sbin. According to pacman (pacman-Ql rp-pppoe) /usr/bin/ is the correct location.
    I really don't know, why systemd is trying to launch it, because even the service file (/usr/lib/systemd/system/adsl.service) points to the correct location.
    [Unit]
    Description=ADSL Deamon
    [Service]
    Type=forking
    ExecStart=/usr/bin/pppoe-start
    ExecStop=/usr/bin/pppoe-stop
    [Install]
    WantedBy=multi-user.target
    The service is launching and stopping with pppoe-start and pppoe-stop.
    When launched, it also shuts down fine when stopping it by
    systemctl stop adsl
    Why the hell is it trying to launch from /usr/sbin/?
    Last edited by scar (2013-06-04 13:07:23)

    It goes definitely against any logic.
    The service file looks good, but I've copied it to /usr/lib/systemd/system/bdsl.service. Same contents - and the new one launches succesfully.
    I've deleted the original ...adsl.service file, verified that it disappeared, copied it back from the new bdsl.service file, and it still does not launch.
    [EDIT]
    I've erased the drive, restored the system from a 1 week old backup, started it - everything worked. Then I'v updated the whole system, including the rp-pppoe package, and the adsl service is failing again.
    Downgrading solves the problem. Should I file a bug report?
    Last edited by scar (2013-06-01 10:14:41)

  • [Solved] systemd does not wait for the unit to finish

    My problem is described in the title. I have made a test by enabling the following unit:
    [Unit]
    Description=/etc/rc.local Compatibility
    [Service]
    Type=forking
    ExecStart=/bin/sleep 1000
    TimeoutSec=0
    RemainAfterExit=yes
    After=network.target
    [Install]
    WantedBy=multi-user.target
    The unit is well started (a process sleep 1000 exists). But with a type=forking, systemd is supposed to hang in this case. Instead, the graphical.target is launched, systemctl list-units mention it as dead, but the display manager is started before the sleep 1000 completes. Ho can I force systemd to wait?
    Last edited by olive (2015-03-16 16:49:34)

    olive, now you're making even less sense. I didn't say the sleep example was stupid and I didn't question your reasons for doing/wanting this.
    I suggested you add "Before=display-manager.service" and you respond "I added Before=graphical.target and it didn't change anything."
    I also tried to explain why systemd has no reason to delay the display-manager.service. You could have asked for further clarification, as berbae has now done. Let's try a longer explanation.
    Service startup
    Services can be started in different ways, as configured with Type=. This determines when a service is considered "started" (or when the service's start-up is considered finished). When a service reaches this state (some time after being started), units that are supposed to start After= this service will be started (and no sooner).
    With simple systemd has no further information about the start-up process. It launches whatever you specify in ExecStart and this is the main process that continues to run till the service stops. systemd assumes this type of service is started immediately. All the other types have some way for the process to indicate to systemd (either directly or indirectly) when it has finished starting.
    Actually oneshot is also a bit special and that is where RemainAfterExit comes in. For oneshot, systemd waits for the process to exit before it starts any follow-up units (and with multiple ExecStarts I assume it waits for all of them). So that automatically leads to the scheme in berbae's last post. However, with RemainAfterExit, the unit remains active even though the process has exited, so this makes it look more like "normal" service with
    begin of unit/startup ---- end of startup ------ end of unit
    This is the relevant behavior for this thread. First sleep starts, then after 1000 seconds, start-up finishes and follow-up units will be started. Then either the unit dies, or (with RemainAfterExit) it stays "active".
    The man page describes how "end of startup" is determined for each Type.
    Targets
    Targets are meant to group units together, to provide synchronization points (and replace runlevels). When you start a target, all its units will be started (in parallel if possible). The man page says:
    Unless DefaultDependencies= is set to false, target units will
           implicitly complement all configured dependencies of type Wants=,
           Requires=, RequiresOverridable= with dependencies of type After= if the
           units in question also have DefaultDependencies=true.
    This means that (by default) when a target is requested, all it units are started first. Only after all units have finished starting, the target itself will be started (and since the target doesn't do anything by itself, this startup is basically instantaneous). Without this dependency, the order between the target and its units is unspecified, so in theory the target could finish starting immediately while its units are still being started.
    Back to olive
    graphical.target has these DefaultDependencies, so it is not started until all its units (like display-manager.service) and other After= dependencies (like multi-user.target) have finished starting. Your sleep service has to be started before multi-user.target starts (again due to default target dependencies). So first display-manager and the sleep service are started and after 1000 seconds, the sleep service finishes starting and then (assuming all other dependencies were quicker) multi-user.target is started and graphical.target as well (assuming display-manager didn't need 1000 seconds).
    If you want display-manager.service after the sleep service, add a Before/After line to specify that (this was your original goal and my suggestion).
    olive wrote wrote:However, units that are parts of the graphical target are still launched before the graphical target become active. I am still unable to completely delay the starts of the graphical target before a specific unit completes.
    It should be clear now how this works. "units that are part of the graphical target" can only mean "units that are wanted/required by the graphical target" but that is basically all the units that are started when you boot your system, because multi-user.target is a part of graphical.target. And your sleep service is a part of multi-user.target, so in fact you're saying you want to delay starting the sleep service until the sleep service completes
    What you probably intended was to delay all units that are a part of graphical.target but not of multi-user.target until after the sleep service. I can't think of an easy (or even good) way to do this and this post is already too long, so I'll table that for now.

  • Can it please be an option to delete the Apple Watch app, as I will not be forking over hundreds, let alone thousands, to buy a watch

    Can it please be an option to delete the Apple Watch app, as I will not be forking over hundreds, let alone thousands, to buy a watch?

    You can tell Apple at the link below.
    http://www.apple.com/feedback/iphone.html

  • [SOLVED]systemd won't start my /etc/rc.local

    I was trying to emulate rc.local behaviour with this:
    /usr/lib/systemd/system/rc-local.service
    [Unit]
    Description=/etc/rc.local Compatibility
    ConditionPathExists=/etc/rc.local
    [Service]
    Type=forking
    ExecStart=/etc/rc.local start
    TimeoutSec=0
    StandardOutput=tty
    RemainAfterExit=yes
    SysVStartPriority=99
    [Install]
    WantedBy=multi-user.target
    and my
    /etc/rc-local
    looks like this
    modprobe -r samsung_laptop
    But it's not working. When I execute sudo systemctl status rc-local.service I get
    rc-local.service - /etc/rc.local Compatibility
    Loaded: loaded (/usr/lib/systemd/system/rc-local.service; enabled)
    Active: failed (Result: exit-code) since Fri 2013-03-29 17:54:16 CET; 5min ago
    Process: 745 ExecStart=/etc/rc.local start (code=exited, status=203/EXEC)
    Last edited by Neky (2013-03-29 18:31:39)

    Why do you have "start" as an argument to /etc/rc.local?
    Also, for what you are trying to achieve, why not simply blacklist the module in /etc/modrpobe.d?  Then it would not be loaded under any circumstances.  Also if this is out of fear of the UEFI bug, I believe that for this particular module, there has been a patch included in the latest kernels that protects this from happening by not allowing writes to the NVRAM if it is 50% full or more.

  • [SOLVED]systemd and make a camera visible GUI-wise in your filemanager

    After reading a lot about systemd in the wiki and in this forum I understand there are different opionons about systemd. Anyway, I have a adapted all the changes to rc.conf leaving out only a few daemons to start there. So why not give systemd a try? If you dont want to read the full posting I finally got it to work, basically by reading carefully and checking the suggested tests in the systemd wiki. (loginctl)
    As suggested by the wiki, I tried the systemd yesterday. Enabled via systemctl some services to "replace" my rc.conf daemons. I got what I thought everything to work, including autologin directly to my Xfce4 desktop. Everything except the digital camera.
    When starting Arch traditionally via initscripts I immediately can see the camera in the filemanager (Nautilus) when the camera is attached via USB.
    Some minutes later, after adding "init=/usr/lib/systemd/systemd" to the APPEND line in Syslinux and rebooting, my machine reboots
    fine.But when connecting the camera again it is not visible graphically.
    The camera is there because when using gphoto2 (the commandline) as root I can transfer pictures etc.
    Even if I am no happy CLI user I can handle it when necessary. Handling pictures a graphical view of them is much easier...
    As the wiki about systemd says one can try it out. I have not removed anything from the system and when starting Arch again, the initscript way, I can see the camera again in my filemanager, gthumb works again and pictures can be transferred to my machine.
    In the wiki again, this time about digital cameras
    Permission issues
    Camera devices should be granted permission using ACLs. For this to work, users need to have consolekit or systemd running and the user session must be registered with them accordingly.
    Check this using /usr/bin/ck-list-sessions to verify a value of "TRUE" should be returned for both the "active" and "is-local" fields:
    $ ck-list-sessions | grep TRUE
    active = TRUE
    is-local = TRUE
    ACL=Atlantic Container Line is what first comes into my mind. I have had some connections to transport business...I admit I had to google it to find the correct interpretation of this mumbo-jumbo.
    The wiki also gives a "hint", if this is not working try to use the obsolete camera group and edit some udev rules.
    Should not be necessary when it has worked before systemd and earlier experiences
    But what is this about "Permission issues"?  Here is my listings relative the wiki hints. All seems OK.. or why the heck are there two sessions??
    [leif@krasaki ~]$ ck-list-sessions | grep TRUE
    is-local = TRUE
    active = TRUE
    is-local = TRUE
    [leif@krasaki ~]$ ck-list-sessions
    Session1:
    unix-user = '1000'
    realname = '(null)'
    seat = 'Seat1'
    session-type = ''
    active = FALSE
    x11-display = ''
    x11-display-device = ''
    display-device = '/dev/tty1'
    remote-host-name = ''
    is-local = TRUE
    on-since = '2012-10-24T07:12:56.499847Z'
    login-session-id = '1'
    idle-since-hint = '2012-10-24T07:13:26.994037Z'
    Session2:
    unix-user = '1000'
    realname = '(null)'
    seat = 'Seat1'
    session-type = ''
    active = TRUE
    x11-display = ':0'
    x11-display-device = '/dev/tty7'
    display-device = '/dev/tty1'
    remote-host-name = ''
    is-local = TRUE
    on-since = '2012-10-24T07:13:02.361157Z'
    login-session-id = '1'
    [leif@krasaki ~]$
    As one can see, the ACTIVE values are here as the wiki says. But no camera. Those values are the same, wheter which way the machine is started. But 2 sessions??
    Further reading in the systemd wiki article and consolekit vs systemd.logind gives a clue.
    From the wiki:
    In order to check the status of your user session, you can use loginctl. To see if your user session is properly set up, check if the following command contains Active=yes. All polkit actions like suspending the system or mounting external drives with Udisks should then work automatically.
    So when started via systemd and running logintctl, it gives this surprising result. Does not matter wheter as normal user, nor as root....
    [leif@krasaki ~]$ loginctl
    SESSION UID USER SEAT
    1 1000 leif seat0
    1 sessions listed.
    [leif@krasaki ~]$ loginctl show-session 1
    Id=1
    Timestamp=Wed, 24 Oct 2012 10:57:03 +0200
    TimestampMonotonic=20040019
    DefaultControlGroup=name=systemd:/user/leif/1
    VTNr=1
    TTY=tty1
    Remote=no
    Service=login
    Leader=315
    Audit=1
    Type=tty
    Class=user
    Active=no
    State=online
    KillProcesses=no
    IdleHint=yes
    IdleSinceHint=1351069009642296
    IdleSinceHintMonotonic=6664433
    Name=leif
    [leif@krasaki ~]$
    Surprising? Should it not have been Active=Yes? So something is wrong in my settings although it had worked "before" starting using systemd..
    OK, so far. Lost? Not yet. Double check again everything and I found the culprit, my  ~/.bash_profile which had worked before seemed a bit different to what is suggested in the wiki. The old one, actually started 2 sessions, as also could be seen here above checking ck-list-sessions. That was the problem
    Using a fresh edited ~/.bash_profile as suggested here, the camera is visible graphically
    Finally, just for fun, start again the old initscipt way. Enabling daemon and so on. Still 2 sessions going on....Here it was the "/.xinitrc, which also had some old fashions and I removed the ck-launch-session from the exec line. So even here, now only 1 session..
    Anyway, now the camera is visible, both starting with initscripts, naturally also some daemons active in rc.conf and by starting with systemd.
    I rest my case and it seems systemd works with everything on my machine which is just a normal desktop used by an old man.
    Thanks for reading...

    Solved now! Boot times are as fast as posssible on my HDD I think. Only thing after uninstalling initscripst and initscripts-systemd was that locale was not set inspite of a correct /etc/locale.conf. I had to make /etc/profile.d/locale.sh with this content;
    if [ -s /etc/locale.conf ]; then
    . /etc/locale.conf
    fi
    export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE
    export LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS
    export LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION

  • [Solved] Systemd OnFailure= Clarification

    I have a service unit, B, that I want to trigger if another one, A, fails.
    The systemd.unit man page says this about OnFailure
    OnFailure=
               Lists one or more units that are activated when this unit enters the 'failed' state.
    I have this in the A.service file:
    [Unit]
    Conflicts=B.service
    Before=B.service
    OnFailure=B.service
    There is also a corresponding Conflicts and After in B.service file.
    I have tried with both B enabled and disabled, and each time I get the following error if A fails:
    Sep 05 15:08:16 SKANKY systemd[1]: Unit A.service entered failed state.
    Sep 05 15:08:16 SKANKY systemd[1]: Triggering OnFailure= dependencies of A.service.
    Sep 05 15:08:16 SKANKY systemd[1]: Failed to enqueue OnFailure= job: File exists
    I've obviously misunderstood something and misconfigured something, but I can't see what. Web and forum searches don't help.
    I can post the actual files, but my misunderstanding seems to be more general than specific here, so I'd like to avoid sidetracks into the specifics of the services involved.
    Last edited by skanky (2013-09-08 10:15:42)

    Thanks for the reply. 
    I got the need for Before/After from the manual, though I might be misunderstanding it :
    Conflicts=
               Configures negative requirement dependencies. If a unit has a Conflicts= setting on
               another unit, starting the former will stop the latter and vice versa. Note that this
               setting is independent of and orthogonal to the After= and Before= ordering
               dependencies.
               If a unit A that conflicts with a unit B is scheduled to be started at the same time
               as B, the transaction will either fail (in case both are required part of the
               transaction) or be modified to be fixed (in case one or both jobs are not a required
               part of the transaction). In the latter case the job that is not the required will be
               removed, or in case both are not required the unit that conflicts will be started and
               the unit that is conflicted is stopped.
    Why isn't OnFailed enough?
    It might be, I can't remember if I tried that on its own. I was hoping the error message would suggest a course though, as there's a lot of combinations of settings here that all seem valid and don't seem to ruled out by the documentation. Some of which have thrown up that error message. I'm trying new things out though, as I get a chance.
    EDIT:
    Okay, I removed all the conflicts stuff and it worked. I'll mark as solved, though I'm still not quite sure I'm completely sure how it all ties together - eg why having Conflicts etc. stops OnFailure working.
    Thanks for the nudge though.
    Last edited by skanky (2013-09-08 10:15:25)

  • [solved]systemd and console font

    Hi guys. I've just switched my laptop over to systemd and so far I'm finding it great! I am, however, having a slight issue with getting it to set a console font, err, properly.
    KEYMAP=uk
    FONT=Lat2-Terminus16
    Before switching to systemd, this worked fine. However now when I boot up, the font is set early (I have the hook in mkinitcpio.conf) but once I get to the login screen, the screen flickers and I end up back on the default font. I've tried this with several of the available fonts and it happens with all of them. I don't have it set anywhere else, so I'm not sure why the font is being reset. Has anyone else come across this issue yet?
    Cheers.
    Last edited by JHeaton (2012-08-25 20:20:34)

    bohoomil wrote:Did you really rebuild the initramfs? Once it becomes a part of your boot image, it shouldn't be reset (which happens when the video driver like nouveau gets loaded: if this is the case, add your video driver to the MODULES array in /etc/mkinitcpio,conf and rebuild the image again). I have been doing the very same thing every time I prepare a new setup and it always works as expected.
    Yes, I did rebuild it. I didn't have the video driver in MODULES though; adding it has now solved the issue. Don't know why I hadn't added i915 to that array though.
    Thanks very much for your help.

  • How to solve the error message "Could not activate cellular data network: PDP authentication failure"when using 3g or gPRS on safari with an iphone 4 and latest software updates

    Please can someone help me to solve the error message "Could not activate cellular data network: PDP authentication failure"when using 3G or GPRS on safari with an iphone 4GS and latest software updates. I have tried resetting the network and phone settings. I have restored the factory settings on itunes and still the problem persists.

    All iPhones sold in Japan are sold carrier locked and cannot be officially unlocked by the carrier. If you unlocked it, it was by unauthorized means (hacked), and support cannot be given to you in this forum.
    Hacked iPhones are subject to countermeasures by Apple, particularly when updating the firmware. It is likely permanently re-locked or permanently disabled.
    Message was edited by: modular747

Maybe you are looking for