Start a screen session inside LXD-managed containerWorking with screen sessions in LXD-managed containersSystemd fails to start openvpn in lxd managed 16.04 containerRunning Ubuntu Desktop in LXC/LXD on top of Ubuntu Server(LXD) LXC container not starting services automaticallyUlimit for user asterisk inside an LXD containerLXD unable to start containerDisable IPv6 from boot inside LXD/LXC containerLXD Containers and Host on DHCPQuota inside LXD container

Examples of "unsuccessful" theories with afterlives

How to deal with my team leader who keeps calling me about project updates even though I am on leave for personal reasons?

If the EU does not offer an extension to UK's Article 50 invocation, is the Benn Bill irrelevant?

Is it possible to encode a message in such a way that can only be read by someone or something capable of seeing into the very near future?

Can an integer optimization problem be convex?

Safely hang a mirror that does not have hooks

Drawing line in notebook with Mathematica command

Social leper versus social leopard

How to make interviewee comfortable interviewing in lounge chairs

What benefits does the Power Word Kill spell have?

Co-Supervisor comes to office to help her students which distracts me

What do you do if you have developments on your paper during the long peer review process?

To what extent is it worthwhile to report check fraud / refund scams?

2000s Animated TV show where teenagers could physically go into a virtual world

1, 2, 4, 8, 16, ... 33?

What is the meaning of "heutig" in this sentence?

Resolving moral conflict

Does Fires of Invention allow adventure instant and sorceries to be played for free?

What's the story to "WotC gave up on fixing Polymorph"?

A food item only made possible by time-freezing storage?

How can this Stack Exchange site have an animated favicon?

My Project Manager does not accept carry-over in Scrum, Is that normal?

Worms crawling under skin

Can a broken/split chain be reassembled?



Start a screen session inside LXD-managed container


Working with screen sessions in LXD-managed containersSystemd fails to start openvpn in lxd managed 16.04 containerRunning Ubuntu Desktop in LXC/LXD on top of Ubuntu Server(LXD) LXC container not starting services automaticallyUlimit for user asterisk inside an LXD containerLXD unable to start containerDisable IPv6 from boot inside LXD/LXC containerLXD Containers and Host on DHCPQuota inside LXD container






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








5















I'd like to start a screen session inside an LXD-managed container so that I could detach running processes and maybe re-attach in the future when I want to check on their status.



I tried to attach to the container running



$ lxc exec my-ubuntu -- /bin/bash


and then start a session with screen -x, but I get the following error:



Must be connected to a terminal.


I can see that many people have had a similar problem when trying to initiate screen from ssh, but I couldn't apply the suggested solution to my case.










