Start a screen session inside LXD-managed container Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Working with screen sessions in LXD-managed containersWorking 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 ServerHow to set up X11 forwarding in byobu inside a LXC container(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

How to motivate offshore teams and trust them to deliver?

Why was the term "discrete" used in discrete logarithm?

Should I use Javascript Classes or Apex Classes in Lightning Web Components?

ListPlot join points by nearest neighbor rather than order

The logistics of corpse disposal

Why don't the Weasley twins use magic outside of school if the Trace can only find the location of spells cast?

How much radiation do nuclear physics experiments expose researchers to nowadays?

Disable hyphenation for an entire paragraph

Storing hydrofluoric acid before the invention of plastics

How widely used is the term Treppenwitz? Is it something that most Germans know?

Gastric acid as a weapon

How to bypass password on Windows XP account?

Why is "Captain Marvel" translated as male in Portugal?

Does accepting a pardon have any bearing on trying that person for the same crime in a sovereign jurisdiction?

How to assign captions for two tables in LaTeX?

Stars Make Stars

Is above average number of years spent on PhD considered a red flag in future academia or industry positions?

Is high blood pressure ever a symptom attributable solely to dehydration?

When is phishing education going too far?

Should gear shift center itself while in neutral?

What is the musical term for a note that continously plays through a melody?

Check which numbers satisfy the condition [A*B*C = A! + B! + C!]

When to stop saving and start investing?

How do I stop a creek from eroding my steep embankment?



Start a screen session inside LXD-managed container



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Working with screen sessions in LXD-managed containersWorking 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 ServerHow to set up X11 forwarding in byobu inside a LXC container(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;








6















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




























    6















    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
























      6












      6








      6


      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.

      5041128




      5041128




















          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/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%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.

            69.9k12173267




            69.9k12173267












            • 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 4 hours ago









                LucLuc

                51649




                51649



























                    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

                    Möglingen Índice Localización Historia Demografía Referencias Enlaces externos Menú de navegación48°53′18″N 9°07′45″E / 48.888333333333, 9.129166666666748°53′18″N 9°07′45″E / 48.888333333333, 9.1291666666667Sitio web oficial Mapa de Möglingen«Gemeinden in Deutschland nach Fläche, Bevölkerung und Postleitzahl am 30.09.2016»Möglingen

                    Virtualbox - Configuration error: Querying “UUID” failed (VERR_CFGM_VALUE_NOT_FOUND)“VERR_SUPLIB_WORLD_WRITABLE” error when trying to installing OS in virtualboxVirtual Box Kernel errorFailed to open a seesion for the virtual machineFailed to open a session for the virtual machineUbuntu 14.04 LTS Virtualbox errorcan't use VM VirtualBoxusing virtualboxI can't run Linux-64 Bit on VirtualBoxUnable to insert the virtual optical disk (VBoxguestaddition) in virtual machine for ubuntu server in win 10VirtuaBox in Ubuntu 18.04 Issues with Win10.ISO Installation

                    Antonio De Lisio Carrera Referencias Menú de navegación«Caracas: evolución relacional multipleja»«Cuando los gobiernos subestiman a las localidades: L a Iniciativa para la Integración de la Infraestructura Regional Suramericana (IIRSA) en la frontera Colombo-Venezolana»«Maestría en Planificación Integral del Ambiente»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«Conózcanos»«Caracas: evolución relacional multipleja»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»