How to poweroff when there's no systemd/init (e.g. using init=/bin/bash)?











up vote
6
down vote

favorite












poweroff complains that it can't connect to systemd via DBus (of course, it's not alive). I did sync followed by kill $$, thinking that pid 1 dying would cue the kernel to poweroff, but that caused a kernel panic. I then held the power button to force the poweroff.



What's the most proper way to power-off in this scenario?










share|improve this question


























    up vote
    6
    down vote

    favorite












    poweroff complains that it can't connect to systemd via DBus (of course, it's not alive). I did sync followed by kill $$, thinking that pid 1 dying would cue the kernel to poweroff, but that caused a kernel panic. I then held the power button to force the poweroff.



    What's the most proper way to power-off in this scenario?










    share|improve this question
























      up vote
      6
      down vote

      favorite









      up vote
      6
      down vote

      favorite











      poweroff complains that it can't connect to systemd via DBus (of course, it's not alive). I did sync followed by kill $$, thinking that pid 1 dying would cue the kernel to poweroff, but that caused a kernel panic. I then held the power button to force the poweroff.



      What's the most proper way to power-off in this scenario?










      share|improve this question













      poweroff complains that it can't connect to systemd via DBus (of course, it's not alive). I did sync followed by kill $$, thinking that pid 1 dying would cue the kernel to poweroff, but that caused a kernel panic. I then held the power button to force the poweroff.



      What's the most proper way to power-off in this scenario?







      linux systemd power-management






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 4 hours ago









      JoL

      86039




      86039






















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          5
          down vote














          1. Unmount the filesystems that you had mounted. The root filesystem is a special case; for this you can use mount / -o remount,ro. umount / also happens to work on Linux, because it is effectively converted to the former command.

          2. poweroff -f


          The systemd-specific equivalent of poweroff -f is systemctl poweroff -f -f.



          That said, you don't need to worry about it too much, unless




          1. You have mounted an old filesystem like FAT - as used by the EFI system partition - or ext2, which does not implement journalling or equivalent. With a modern filesystem, sync is supposed to be enough, and the filesystem will recover quickly on the next boot.

          2. or you might have left a running process that writes to the filesystem, and you had intended to shut it down cleanly. In that case it's useful to umount the filesystems, because it will show a busy error to remind you about the remaining writer.






          share|improve this answer























          • Just so you know, I'm not forgetting to accept. It's just that I've seen the advice to wait some time before accepting an answer to let others (maybe in different timezones) see the question and have the chance to provide their own answers.
            – JoL
            4 hours ago


















          up vote
          2
          down vote













          Ok, so it just occurred to me that I had the option to exec init. From there, I would probably be able to later poweroff. I wonder if there are better alternatives, though.






          share|improve this answer





















          • @G-Man won't it start the normal boot process and give you your normal shell eventually?
            – muru
            2 hours ago










          • Hmmm.  Yeah, I guess so.
            – G-Man
            2 hours ago


















          up vote
          0
          down vote













          #exec /sbin/init 


          is what I use when I can't use "init 0" or any init command which is usually in single user mode to change root passwd.






          share|improve this answer





















          • Isn't that what OP has already suggest? unix.stackexchange.com/a/487240/70524
            – muru
            34 mins ago











          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%2f487238%2fhow-to-poweroff-when-theres-no-systemd-init-e-g-using-init-bin-bash%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          5
          down vote














          1. Unmount the filesystems that you had mounted. The root filesystem is a special case; for this you can use mount / -o remount,ro. umount / also happens to work on Linux, because it is effectively converted to the former command.

          2. poweroff -f


          The systemd-specific equivalent of poweroff -f is systemctl poweroff -f -f.



          That said, you don't need to worry about it too much, unless




          1. You have mounted an old filesystem like FAT - as used by the EFI system partition - or ext2, which does not implement journalling or equivalent. With a modern filesystem, sync is supposed to be enough, and the filesystem will recover quickly on the next boot.

          2. or you might have left a running process that writes to the filesystem, and you had intended to shut it down cleanly. In that case it's useful to umount the filesystems, because it will show a busy error to remind you about the remaining writer.






          share|improve this answer























          • Just so you know, I'm not forgetting to accept. It's just that I've seen the advice to wait some time before accepting an answer to let others (maybe in different timezones) see the question and have the chance to provide their own answers.
            – JoL
            4 hours ago















          up vote
          5
          down vote














          1. Unmount the filesystems that you had mounted. The root filesystem is a special case; for this you can use mount / -o remount,ro. umount / also happens to work on Linux, because it is effectively converted to the former command.

          2. poweroff -f


          The systemd-specific equivalent of poweroff -f is systemctl poweroff -f -f.



          That said, you don't need to worry about it too much, unless




          1. You have mounted an old filesystem like FAT - as used by the EFI system partition - or ext2, which does not implement journalling or equivalent. With a modern filesystem, sync is supposed to be enough, and the filesystem will recover quickly on the next boot.

          2. or you might have left a running process that writes to the filesystem, and you had intended to shut it down cleanly. In that case it's useful to umount the filesystems, because it will show a busy error to remind you about the remaining writer.






          share|improve this answer























          • Just so you know, I'm not forgetting to accept. It's just that I've seen the advice to wait some time before accepting an answer to let others (maybe in different timezones) see the question and have the chance to provide their own answers.
            – JoL
            4 hours ago













          up vote
          5
          down vote










          up vote
          5
          down vote










          1. Unmount the filesystems that you had mounted. The root filesystem is a special case; for this you can use mount / -o remount,ro. umount / also happens to work on Linux, because it is effectively converted to the former command.

          2. poweroff -f


          The systemd-specific equivalent of poweroff -f is systemctl poweroff -f -f.



          That said, you don't need to worry about it too much, unless




          1. You have mounted an old filesystem like FAT - as used by the EFI system partition - or ext2, which does not implement journalling or equivalent. With a modern filesystem, sync is supposed to be enough, and the filesystem will recover quickly on the next boot.

          2. or you might have left a running process that writes to the filesystem, and you had intended to shut it down cleanly. In that case it's useful to umount the filesystems, because it will show a busy error to remind you about the remaining writer.






          share|improve this answer















          1. Unmount the filesystems that you had mounted. The root filesystem is a special case; for this you can use mount / -o remount,ro. umount / also happens to work on Linux, because it is effectively converted to the former command.

          2. poweroff -f


          The systemd-specific equivalent of poweroff -f is systemctl poweroff -f -f.



          That said, you don't need to worry about it too much, unless




          1. You have mounted an old filesystem like FAT - as used by the EFI system partition - or ext2, which does not implement journalling or equivalent. With a modern filesystem, sync is supposed to be enough, and the filesystem will recover quickly on the next boot.

          2. or you might have left a running process that writes to the filesystem, and you had intended to shut it down cleanly. In that case it's useful to umount the filesystems, because it will show a busy error to remind you about the remaining writer.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 4 hours ago

























          answered 4 hours ago









          sourcejedi

          22.4k43398




          22.4k43398












          • Just so you know, I'm not forgetting to accept. It's just that I've seen the advice to wait some time before accepting an answer to let others (maybe in different timezones) see the question and have the chance to provide their own answers.
            – JoL
            4 hours ago


















          • Just so you know, I'm not forgetting to accept. It's just that I've seen the advice to wait some time before accepting an answer to let others (maybe in different timezones) see the question and have the chance to provide their own answers.
            – JoL
            4 hours ago
















          Just so you know, I'm not forgetting to accept. It's just that I've seen the advice to wait some time before accepting an answer to let others (maybe in different timezones) see the question and have the chance to provide their own answers.
          – JoL
          4 hours ago




          Just so you know, I'm not forgetting to accept. It's just that I've seen the advice to wait some time before accepting an answer to let others (maybe in different timezones) see the question and have the chance to provide their own answers.
          – JoL
          4 hours ago












          up vote
          2
          down vote













          Ok, so it just occurred to me that I had the option to exec init. From there, I would probably be able to later poweroff. I wonder if there are better alternatives, though.






          share|improve this answer





















          • @G-Man won't it start the normal boot process and give you your normal shell eventually?
            – muru
            2 hours ago










          • Hmmm.  Yeah, I guess so.
            – G-Man
            2 hours ago















          up vote
          2
          down vote













          Ok, so it just occurred to me that I had the option to exec init. From there, I would probably be able to later poweroff. I wonder if there are better alternatives, though.






          share|improve this answer





















          • @G-Man won't it start the normal boot process and give you your normal shell eventually?
            – muru
            2 hours ago










          • Hmmm.  Yeah, I guess so.
            – G-Man
            2 hours ago













          up vote
          2
          down vote










          up vote
          2
          down vote









          Ok, so it just occurred to me that I had the option to exec init. From there, I would probably be able to later poweroff. I wonder if there are better alternatives, though.






          share|improve this answer












          Ok, so it just occurred to me that I had the option to exec init. From there, I would probably be able to later poweroff. I wonder if there are better alternatives, though.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 4 hours ago









          JoL

          86039




          86039












          • @G-Man won't it start the normal boot process and give you your normal shell eventually?
            – muru
            2 hours ago










          • Hmmm.  Yeah, I guess so.
            – G-Man
            2 hours ago


















          • @G-Man won't it start the normal boot process and give you your normal shell eventually?
            – muru
            2 hours ago










          • Hmmm.  Yeah, I guess so.
            – G-Man
            2 hours ago
















          @G-Man won't it start the normal boot process and give you your normal shell eventually?
          – muru
          2 hours ago




          @G-Man won't it start the normal boot process and give you your normal shell eventually?
          – muru
          2 hours ago












          Hmmm.  Yeah, I guess so.
          – G-Man
          2 hours ago




          Hmmm.  Yeah, I guess so.
          – G-Man
          2 hours ago










          up vote
          0
          down vote













          #exec /sbin/init 


          is what I use when I can't use "init 0" or any init command which is usually in single user mode to change root passwd.






          share|improve this answer





















          • Isn't that what OP has already suggest? unix.stackexchange.com/a/487240/70524
            – muru
            34 mins ago















          up vote
          0
          down vote













          #exec /sbin/init 


          is what I use when I can't use "init 0" or any init command which is usually in single user mode to change root passwd.






          share|improve this answer





















          • Isn't that what OP has already suggest? unix.stackexchange.com/a/487240/70524
            – muru
            34 mins ago













          up vote
          0
          down vote










          up vote
          0
          down vote









          #exec /sbin/init 


          is what I use when I can't use "init 0" or any init command which is usually in single user mode to change root passwd.






          share|improve this answer












          #exec /sbin/init 


          is what I use when I can't use "init 0" or any init command which is usually in single user mode to change root passwd.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 2 hours ago









          Calvin Dike

          112




          112












          • Isn't that what OP has already suggest? unix.stackexchange.com/a/487240/70524
            – muru
            34 mins ago


















          • Isn't that what OP has already suggest? unix.stackexchange.com/a/487240/70524
            – muru
            34 mins ago
















          Isn't that what OP has already suggest? unix.stackexchange.com/a/487240/70524
          – muru
          34 mins ago




          Isn't that what OP has already suggest? unix.stackexchange.com/a/487240/70524
          – muru
          34 mins ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f487238%2fhow-to-poweroff-when-theres-no-systemd-init-e-g-using-init-bin-bash%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Contact image not getting when fetch all contact list from iPhone by CNContact

          count number of partitions of a set with n elements into k subsets

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks