How to run fake-hwclock before /var/log/wtmp is updated?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
7
down vote

favorite
2












I have a raspberry pi and every reboot I see this output in last:



root@RaspberryPi:~# last | grep boot
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 still running
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 still running
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01)
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01)
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01)


This is despite having both fake-hwclock and a hardware RTC installed.



Currently the service for fake-hwclock.service starts before sysinit.target, like this:



[Unit]
Before=sysinit.target

[Service]
ExecStart=/sbin/fake-hwclock load

[Install]
WantedBy=sysinit.target


How do I make it run before /var/log/wtmp is updated?










share|improve this question

















  • 1




    Filed an issue here, so far no solutions :( < github.com/systemd/systemd/issues/6057
    – Roman Gaufman
    Jun 7 '17 at 16:13














up vote
7
down vote

favorite
2












I have a raspberry pi and every reboot I see this output in last:



root@RaspberryPi:~# last | grep boot
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 still running
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 still running
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01)
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01)
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01)


This is despite having both fake-hwclock and a hardware RTC installed.



Currently the service for fake-hwclock.service starts before sysinit.target, like this:



[Unit]
Before=sysinit.target

[Service]
ExecStart=/sbin/fake-hwclock load

[Install]
WantedBy=sysinit.target


How do I make it run before /var/log/wtmp is updated?










share|improve this question

















  • 1




    Filed an issue here, so far no solutions :( < github.com/systemd/systemd/issues/6057
    – Roman Gaufman
    Jun 7 '17 at 16:13












up vote
7
down vote

favorite
2









up vote
7
down vote

favorite
2






2





I have a raspberry pi and every reboot I see this output in last:



root@RaspberryPi:~# last | grep boot
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 still running
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 still running
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01)
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01)
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01)


This is despite having both fake-hwclock and a hardware RTC installed.



Currently the service for fake-hwclock.service starts before sysinit.target, like this:



[Unit]
Before=sysinit.target

[Service]
ExecStart=/sbin/fake-hwclock load

[Install]
WantedBy=sysinit.target


How do I make it run before /var/log/wtmp is updated?










share|improve this question













I have a raspberry pi and every reboot I see this output in last:



root@RaspberryPi:~# last | grep boot
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 still running
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 still running
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01)
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01)
reboot system boot 4.4.0-1055-raspi Thu Jan 1 01:00 - 23:01 (17305+22:01)


This is despite having both fake-hwclock and a hardware RTC installed.



Currently the service for fake-hwclock.service starts before sysinit.target, like this:



[Unit]
Before=sysinit.target

[Service]
ExecStart=/sbin/fake-hwclock load

[Install]
WantedBy=sysinit.target


How do I make it run before /var/log/wtmp is updated?







systemd raspberry-pi wtmp






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 30 '17 at 20:24









Roman Gaufman

1349