share|improve this question






























    5















    I'd like to start a screen session inside an LXD-managed container so that I could detach running processes and maybe re-attach in the future when I want to check on their status.



    I tried to attach to the container running



    $ lxc exec my-ubuntu -- /bin/bash


    and then start a session with screen -x, but I get the following error:



    Must be connected to a terminal.


    I can see that many people have had a similar problem when trying to initiate screen from ssh, but I couldn't apply the suggested solution to my case.










    share|improve this question


























      5












      5








      5


      1






      I'd like to start a screen session inside an LXD-managed container so that I could detach running processes and maybe re-attach in the future when I want to check on their status.



      I tried to attach to the container running



      $ lxc exec my-ubuntu -- /bin/bash


      and then start a session with screen -x, but I get the following error:



      Must be connected to a terminal.


      I can see that many people have had a similar problem when trying to initiate screen from ssh, but I couldn't apply the suggested solution to my case.










      share|improve this question














      I'd like to start a screen session inside an LXD-managed container so that I could detach running processes and maybe re-attach in the future when I want to check on their status.



      I tried to attach to the container running



      $ lxc exec my-ubuntu -- /bin/bash


      and then start a session with screen -x, but I get the following error:



      Must be connected to a terminal.


      I can see that many people have had a similar problem when trying to initiate screen from ssh, but I couldn't apply the suggested solution to my case.







      lxc gnu-screen lxd






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 2 '16 at 15:53









      Jonathan Y.Jonathan Y.

      50412 silver badges30 bronze badges




      50412 silver badges30 bronze badges























          2 Answers
          2






          active

          oldest

          votes


















          5
















          For LXD using



          lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -s /bin/bash"


          or



          lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -x"


          or with any other screen switch.




          The same for Docker
          ;)



          docker run -it my-ubuntu sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -s /bin/bash"





          share|improve this answer



























          • Terrific. But how can I then work with screen the way I normally do, monitor which sessions are running and re-attach to a specific one?

            – Jonathan Y.
            Jan 2 '16 at 19:40











          • I don't understand. In the same way as before. E.g. using -R.

            – A.B.
            Jan 2 '16 at 19:42











          • Answer updated.

            – A.B.
            Jan 2 '16 at 19:45











          • Well, I would normally do screen -x, but trying lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -x doesn't work, and neither does lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -r <pid>.tty.my-ubuntu". Nor can I do screen -x from within bash in the container.

            – Jonathan Y.
            Jan 2 '16 at 19:48











          • What's about -R

            – A.B.
            Jan 2 '16 at 19:51


















          0
















          For me, the simple solution was to start screen on the host instead of in the container.



          user@localhost:~$ screen
          user@localhost:~$ lxc-attach -n yourcontainer
          root@container:~# ./start-gameserver.sh
          root@container:~# #Use "Ctrl+A:sessionname mygame<Enter>" to set a screen name
          root@container:~# #and use the usual "Ctrl+A,D" to disconnect from screen
          user@localhost:~$ screen -ls
          There is a screen on:
          25418.mygame (04/15/2019 11:41:56 PM) (Detached)
          user@localhost:~$ screen -r mygame
          root@container:~# #etc.





          share|improve this answer



























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            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: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            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/4.0/"u003ecc by-sa 4.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%2faskubuntu.com%2fquestions%2f716028%2fstart-a-screen-session-inside-lxd-managed-container%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









            5
















            For LXD using



            lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -s /bin/bash"


            or



            lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -x"


            or with any other screen switch.




            The same for Docker
            ;)



            docker run -it my-ubuntu sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -s /bin/bash"





            share|improve this answer



























            • Terrific. But how can I then work with screen the way I normally do, monitor which sessions are running and re-attach to a specific one?

              – Jonathan Y.
              Jan 2 '16 at 19:40











            • I don't understand. In the same way as before. E.g. using -R.

              – A.B.
              Jan 2 '16 at 19:42











            • Answer updated.

              – A.B.
              Jan 2 '16 at 19:45











            • Well, I would normally do screen -x, but trying lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -x doesn't work, and neither does lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -r <pid>.tty.my-ubuntu". Nor can I do screen -x from within bash in the container.

              – Jonathan Y.
              Jan 2 '16 at 19:48











            • What's about -R

              – A.B.
              Jan 2 '16 at 19:51















            5
















            For LXD using



            lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -s /bin/bash"


            or



            lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -x"


            or with any other screen switch.




            The same for Docker
            ;)



            docker run -it my-ubuntu sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -s /bin/bash"





            share|improve this answer



























            • Terrific. But how can I then work with screen the way I normally do, monitor which sessions are running and re-attach to a specific one?

              – Jonathan Y.
              Jan 2 '16 at 19:40











            • I don't understand. In the same way as before. E.g. using -R.

              – A.B.
              Jan 2 '16 at 19:42











            • Answer updated.

              – A.B.
              Jan 2 '16 at 19:45











            • Well, I would normally do screen -x, but trying lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -x doesn't work, and neither does lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -r <pid>.tty.my-ubuntu". Nor can I do screen -x from within bash in the container.

              – Jonathan Y.
              Jan 2 '16 at 19:48











            • What's about -R

              – A.B.
              Jan 2 '16 at 19:51













            5














            5










            5









            For LXD using



            lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -s /bin/bash"


            or



            lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -x"


            or with any other screen switch.




            The same for Docker
            ;)



            docker run -it my-ubuntu sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -s /bin/bash"





            share|improve this answer















            For LXD using



            lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -s /bin/bash"


            or



            lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -x"


            or with any other screen switch.




            The same for Docker
            ;)



            docker run -it my-ubuntu sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -s /bin/bash"






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 2 '16 at 19:45

























            answered Jan 2 '16 at 16:31









            A.B.A.B.

            72.6k12 gold badges187 silver badges277 bronze badges




            72.6k12 gold badges187 silver badges277 bronze badges















            • Terrific. But how can I then work with screen the way I normally do, monitor which sessions are running and re-attach to a specific one?

              – Jonathan Y.
              Jan 2 '16 at 19:40











            • I don't understand. In the same way as before. E.g. using -R.

              – A.B.
              Jan 2 '16 at 19:42











            • Answer updated.

              – A.B.
              Jan 2 '16 at 19:45











            • Well, I would normally do screen -x, but trying lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -x doesn't work, and neither does lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -r <pid>.tty.my-ubuntu". Nor can I do screen -x from within bash in the container.

              – Jonathan Y.
              Jan 2 '16 at 19:48











            • What's about -R

              – A.B.
              Jan 2 '16 at 19:51

















            • Terrific. But how can I then work with screen the way I normally do, monitor which sessions are running and re-attach to a specific one?

              – Jonathan Y.
              Jan 2 '16 at 19:40











            • I don't understand. In the same way as before. E.g. using -R.

              – A.B.
              Jan 2 '16 at 19:42











            • Answer updated.

              – A.B.
              Jan 2 '16 at 19:45











            • Well, I would normally do screen -x, but trying lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -x doesn't work, and neither does lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -r <pid>.tty.my-ubuntu". Nor can I do screen -x from within bash in the container.

              – Jonathan Y.
              Jan 2 '16 at 19:48











            • What's about -R

              – A.B.
              Jan 2 '16 at 19:51
















            Terrific. But how can I then work with screen the way I normally do, monitor which sessions are running and re-attach to a specific one?

            – Jonathan Y.
            Jan 2 '16 at 19:40





            Terrific. But how can I then work with screen the way I normally do, monitor which sessions are running and re-attach to a specific one?

            – Jonathan Y.
            Jan 2 '16 at 19:40













            I don't understand. In the same way as before. E.g. using -R.

            – A.B.
            Jan 2 '16 at 19:42





            I don't understand. In the same way as before. E.g. using -R.

            – A.B.
            Jan 2 '16 at 19:42













            Answer updated.

            – A.B.
            Jan 2 '16 at 19:45





            Answer updated.

            – A.B.
            Jan 2 '16 at 19:45













            Well, I would normally do screen -x, but trying lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -x doesn't work, and neither does lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -r <pid>.tty.my-ubuntu". Nor can I do screen -x from within bash in the container.

            – Jonathan Y.
            Jan 2 '16 at 19:48





            Well, I would normally do screen -x, but trying lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -x doesn't work, and neither does lxc exec my-ubuntu -- sh -c "exec >/dev/tty 2>/dev/tty </dev/tty && /usr/bin/screen -r <pid>.tty.my-ubuntu". Nor can I do screen -x from within bash in the container.

            – Jonathan Y.
            Jan 2 '16 at 19:48













            What's about -R

            – A.B.
            Jan 2 '16 at 19:51





            What's about -R

            – A.B.
            Jan 2 '16 at 19:51













            0
















            For me, the simple solution was to start screen on the host instead of in the container.



            user@localhost:~$ screen
            user@localhost:~$ lxc-attach -n yourcontainer
            root@container:~# ./start-gameserver.sh
            root@container:~# #Use "Ctrl+A:sessionname mygame<Enter>" to set a screen name
            root@container:~# #and use the usual "Ctrl+A,D" to disconnect from screen
            user@localhost:~$ screen -ls
            There is a screen on:
            25418.mygame (04/15/2019 11:41:56 PM) (Detached)
            user@localhost:~$ screen -r mygame
            root@container:~# #etc.





            share|improve this answer





























              0
















              For me, the simple solution was to start screen on the host instead of in the container.



              user@localhost:~$ screen
              user@localhost:~$ lxc-attach -n yourcontainer
              root@container:~# ./start-gameserver.sh
              root@container:~# #Use "Ctrl+A:sessionname mygame<Enter>" to set a screen name
              root@container:~# #and use the usual "Ctrl+A,D" to disconnect from screen
              user@localhost:~$ screen -ls
              There is a screen on:
              25418.mygame (04/15/2019 11:41:56 PM) (Detached)
              user@localhost:~$ screen -r mygame
              root@container:~# #etc.





              share|improve this answer



























                0














                0










                0









                For me, the simple solution was to start screen on the host instead of in the container.



                user@localhost:~$ screen
                user@localhost:~$ lxc-attach -n yourcontainer
                root@container:~# ./start-gameserver.sh
                root@container:~# #Use "Ctrl+A:sessionname mygame<Enter>" to set a screen name
                root@container:~# #and use the usual "Ctrl+A,D" to disconnect from screen
                user@localhost:~$ screen -ls
                There is a screen on:
                25418.mygame (04/15/2019 11:41:56 PM) (Detached)
                user@localhost:~$ screen -r mygame
                root@container:~# #etc.





                share|improve this answer













                For me, the simple solution was to start screen on the host instead of in the container.



                user@localhost:~$ screen
                user@localhost:~$ lxc-attach -n yourcontainer
                root@container:~# ./start-gameserver.sh
                root@container:~# #Use "Ctrl+A:sessionname mygame<Enter>" to set a screen name
                root@container:~# #and use the usual "Ctrl+A,D" to disconnect from screen
                user@localhost:~$ screen -ls
                There is a screen on:
                25418.mygame (04/15/2019 11:41:56 PM) (Detached)
                user@localhost:~$ screen -r mygame
                root@container:~# #etc.






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 15 at 21:47









                LucLuc

                5745 silver badges10 bronze badges




                5745 silver badges10 bronze badges































                    draft saved

                    draft discarded















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • 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%2faskubuntu.com%2fquestions%2f716028%2fstart-a-screen-session-inside-lxd-managed-container%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

                    Tamil (spriik) Luke uk diar | Nawigatjuun

                    Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                    Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?