Why calling agetty directly from bash doesn't seem to have any effect?












0














I try to call /usr/bin/agetty - from bash in a terminal-emulator(both X-based and Kernel-based), then it asked me to input a username, but after input that username, it just "freeze" a little while, then dropped me back into my original bash promote.



I started to wonder, agetty is started by systemd as a service using the ttyx device and execve(/usr/bin/login) so it will give me login promote, because login is configured with pam_systemd, so a systemd session will be created. But that's not the result I get when I directly run agetty - as I mentioned above, no new session is created when I check systemctl status.



Then I thought if it was because agetty run as normal user, it might check its own EUID or something, but that just cause my bash to exit after I input the username.



Ok, I checked systemctl status again, it told me systemd run this program as /sbin/agetty -o -p -- u --noclear tty2 linux, ok, I login as root on tty2, then run agetty -o -p -- u --noclear - linux, I got exactly the same situation as in the first place —— I was dropped back to bash again.



Could anyone explain to me about these experiment results to me?



If it helps, I'm using ArchLinux, /usr/bin/login and /usr/bin/agetty are both from the util-linux 2.33-2 package.









share



























    0














    I try to call /usr/bin/agetty - from bash in a terminal-emulator(both X-based and Kernel-based), then it asked me to input a username, but after input that username, it just "freeze" a little while, then dropped me back into my original bash promote.



    I started to wonder, agetty is started by systemd as a service using the ttyx device and execve(/usr/bin/login) so it will give me login promote, because login is configured with pam_systemd, so a systemd session will be created. But that's not the result I get when I directly run agetty - as I mentioned above, no new session is created when I check systemctl status.



    Then I thought if it was because agetty run as normal user, it might check its own EUID or something, but that just cause my bash to exit after I input the username.



    Ok, I checked systemctl status again, it told me systemd run this program as /sbin/agetty -o -p -- u --noclear tty2 linux, ok, I login as root on tty2, then run agetty -o -p -- u --noclear - linux, I got exactly the same situation as in the first place —— I was dropped back to bash again.



    Could anyone explain to me about these experiment results to me?



    If it helps, I'm using ArchLinux, /usr/bin/login and /usr/bin/agetty are both from the util-linux 2.33-2 package.









    share

























      0












      0








      0







      I try to call /usr/bin/agetty - from bash in a terminal-emulator(both X-based and Kernel-based), then it asked me to input a username, but after input that username, it just "freeze" a little while, then dropped me back into my original bash promote.



      I started to wonder, agetty is started by systemd as a service using the ttyx device and execve(/usr/bin/login) so it will give me login promote, because login is configured with pam_systemd, so a systemd session will be created. But that's not the result I get when I directly run agetty - as I mentioned above, no new session is created when I check systemctl status.



      Then I thought if it was because agetty run as normal user, it might check its own EUID or something, but that just cause my bash to exit after I input the username.



      Ok, I checked systemctl status again, it told me systemd run this program as /sbin/agetty -o -p -- u --noclear tty2 linux, ok, I login as root on tty2, then run agetty -o -p -- u --noclear - linux, I got exactly the same situation as in the first place —— I was dropped back to bash again.



      Could anyone explain to me about these experiment results to me?



      If it helps, I'm using ArchLinux, /usr/bin/login and /usr/bin/agetty are both from the util-linux 2.33-2 package.









      share













      I try to call /usr/bin/agetty - from bash in a terminal-emulator(both X-based and Kernel-based), then it asked me to input a username, but after input that username, it just "freeze" a little while, then dropped me back into my original bash promote.



      I started to wonder, agetty is started by systemd as a service using the ttyx device and execve(/usr/bin/login) so it will give me login promote, because login is configured with pam_systemd, so a systemd session will be created. But that's not the result I get when I directly run agetty - as I mentioned above, no new session is created when I check systemctl status.



      Then I thought if it was because agetty run as normal user, it might check its own EUID or something, but that just cause my bash to exit after I input the username.



      Ok, I checked systemctl status again, it told me systemd run this program as /sbin/agetty -o -p -- u --noclear tty2 linux, ok, I login as root on tty2, then run agetty -o -p -- u --noclear - linux, I got exactly the same situation as in the first place —— I was dropped back to bash again.



      Could anyone explain to me about these experiment results to me?



      If it helps, I'm using ArchLinux, /usr/bin/login and /usr/bin/agetty are both from the util-linux 2.33-2 package.







      linux systemd login getty





      share












      share










      share



      share










      asked 6 mins ago









      炸鱼薯条德里克

      399114




      399114



























          active

          oldest

          votes











          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',
          autoActivateHeartbeat: false,
          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%2f491543%2fwhy-calling-agetty-directly-from-bash-doesnt-seem-to-have-any-effect%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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%2f491543%2fwhy-calling-agetty-directly-from-bash-doesnt-seem-to-have-any-effect%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

          Accessing regular linux commands in Huawei's Dopra Linux

          Can't connect RFCOMM socket: Host is down

          Kernel panic - not syncing: Fatal Exception in Interrupt