How to keep my python running in the container properly while the screen is locked?(N7 2013 flo)



  • @futurecn said in How to keep my python running in the container properly while the screen is locked?(N7 2013 flo):

    It seems that I cannot run apt install on the original ubuntu out side the container?Why is that?

    It is unsupported. UT is not a traditional Linux distribution and phones are not traditional PCs. The rootfs is read-only for these reasons.



  • @dobey
    @jezek
    That's true.
    I tried apt install screen on ubport and apt can't run.
    But when I try pip3 install somepackage on the Ubport, It goes right and the python package installed. Both of them will be successfully installed inside the container. Why is that? Does apt use a different space from pip on the Ubport ?

    Is anyother way to meet the need?
    For example:

    1. Add a switch to turn off/on the screen backlight instead of locking the screen to keep the container running?

    2. Add a tunnel so that the openssh server inside the container may be connect though a user-defined port other than port22 of the original Ubport. Like the Google Docker command docker run -d -p 127.0.0.1:5001:5000 training/webapp bash. Thus we can get an access like this: Desktop PC Terminal->port xx tunnel inside the container->container screen command or reconnect to a running screen.

    3. Make a command like the Google Docker. Like ctrl+p+q to jump outside and keep container running and docker attach d48b21a7e439to reconnect to a running container.



  • @futurecn said in How to keep my python running in the container properly while the screen is locked?(N7 2013 flo):

    I tried apt install screen on ubport and apt can't run.

    You need to install screen into your libertine container.

    $ libertine-container-manager install-package -p screen
    

    Then you can run a screen session.

    $ libertine-container-manager exec -c "screen"
    

    NOTE: first time I got access permission error for /var/run/screen. You can fix this by logging into container and change permissions.

    $ libertine-container-manager exec -c "/bin/bash"
    root@ubuntu-phablet:/# chmod 777 /var/run/screen/
    root@ubuntu-phablet:/# exit
    

    After this, I was able to run a screen instance, deattach, bu no reattach success after libertine container was exited and run again. 😞

    # enter container, run screen and deattach
    $ libertine-container-manager exec -c "/bin/bash"
    root@ubuntu-phablet:/# screen -ls
    No Sockets found in /var/run/screen/S-root.
    
    root@ubuntu-phablet:/# screen -dmS worker
    root@ubuntu-phablet:/# screen -ls
    There is a screen on:
    	30070.worker	(15.02.2019 17:57:40)	(Detached)
    1 Socket in /var/run/screen/S-root.
    
    # worker is in deattached state, reattach
    root@ubuntu-phablet:/# screen -r worker
    
    # Now I'm succesfully attaced to worker, using "ctrl-a d" to deatach again
    [detached from 30530.worker]
    root@ubuntu-phablet:/# screen -ls
    There is a screen on:
    	30530.worker	(15.02.2019 18:00:38)	(Detached)
    1 Socket in /var/run/screen/S-root.
    
    # exit container and reenter again
    root@ubuntu-phablet:/# exit
     libertine-container-manager exec -c "/bin/bash"
    root@ubuntu-phablet:/# screen -ls
    There is a screen on:
    	30530.worker	(15.02.2019 18:00:37)	(Detached)
    1 Socket in /var/run/screen/S-root.
    root@ubuntu-phablet:/# screen -r worker
    
    Error: Cannot find master process to attach to!
    root@ubuntu-phablet:/# 
    


  • @futurecn Maybe it would help if you could explain what you're trying to do exactly, rather than making comparisons to features in docker and stating we should have those. It's not easy to provide help, when we cannot understand what exactly you're trying to do.



  • @jezek @dobey
    OK.
    Just things I want.
    Make the Nexus 7 pad working as a Raspberry Pi with battery , touch pad and screen.
    Which means:
    1.Keep program running well no matter the hardware screen is closed, disconnected(locked) or not.
    2.Get a ssh access directly to the root bash on the Ubport(or the container root bash) ,in which we can install whatever I what.
    3.Install GUI desktop like Gnome or Kde , thus we can run UI apps like chromium or gedit.



  • @futurecn said in How to keep my python running in the container properly while the screen is locked?(N7 2013 flo):

    Hi,there.
    I just tried the Ubport on Nexus 7 2013 flo.
    Thanks for the owe-some job, Now the Nexus turns out to be a little server in my pocket, with java and python.

    I use ssh to access the main ubuntu (mount with rw) and then run the container with

    libertine-container-manager exec -i CONTAINER-IDENTIFIER -c "COMMAND-LINE"
    

    And get a root bash in the container.

    Here is my problems:

    1. When I start script via Destop ssh ->ubport->container->bash->python script.The script runs selenium and start chrome. It runs fine. Once I lock the Nexus screen.The program stoped, and python report errors. It seems that the container will stop running while locker. How can I keep the program running will locking the screen.

    I don't really understand. Are you saying you are starting a graphical X program on UT out of the libertine container from an ssh connection? I don't think I ever managed to do that. Who would start xmir for you? Maybe you can give some more details.

    1. It seems that I cannot run apt install on the original ubuntu out side the container?Why is that?

    root partition is full. check df -h /

    E: You don't have enough free space in /var/cache/apt/archives/.
    
    

    on the N7 there is an easy work around. boot into recovery and increase the image size. Something like resize2fs ubuntu.img 5G

    1. How can I keep program running and quit the ssh tunnel?Then reconnect to it, to seen what the program has returned?

    I would have said screen but now @jezek has explained how this does not work. I'm surprised this doesn't work. what if you enter screen first and go into libertine inside of screen? Or maybe with the libertine-launch version of shell access for phablet user? http://docs.ubports.com/en/latest/userguide/dailyuse/libertine.html#shell-access



  • @futurecn said in How to keep my python running in the container properly while the screen is locked?(N7 2013 flo):

    Make the Nexus 7 pad working as a Raspberry Pi with battery , touch pad and screen.

    If this is what you want, then UT is most likely not what you want. UT is an OS designed and optimized for phone/tablet usage, to conserve power, prevent applications from stealing resources in the background, etc… If what you want is to treat your tablet like a Raspberry Pi running a traditional Linux distro, then you probably should instead run a traditional Linux distro on it.

    You can however use UT Tweak Tool (in the Open Store), to disable app suspension for specific app IDs. If you want to ssh directly into the container, as "root" (it's fake root, as the container is unprivileged, so you should avoid installing things like sudo), you should enable SSH on the host, and configure your client side .ssh/config file to run libertine-container-manager exec -i <container_id> -c /bin/bash when connecting to your tablet.

    As for installing GNOME/KDE, you can certainly install them inside the container, but you cannot replace Unity 8 with them. If you don't want Unity 8 as the environment, you should run something other than UT.



  • @dobey @doniks @dobey
    Well.First,I have to admit that I'm not a seasoned linux player.
    I searched the keywords Ubuntu nexus7 and Google told me to try Ubuntu Torch.
    I got one more question for UT:Is there anyways to install a UI apps like chromium on it and be able to browser pages as we usually do on Desktops. I successfully installed the chromium in the container and use a selenium to operate it. But don't know how to display the UI. I have to run it with --headlessand --disable-gpu.
    Then, as @dobey said run a traditional desktop Linux distro on the pad, I tried again and got the pages below.
    1.https://wiki.ubuntu.com/Nexus7/Installation
    This is what I want, but it seems that it is Nexus7-2012 not the flo. And the core version is a little bit old.
    2.https://askubuntu.com/questions/879307/how-to-install-ubuntu-desktop-version-on-nexus-7-2013flo.
    No reply.
    To me , I just know both pi and flo have the arm architecture , and both of them can run linux desktop or Android system. I don't know why it's hard to find a desktop linux for flo. Which might lead to another question, what is the difference between the
    arm ubuntu-desktop and ubuntu-torch , and why ubuntu-torch is more popular than ubuntu-desktop.
    Any suggestions?Thanks for reply.
    By the way, Do you know the su passwd on UT, which i failed to find in UT documents.



  • @futurecn said in How to keep my python running in the container properly while the screen is locked?(N7 2013 flo):

    I got one more question for UT:Is there anyways to install a UI apps like chromium on it and be able to browser pages as we usually do on Desktops. I successfully installed the chromium in the container and use a selenium to operate it. But don't know how to display the UI. I have to run it with --headlessand --disable-gpu.

    As has been said multiple times already, the way to install legacy apps as you mean here, is via libertine. However, it is experimental, GPU accelerated video does not work with it, and not all apps will work.

    To me , I just know both pi and flo have the arm architecture , and both of them can run linux desktop or Android system. I don't know why it's hard to find a desktop linux for flo.

    How do you know this to be true? Yes, both systems are based on ARM, but they are both very different things, and not as you suggest. ARM is not like X86. Every system is different, and a custom image is required for every individual system. What you've stated is not fact, which is why it is so hard for you to find a traditional Linux to run on the tablet. One cannot simply take a generic Linux distro and throw it on any ARM device and expect it to magically work. Phones/tablets are not PCs.

    Which might lead to another question, what is the difference between the arm ubuntu-desktop and ubuntu-torch , and why ubuntu-torch is more popular than ubuntu-desktop.

    It's touch, not torch. It's more "popular" for phones/tablets because it's designed to work on such things, and we build images specific to those devices, so that things will work. However, as I said, it is not a traditional Linux distribution.

    Any suggestions?Thanks for reply.

    My suggestion is to stop trying to use a tablet like it's a general purpose x86 PC. It is not. If what you want is a generic thing like an x86 PC or a Raspberry Pi, then use one of those instead of a tablet.

    By the way, Do you know the su passwd on UT, which i failed to find in UT documents.

    It's the same as Ubuntu on a PC. There is no root password. For sudo you use the password/PIN you've set up. If you have only slide to unlock, then the password is empty.



  • @futurecn said in How to keep my python running in the container properly while the screen is locked?(N7 2013 flo):

    I got one more question for UT:Is there anyways to install a UI apps like chromium on it and be able to browser pages as we usually do on Desktops. I successfully installed the chromium in the container and use a selenium to operate it. But don't know how to display the UI. I have to run it with --headlessand --disable-gpu.

    As has been said multiple times already, the way to install legacy apps as you mean here, is via libertine. However, it is experimental, GPU accelerated video does not work with it, and not all apps will work.

    Indeed, @futurecn check out libertine. It allows you to install "desktop" apps on UT. It's not all perfect, but you can get quite a bit done. I don't know what selenium is and I never tried chromium, but from what I heard chromium might be one of the tougher codebases to get going. I had some success with firefox on libertine.

    Any suggestions?Thanks for reply.

    My suggestion is to stop trying to use a tablet like it's a general purpose x86 PC. It is not. If what you want is a generic thing like an x86 PC or a Raspberry Pi, then use one of those instead of a tablet.

    Well, as it was said, it can be tough to find the right kind of linux-on-arm setup. UT might not be what you @futurecn are looking for, but then, that perfect system might simply not exist. So, you could try to make do with what is available.. That's one of the beauties of FOSS, right! UT is available.

    And I think UT can be a nice starting point for hacking it into what you want. Just keep in mind that you might be "working against" some of the design decisions of UT. Apply an attitude of "keeping the pieces once you broke it":) Manage your expectations about which direction the UBPorts project will move UT into. Supporting your server-in-my-pocket use case is not a priority for UT. That being said, I had some fun hacking UT myself in ways it wasn't meant to and I can only wish you as much fun with your endeavors 🙂



  • @dobey @doniks Ok,Thanks for offering these suggestions.
    I decided to turn back to pi and setup a hdmi screen for it. Meanwhile try to run some scripts on UT flo. After all,with Java & Python & command line, there are lots of program can be run already.


Log in to reply