1349







  • 1




    Filed an issue here, so far no solutions :( < github.com/systemd/systemd/issues/6057
    – Roman Gaufman
    Jun 7 '17 at 16:13












  • 1




    Filed an issue here, so far no solutions :( < github.com/systemd/systemd/issues/6057
    – Roman Gaufman
    Jun 7 '17 at 16:13







1




1




Filed an issue here, so far no solutions :( < github.com/systemd/systemd/issues/6057
– Roman Gaufman
Jun 7 '17 at 16:13




Filed an issue here, so far no solutions :( < github.com/systemd/systemd/issues/6057
– Roman Gaufman
Jun 7 '17 at 16:13










2 Answers
2






active

oldest

votes

















up vote
0
down vote













I believe that this is a bug in systemd-update-utmp. See my comment here: https://github.com/systemd/systemd/issues/6057#issuecomment-435247567



A workaround is to run fake-hwclock in initramfs, before it passes control to the main systemd instance.





share



























    up vote
    -1
    down vote













    wtmp "reboot" login records are handled by the systemd-update-utmp systemd service. It must start before the sysinit target which means before that start is complete this service will start IF it wasn't started already. It does not mean that systemd-timesyncd will necessarily start before systemd-update-utmp.



    I tested on my arch linux server and consistently systemd-timesyncd always runs well before systemd-update-utmp however. On the other hand they are almost always one pid away from each other.



    But since it isn't explicitly running after NTP I suppose this should still be considered a bug.



    From the systemd manual:



    "After= is the inverse of Before=, i.e. while After= ensures that the configured unit is started after the listed unit finished starting up"



    https://www.freedesktop.org/software/systemd/man/systemd.unit.html



    What you should do:



    systemctl edit systemd-update-utmp

    [Unit]
    After=systemd-timesyncd.service
    Wants=systemd-timesyncd.service





    share|improve this answer




















      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "106"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f368190%2fhow-to-run-fake-hwclock-before-var-log-wtmp-is-updated%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote













      I believe that this is a bug in systemd-update-utmp. See my comment here: https://github.com/systemd/systemd/issues/6057#issuecomment-435247567



      A workaround is to run fake-hwclock in initramfs, before it passes control to the main systemd instance.





      share
























        up vote
        0
        down vote













        I believe that this is a bug in systemd-update-utmp. See my comment here: https://github.com/systemd/systemd/issues/6057#issuecomment-435247567



        A workaround is to run fake-hwclock in initramfs, before it passes control to the main systemd instance.





        share






















          up vote
          0
          down vote










          up vote
          0
          down vote









          I believe that this is a bug in systemd-update-utmp. See my comment here: https://github.com/systemd/systemd/issues/6057#issuecomment-435247567



          A workaround is to run fake-hwclock in initramfs, before it passes control to the main systemd instance.





          share












          I believe that this is a bug in systemd-update-utmp. See my comment here: https://github.com/systemd/systemd/issues/6057#issuecomment-435247567



          A workaround is to run fake-hwclock in initramfs, before it passes control to the main systemd instance.






          share











          share


          share










          answered 2 mins ago









          Piotr Jurkiewicz

          686512




          686512






















              up vote
              -1
              down vote













              wtmp "reboot" login records are handled by the systemd-update-utmp systemd service. It must start before the sysinit target which means before that start is complete this service will start IF it wasn't started already. It does not mean that systemd-timesyncd will necessarily start before systemd-update-utmp.



              I tested on my arch linux server and consistently systemd-timesyncd always runs well before systemd-update-utmp however. On the other hand they are almost always one pid away from each other.



              But since it isn't explicitly running after NTP I suppose this should still be considered a bug.



              From the systemd manual:



              "After= is the inverse of Before=, i.e. while After= ensures that the configured unit is started after the listed unit finished starting up"



              https://www.freedesktop.org/software/systemd/man/systemd.unit.html



              What you should do:



              systemctl edit systemd-update-utmp

              [Unit]
              After=systemd-timesyncd.service
              Wants=systemd-timesyncd.service





              share|improve this answer
























                up vote
                -1
                down vote













                wtmp "reboot" login records are handled by the systemd-update-utmp systemd service. It must start before the sysinit target which means before that start is complete this service will start IF it wasn't started already. It does not mean that systemd-timesyncd will necessarily start before systemd-update-utmp.



                I tested on my arch linux server and consistently systemd-timesyncd always runs well before systemd-update-utmp however. On the other hand they are almost always one pid away from each other.



                But since it isn't explicitly running after NTP I suppose this should still be considered a bug.



                From the systemd manual:



                "After= is the inverse of Before=, i.e. while After= ensures that the configured unit is started after the listed unit finished starting up"



                https://www.freedesktop.org/software/systemd/man/systemd.unit.html



                What you should do:



                systemctl edit systemd-update-utmp

                [Unit]
                After=systemd-timesyncd.service
                Wants=systemd-timesyncd.service





                share|improve this answer






















                  up vote
                  -1
                  down vote










                  up vote
                  -1
                  down vote









                  wtmp "reboot" login records are handled by the systemd-update-utmp systemd service. It must start before the sysinit target which means before that start is complete this service will start IF it wasn't started already. It does not mean that systemd-timesyncd will necessarily start before systemd-update-utmp.



                  I tested on my arch linux server and consistently systemd-timesyncd always runs well before systemd-update-utmp however. On the other hand they are almost always one pid away from each other.



                  But since it isn't explicitly running after NTP I suppose this should still be considered a bug.



                  From the systemd manual:



                  "After= is the inverse of Before=, i.e. while After= ensures that the configured unit is started after the listed unit finished starting up"



                  https://www.freedesktop.org/software/systemd/man/systemd.unit.html



                  What you should do:



                  systemctl edit systemd-update-utmp

                  [Unit]
                  After=systemd-timesyncd.service
                  Wants=systemd-timesyncd.service





                  share|improve this answer












                  wtmp "reboot" login records are handled by the systemd-update-utmp systemd service. It must start before the sysinit target which means before that start is complete this service will start IF it wasn't started already. It does not mean that systemd-timesyncd will necessarily start before systemd-update-utmp.



                  I tested on my arch linux server and consistently systemd-timesyncd always runs well before systemd-update-utmp however. On the other hand they are almost always one pid away from each other.



                  But since it isn't explicitly running after NTP I suppose this should still be considered a bug.



                  From the systemd manual:



                  "After= is the inverse of Before=, i.e. while After= ensures that the configured unit is started after the listed unit finished starting up"



                  https://www.freedesktop.org/software/systemd/man/systemd.unit.html



                  What you should do:



                  systemctl edit systemd-update-utmp

                  [Unit]
                  After=systemd-timesyncd.service
                  Wants=systemd-timesyncd.service






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 26 '17 at 9:52









                  jdwolf

                  2,560216




                  2,560216



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f368190%2fhow-to-run-fake-hwclock-before-var-log-wtmp-is-updated%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      How to check contact read email or not when send email to Individual?

                      Displaying single band from multi-band raster using QGIS

                      How many registers does an x86_64 CPU actually have?