Start X Server on Login with Systemd












0















I know that this is not the normal way people use X. Most setup instructions tell you to put something like startx in your shell's profile. However I want to have systemd manage things.



Ideally I would have something like systemctl --user enable x.service which is run when my user is logged in, and sources my .xinitrc thus starting my WM.



All my attempts to do this have given me the error:



/usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server


There must be a way to do this. Any help would be greatly appreciated.










share|improve this question


















  • 1





    I've no idea what setup instructions you read, but putting startx in the shell profile is utterly ridiculous (just think what happens when you log in remotely into several shells). The normal way to do this is to start a display manager (e.g. lightdm, or any you want), which in turn starts the X server. Starting the X server without a display manager will be a bit tricky; you'll have to setup all the stuff the display manager does for you (authorization cookies, etc.) yourself.

    – dirkt
    Apr 15 '18 at 19:37











  • @dirkt while I agree (hence the question), it does seem to be a pretty common practice. See wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login.

    – Nathan Lilienthal
    May 11 '18 at 21:22













  • People do a lot of stupid things (and like to blog about it), but that's not a reason to copy it.

    – dirkt
    May 12 '18 at 6:03











  • wiki.archlinux.org/index.php/Systemd/User#Xorg_and_systemd

    – jasonwryan
    May 31 '18 at 21:45











  • @jasonwryan that link is promising, the second option seems ideal, but wrought with issues. I'll give it a shot when I have some free time and report back. P.S. I don't know how I missed that when searching this issue on my own.

    – Nathan Lilienthal
    Jun 1 '18 at 17:57
















0















I know that this is not the normal way people use X. Most setup instructions tell you to put something like startx in your shell's profile. However I want to have systemd manage things.



Ideally I would have something like systemctl --user enable x.service which is run when my user is logged in, and sources my .xinitrc thus starting my WM.



All my attempts to do this have given me the error:



/usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server


There must be a way to do this. Any help would be greatly appreciated.










share|improve this question


















  • 1





    I've no idea what setup instructions you read, but putting startx in the shell profile is utterly ridiculous (just think what happens when you log in remotely into several shells). The normal way to do this is to start a display manager (e.g. lightdm, or any you want), which in turn starts the X server. Starting the X server without a display manager will be a bit tricky; you'll have to setup all the stuff the display manager does for you (authorization cookies, etc.) yourself.

    – dirkt
    Apr 15 '18 at 19:37











  • @dirkt while I agree (hence the question), it does seem to be a pretty common practice. See wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login.

    – Nathan Lilienthal
    May 11 '18 at 21:22













  • People do a lot of stupid things (and like to blog about it), but that's not a reason to copy it.

    – dirkt
    May 12 '18 at 6:03











  • wiki.archlinux.org/index.php/Systemd/User#Xorg_and_systemd

    – jasonwryan
    May 31 '18 at 21:45











  • @jasonwryan that link is promising, the second option seems ideal, but wrought with issues. I'll give it a shot when I have some free time and report back. P.S. I don't know how I missed that when searching this issue on my own.

    – Nathan Lilienthal
    Jun 1 '18 at 17:57














0












0








0








I know that this is not the normal way people use X. Most setup instructions tell you to put something like startx in your shell's profile. However I want to have systemd manage things.



Ideally I would have something like systemctl --user enable x.service which is run when my user is logged in, and sources my .xinitrc thus starting my WM.



All my attempts to do this have given me the error:



/usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server


There must be a way to do this. Any help would be greatly appreciated.










share|improve this question














I know that this is not the normal way people use X. Most setup instructions tell you to put something like startx in your shell's profile. However I want to have systemd manage things.



Ideally I would have something like systemctl --user enable x.service which is run when my user is logged in, and sources my .xinitrc thus starting my WM.



All my attempts to do this have given me the error:



/usr/lib/xorg/Xorg.wrap: Only console users are allowed to run the X server


There must be a way to do this. Any help would be greatly appreciated.







systemd startx xinit x






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 14 '18 at 20:44









Nathan LilienthalNathan Lilienthal

1011




1011








  • 1





    I've no idea what setup instructions you read, but putting startx in the shell profile is utterly ridiculous (just think what happens when you log in remotely into several shells). The normal way to do this is to start a display manager (e.g. lightdm, or any you want), which in turn starts the X server. Starting the X server without a display manager will be a bit tricky; you'll have to setup all the stuff the display manager does for you (authorization cookies, etc.) yourself.

    – dirkt
    Apr 15 '18 at 19:37











  • @dirkt while I agree (hence the question), it does seem to be a pretty common practice. See wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login.

    – Nathan Lilienthal
    May 11 '18 at 21:22













  • People do a lot of stupid things (and like to blog about it), but that's not a reason to copy it.

    – dirkt
    May 12 '18 at 6:03











  • wiki.archlinux.org/index.php/Systemd/User#Xorg_and_systemd

    – jasonwryan
    May 31 '18 at 21:45











  • @jasonwryan that link is promising, the second option seems ideal, but wrought with issues. I'll give it a shot when I have some free time and report back. P.S. I don't know how I missed that when searching this issue on my own.

    – Nathan Lilienthal
    Jun 1 '18 at 17:57














  • 1





    I've no idea what setup instructions you read, but putting startx in the shell profile is utterly ridiculous (just think what happens when you log in remotely into several shells). The normal way to do this is to start a display manager (e.g. lightdm, or any you want), which in turn starts the X server. Starting the X server without a display manager will be a bit tricky; you'll have to setup all the stuff the display manager does for you (authorization cookies, etc.) yourself.

    – dirkt
    Apr 15 '18 at 19:37











  • @dirkt while I agree (hence the question), it does seem to be a pretty common practice. See wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login.

    – Nathan Lilienthal
    May 11 '18 at 21:22













  • People do a lot of stupid things (and like to blog about it), but that's not a reason to copy it.

    – dirkt
    May 12 '18 at 6:03











  • wiki.archlinux.org/index.php/Systemd/User#Xorg_and_systemd

    – jasonwryan
    May 31 '18 at 21:45











  • @jasonwryan that link is promising, the second option seems ideal, but wrought with issues. I'll give it a shot when I have some free time and report back. P.S. I don't know how I missed that when searching this issue on my own.

    – Nathan Lilienthal
    Jun 1 '18 at 17:57








1




1





I've no idea what setup instructions you read, but putting startx in the shell profile is utterly ridiculous (just think what happens when you log in remotely into several shells). The normal way to do this is to start a display manager (e.g. lightdm, or any you want), which in turn starts the X server. Starting the X server without a display manager will be a bit tricky; you'll have to setup all the stuff the display manager does for you (authorization cookies, etc.) yourself.

– dirkt
Apr 15 '18 at 19:37





I've no idea what setup instructions you read, but putting startx in the shell profile is utterly ridiculous (just think what happens when you log in remotely into several shells). The normal way to do this is to start a display manager (e.g. lightdm, or any you want), which in turn starts the X server. Starting the X server without a display manager will be a bit tricky; you'll have to setup all the stuff the display manager does for you (authorization cookies, etc.) yourself.

– dirkt
Apr 15 '18 at 19:37













@dirkt while I agree (hence the question), it does seem to be a pretty common practice. See wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login.

– Nathan Lilienthal
May 11 '18 at 21:22







@dirkt while I agree (hence the question), it does seem to be a pretty common practice. See wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login.

– Nathan Lilienthal
May 11 '18 at 21:22















People do a lot of stupid things (and like to blog about it), but that's not a reason to copy it.

– dirkt
May 12 '18 at 6:03





People do a lot of stupid things (and like to blog about it), but that's not a reason to copy it.

– dirkt
May 12 '18 at 6:03













wiki.archlinux.org/index.php/Systemd/User#Xorg_and_systemd

– jasonwryan
May 31 '18 at 21:45





wiki.archlinux.org/index.php/Systemd/User#Xorg_and_systemd

– jasonwryan
May 31 '18 at 21:45













@jasonwryan that link is promising, the second option seems ideal, but wrought with issues. I'll give it a shot when I have some free time and report back. P.S. I don't know how I missed that when searching this issue on my own.

– Nathan Lilienthal
Jun 1 '18 at 17:57





@jasonwryan that link is promising, the second option seems ideal, but wrought with issues. I'll give it a shot when I have some free time and report back. P.S. I don't know how I missed that when searching this issue on my own.

– Nathan Lilienthal
Jun 1 '18 at 17:57










2 Answers
2






active

oldest

votes


















0














As a systemd user who starts X at boot (without a login manager), here's what I followed: https://wiki.archlinux.org/index.php/Systemd/User#Automatic_login_into_Xorg_without_display_manager






share|improve this answer








New contributor




Lyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




























    -2














    https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login



    A little searching goes a long way.




    if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
    exec startx
    fi



    Put this in your shell startup and in the console it will auto start.



    I guess if there is some problem with startx you fall back to the tty, it should work.






    share|improve this answer



















    • 6





      The OP specifically wants this handled by systemd...

      – jasonwryan
      May 31 '18 at 21:44











    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%2f437809%2fstart-x-server-on-login-with-systemd%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    As a systemd user who starts X at boot (without a login manager), here's what I followed: https://wiki.archlinux.org/index.php/Systemd/User#Automatic_login_into_Xorg_without_display_manager






    share|improve this answer








    New contributor




    Lyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.

























      0














      As a systemd user who starts X at boot (without a login manager), here's what I followed: https://wiki.archlinux.org/index.php/Systemd/User#Automatic_login_into_Xorg_without_display_manager






      share|improve this answer








      New contributor




      Lyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.























        0












        0








        0







        As a systemd user who starts X at boot (without a login manager), here's what I followed: https://wiki.archlinux.org/index.php/Systemd/User#Automatic_login_into_Xorg_without_display_manager






        share|improve this answer








        New contributor




        Lyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        As a systemd user who starts X at boot (without a login manager), here's what I followed: https://wiki.archlinux.org/index.php/Systemd/User#Automatic_login_into_Xorg_without_display_manager







        share|improve this answer








        New contributor




        Lyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        Lyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered Jan 10 at 0:16









        LyleLyle

        1011




        1011




        New contributor




        Lyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Lyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Lyle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.

























            -2














            https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login



            A little searching goes a long way.




            if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
            exec startx
            fi



            Put this in your shell startup and in the console it will auto start.



            I guess if there is some problem with startx you fall back to the tty, it should work.






            share|improve this answer



















            • 6





              The OP specifically wants this handled by systemd...

              – jasonwryan
              May 31 '18 at 21:44
















            -2














            https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login



            A little searching goes a long way.




            if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
            exec startx
            fi



            Put this in your shell startup and in the console it will auto start.



            I guess if there is some problem with startx you fall back to the tty, it should work.






            share|improve this answer



















            • 6





              The OP specifically wants this handled by systemd...

              – jasonwryan
              May 31 '18 at 21:44














            -2












            -2








            -2







            https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login



            A little searching goes a long way.




            if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
            exec startx
            fi



            Put this in your shell startup and in the console it will auto start.



            I guess if there is some problem with startx you fall back to the tty, it should work.






            share|improve this answer













            https://wiki.archlinux.org/index.php/Xinit#Autostart_X_at_login



            A little searching goes a long way.




            if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
            exec startx
            fi



            Put this in your shell startup and in the console it will auto start.



            I guess if there is some problem with startx you fall back to the tty, it should work.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered May 31 '18 at 21:42









            Louki SumirniyLouki Sumirniy

            1




            1








            • 6





              The OP specifically wants this handled by systemd...

              – jasonwryan
              May 31 '18 at 21:44














            • 6





              The OP specifically wants this handled by systemd...

              – jasonwryan
              May 31 '18 at 21:44








            6




            6





            The OP specifically wants this handled by systemd...

            – jasonwryan
            May 31 '18 at 21:44





            The OP specifically wants this handled by systemd...

            – jasonwryan
            May 31 '18 at 21:44


















            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f437809%2fstart-x-server-on-login-with-systemd%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

            How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

            is 'sed' thread safe

            How to make a Squid Proxy server?