Giter Site home page Giter Site logo

sailfish-containers / harbour-containers Goto Github PK

View Code? Open in Web Editor NEW
50.0 4.0 10.0 24.08 MB

A LXC manager and runner for SailfishOS

License: GNU General Public License v3.0

QML 23.79% Shell 16.39% C++ 0.36% Python 13.48% QMake 1.84% Perl 44.14%
sailfishos sailfish lxc lxc-containers containers desktop

harbour-containers's People

Contributors

dashinfantry avatar eltmosen avatar hengyedev avatar kabouik avatar r3vn avatar vaskas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

harbour-containers's Issues

Void of content

The Containers app stops showing content after icons are added...

aarch64?

Any chance of an aarch64 build?

[Wiki] Configuring desktop environments

Probably low priority

Wiki entries with some basic guidelines on how to set up xfce4, i3, i3-gaps and other DEs and WMs could be useful. I reckon a good fraction of new users would be pretty excited about LXC and install it on their phone, then be overwhelmed and give up before their containers are actually well configured to be easily used on mobile. Either because configuring an OS is time consuming, let alone on a mobile device that requires some specific tricks they might not know about, or because at first a desktop OS on small screen with no adequate controls or DPI could appear as a bad idea. Yet we know it's not cumbersome to use once configured (at least on Pro¹).

Messy and non-exhaustive list of things that could be mentioned:

  • xfce4
  • i3 and variants
  • DPI, UI scaling, font size
  • touch scrolling in Firefox
  • right click emulation (I don't have much knowledge on that but I noticed not all applications emulate it the same way: some use long press, some use Shift + tap, some just have no support for touch right clicks; this could be mentioned)
  • Onboard
  • option to enable mouse (add -plugin evdevmouse to LIPSTICK_OPTIONS: in /var/lib/environment/compositor/droid-hal-device.conf); no visible cursor for now
  • landscape versus portrait uses and implications for Onboard
  • possibly provide some default configuration files for Onboard and xfce4 to automatically install with dconf during X setup; there should be a security if the setup button is pressed when configuration files already exist: either abort, or ask for confirmation to reset to default
  • maybe a mention of the importance of setting keybindings, even for xfce4, and even for touch-only devices, because accurately tapping or moving windows on a capacitive screen is not fun at all; possibly list some suggestions for xfce4 (might not be necessary for i3, it's implied): move window, maximize, tile, minimize, resize, switch tabs in browser…
  • perhaps a bit off-topic: indicating what file to edit to add mount points, namely mount /home/nemo either as an additional mount, or merge it with /merge/user

Wiki entries shouldn't be too verbose though. Exactly the opposite of this message. We know nobody reads wikis. But pictures and some guidelines on which files to edit on the first run, possibly from lxc-attach until the DPI is adjusted, would be cool. Scripts for "sane mobile default configurations" too.

Answering @edp17's comment in another issue:

@Kabouik : Yeah, some settings are not easy to set in the xfce4. Especially when a dropdown is involved. When I tap on it, the dropdown opens but immediately closes before I can select any options. (This is not limited to the onboard setup but for anything else e.g. setting the tree pane icon size of File Manager is a mission impossible task. :)

I don't currently have a container running xfce4 but I don't remember that, and I don't think I had that in sailfish_ubu_chroot (maybe check this in case you observe the same issue and I just didn't notice it in real use). I do observe, however, Firefox context menu being a bit difficult sometimes. But not all the time, and when this happens, just keeping my finger on the screen and sliding it to select the menu entry I want works. Can you try that in the file manager too?

Error after deleting a container

I installed the 0.6 version from Chum on Xperia 10 III (aarch64).
I launched it, created new Debian container that was supposed to have a GUI. It got stuck at "starting setup" so I left it overnight, in the morning it still said the same thing. So I deleted the cobtainer, it didn't disappear, so I deleted it again. When I launched the app again it showed an empty screen, with no container or option to add the new one.
If I launch it from the terminal I am getting

[W] unknown:12 - file:///usr/share/harbour-containers/qml/harbour-containers.qml:12:5: QML Daemon: QDBusError("org.freedeskto
p.DBus.Python.subprocess.CalledProcessError", "Traceback (most recent call last):\n  File \"/usr/lib64/python3.8/site-package
s/dbus/service.py\", line 711, in _message_cb\n    retval = candidate_method(self, *args, **keywords)\n  File \"/usr/share/ha
rbour-containers/service/daemon.py\", line 477, in get_containers\n    self._refresh()\n  File \"/usr/share/harbour-container
s/service/daemon.py\", line 115, in _refresh\n    self.containers = lxc.get_containers()\n  File \"/usr/share/harbour-contain
ers/service/libs/lxc.py\", line 41, in get_containers\n    cmd_out = subprocess.check_output(['lxc-info', '-n', container,'-p
','-s','-S']).decode().split(\"\\n\")\n  File \"/usr/lib64/python3.8/subprocess.py\", line 415, in check_output\n    return r
un(*popenargs, stdout=PIPE, timeout=timeout, check=True,\n  File \"/usr/lib64/python3.8/subprocess.py\", line 516, in run\n
raise CalledProcessError(retcode, process.args,\nsubprocess.CalledProcessError: Command '['lxc-info', '-n', 'Debian', '-p',
'-s', '-S']' returned non-zero exit status 1.\n")
[W] unknown:12 - file:///usr/share/harbour-containers/qml/harbour-containers.qml:12:5: QML Daemon: QDBusError("org.freedeskto
p.DBus.Python.subprocess.CalledProcessError", "Traceback (most recent call last):\n  File \"/usr/lib64/python3.8/site-package
s/dbus/service.py\", line 711, in _message_cb\n    retval = candidate_method(self, *args, **keywords)\n  File \"/usr/share/ha
rbour-containers/service/daemon.py\", line 477, in get_containers\n    self._refresh()\n  File \"/usr/share/harbour-container
s/service/daemon.py\", line 115, in _refresh\n    self.containers = lxc.get_containers()\n  File \"/usr/share/harbour-contain
ers/service/libs/lxc.py\", line 41, in get_containers\n    cmd_out = subprocess.check_output(['lxc-info', '-n', container,'-p
','-s','-S']).decode().split(\"\\n\")\n  File \"/usr/lib64/python3.8/subprocess.py\", line 415, in check_output\n    return r
un(*popenargs, stdout=PIPE, timeout=timeout, check=True,\n  File \"/usr/lib64/python3.8/subprocess.py\", line 516, in run\n
raise CalledProcessError(retcode, process.args,\nsubprocess.CalledProcessError: Command '['lxc-info', '-n', 'Debian', '-p',
'-s', '-S']' returned non-zero exit status 1.\n")
[W] unknown:12 - file:///usr/share/harbour-containers/qml/harbour-containers.qml:12:5: QML Daemon: QDBusError("org.freedeskto
p.DBus.Python.subprocess.CalledProcessError", "Traceback (most recent call last):\n  File \"/usr/lib64/python3.8/site-package
s/dbus/service.py\", line 711, in _message_cb\n    retval = candidate_method(self, *args, **keywords)\n  File \"/usr/share/ha
rbour-containers/service/daemon.py\", line 477, in get_containers\n    self._refresh()\n  File \"/usr/share/harbour-container
s/service/daemon.py\", line 115, in _refresh\n    self.containers = lxc.get_containers()\n  File \"/usr/share/harbour-contain
ers/service/libs/lxc.py\", line 41, in get_containers\n    cmd_out = subprocess.check_output(['lxc-info', '-n', container,'-p
','-s','-S']).decode().split(\"\\n\")\n  File \"/usr/lib64/python3.8/subprocess.py\", line 415, in check_output\n    return r
un(*popenargs, stdout=PIPE, timeout=timeout, check=True,\n  File \"/usr/lib64/python3.8/subprocess.py\", line 516, in run\n
raise CalledProcessError(retcode, process.args,\nsubprocess.CalledProcessError: Command '['lxc-info', '-n', 'Debian', '-p',
'-s', '-S']' returned non-zero exit status 1.\n")
[W] unknown:12 - file:///usr/share/harbour-containers/qml/harbour-containers.qml:12:5: QML Daemon: QDBusError("org.freedeskto
p.DBus.Python.subprocess.CalledProcessError", "Traceback (most recent call last):\n  File \"/usr/lib64/python3.8/site-package
s/dbus/service.py\", line 711, in _message_cb\n    retval = candidate_method(self, *args, **keywords)\n  File \"/usr/share/ha
rbour-containers/service/daemon.py\", line 477, in get_containers\n    self._refresh()\n  File \"/usr/share/harbour-container
s/service/daemon.py\", line 115, in _refresh\n    self.containers = lxc.get_containers()\n  File \"/usr/share/harbour-contain
ers/service/libs/lxc.py\", line 41, in get_containers\n    cmd_out = subprocess.check_output(['lxc-info', '-n', container,'-p
','-s','-S']).decode().split(\"\\n\")\n  File \"/usr/lib64/python3.8/subprocess.py\", line 415, in check_output\n    return r
un(*popenargs, stdout=PIPE, timeout=timeout, check=True,\n  File \"/usr/lib64/python3.8/subprocess.py\", line 516, in run\n
raise CalledProcessError(retcode, process.args,\nsubprocess.CalledProcessError: Command '['lxc-info', '-n', 'Debian', '-p',
'-s', '-S']' returned non-zero exit status 1.\n")
[W] unknown:12 - file:///usr/share/harbour-containers/qml/harbour-containers.qml:12:5: QML Daemon: QDBusError("org.freedeskto
p.DBus.Python.subprocess.CalledProcessError", "Traceback (most recent call last):\n  File \"/usr/lib64/python3.8/site-package
s/dbus/service.py\", line 711, in _message_cb\n    retval = candidate_method(self, *args, **keywords)\n  File \"/usr/share/ha
rbour-containers/service/daemon.py\", line 477, in get_containers\n    self._refresh()\n  File \"/usr/share/harbour-container
s/service/daemon.py\", line 115, in _refresh\n    self.containers = lxc.get_containers()\n  File \"/usr/share/harbour-contain
ers/service/libs/lxc.py\", line 41, in get_containers\n    cmd_out = subprocess.check_output(['lxc-info', '-n', container,'-p
','-s','-S']).decode().split(\"\\n\")\n  File \"/usr/lib64/python3.8/subprocess.py\", line 415, in check_output\n    return r
un(*popenargs, stdout=PIPE, timeout=timeout, check=True,\n  File \"/usr/lib64/python3.8/subprocess.py\", line 516, in run\n
raise CalledProcessError(retcode, process.args,\nsubprocess.CalledProcessError: Command '['lxc-info', '-n', 'Debian', '-p',
'-s', '-S']' returned non-zero exit status 1.\n")
[W] unknown:12 - file:///usr/share/harbour-containers/qml/harbour-containers.qml:12:5: QML Daemon: QDBusError("org.freedeskto
p.DBus.Python.subprocess.CalledProcessError", "Traceback (most recent call last):\n  File \"/usr/lib64/python3.8/site-package
s/dbus/service.py\", line 711, in _message_cb\n    retval = candidate_method(self, *args, **keywords)\n  File \"/usr/share/ha
rbour-containers/service/daemon.py\", line 477, in get_containers\n    self._refresh()\n  File \"/usr/share/harbour-container
s/service/daemon.py\", line 115, in _refresh\n    self.containers = lxc.get_containers()\n  File \"/usr/share/harbour-contain
ers/service/libs/lxc.py\", line 41, in get_containers\n    cmd_out = subprocess.check_output(['lxc-info', '-n', container,'-p
','-s','-S']).decode().split(\"\\n\")\n  File \"/usr/lib64/python3.8/subprocess.py\", line 415, in check_output\n    return r
un(*popenargs, stdout=PIPE, timeout=timeout, check=True,\n  File \"/usr/lib64/python3.8/subprocess.py\", line 516, in run\n
raise CalledProcessError(retcode, process.args,\nsubprocess.CalledProcessError: Command '['lxc-info', '-n', 'Debian', '-p',
'-s', '-S']' returned non-zero exit status 1.\n")

I guess there is something leftover from the debian container, how can I delete it?

Container broke and app is blank, how to reset settings?

I wanted to add an Alpine container but during setup it froze. After I killed the app and opened it again the main screen is now blank. I have already deleted the Alpine LXC files but it seems like the app is still looking for them even after a reinstall. How can I reset everything?

Below is the terminal output from launching the app:

[D] unknown:0 - Using Wayland-EGL
[D] onCompleted:12 - DB created.
[W] unknown:12 - file:///usr/share/harbour-containers/qml/harbour-containers.qml:12:5: QML Daemon: QDBusError("org.freedesktop.DBus.Python.subprocess.CalledProcessError", "Traceback (most recent call last):\n  File \"/usr/lib/python3.8/site-packages/dbus/service.py\", line 711, in _message_cb\n    retval = candidate_method(self, *args, **keywords)\n  File \"/usr/share/harbour-containers/service/daemon.py\", line 475, in get_containers\n    self._refresh()\n  File \"/usr/share/harbour-containers/service/daemon.py\", line 113, in _refresh\n    self.containers = lxc.get_containers()\n  File \"/usr/share/harbour-containers/service/libs/lxc.py\", line 41, in get_containers\n    cmd_out = subprocess.check_output(['lxc-info', '-n', container,'-p','-s','-S']).decode().split(\"\\n\")\n  File \"/usr/lib/python3.8/subprocess.py\", line 415, in check_output\n    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,\n  File \"/usr/lib/python3.8/subprocess.py\", line 516, in run\n    raise CalledProcessError(retcode, process.args,\nsubprocess.CalledProcessError: Command '['lxc-info', '-n', 'Alpine', '-p', '-s', '-S']' returned non-zero exit status 1.\n")

Little GUI glitch (init container config button)

This is a little glitch in the GUI. When I open the 'advanced controls' option only half of the 'init container config' button is visible. (The screen is not tall enough to display the whole button.) And when I manage to tap on the button, the button disappears. (More precisely the button is still there I guess, only its position is "outside" of the screen's view.)

Please see the attached screenshots:
half_init_container_button
init_container_button_disappears

Xsession fail to start on ubuntu focal/eoan

xsession setup
setup process seems to work fine using debian.sh

xsession start
Xwayland immediately crash after connecting to qxdisplay's socket

start_desktop.sh output on ubuntu eoan:

root@ubu-xfce:/# /mnt/guest/start_desktop.sh 5 user

glamor: 'wl_drm' not supported
Missing Wayland requirements for glamor GBM backend
Failed to initialize glamor, falling back to sw
xinit: XFree86_VT property unexpectedly has 0 items instead of 1
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 774, clipping.
>                   X11 cannot support keycodes above 255.
Errors from xkbcomp are not fatal to the X server
xinit: connection to X server lost

waiting for X server to shut down ....
......
xinit: X server slow to shut down, sending KILL signal

waiting for server to die 

Left over files on removal (feature request)

When I uninstall the harbour-containers app, it leaves some files in the '/usr/share/harbour-containers/service/libs/__ pycache__':
init.cpython-38.pyc
lxc.cpython-38.pyc
qxcompositor.cpython-38.pyc
It also leaves the configuration of the created container in the '/var/lib/lxc/' folder and doesn't remove the files from the '/home/.lxc' folder.
I know these folders/files are kept because of SFOS' uninstall working order, but if you could include a button that runs a script, that is doing housekeeping before somebody decides to uninstall the app, that would be beneficial. (The downloaded data in 'home/.lxc' can be painful as eating a lot of storage.)

"X session" button doesn't work

Steps to reproduce

  1. Install a Debian container
  2. Install dbus-x11 inside of the container (see #17)
  3. Install sudo and run the debian.sh script from https://talk.maemo.org/showthread.php?t=101080
  4. Confirm the desktop starting, kill qxdisplay
  5. Go into harbour-containers -> Container screen and click X session
  6. Enter the PIN code

Expected results

  1. The qxdisplay window should pop up
  2. The desktop should start

Actual results

  • No visible feedback in the GUI or stdout (if running harbour-containers in the Fingerterm)
  • Desktop session not started

Android containers

Some devices can run Alien Dalvik, but there are some limitations such as no Bluetooth or no camera, and not all devices have an AD version. I believe @0312birdzhang has been working on porting Anbox to SailfishOS because I saw some rpms on OBS, but as far as I understand it is not working yet.

I was stumbling upon this article: https://stgraber.org/2013/12/23/lxc-1-0-some-more-advanced-container-usage/

This looks interesting, Would the part on "Android containers" work with sailfish-containers? @0312birdzhang, what do you think?

I pasted the corresponding section below:


Android containers

I’ve often been asked whether it was possible to run Android in an LXC container. Well, the short answer is yes. However it’s not very simple and it really depends on what you want to do with it.

The first thing you’ll need if you want to do this is get your machine to run an Android kernel, you’ll need to have any modules needed by Android built and loaded before you can start the container.

Once you have that, you’ll need to create a new container by hand.
Let’s put it in /var/lib/lxc/android/, in there, you need a configuration file similar to this one:

lxc.rootfs = /var/lib/lxc/android/rootfs
lxc.utsname = armhf

lxc.network.type = none

lxc.devttydir = lxc
lxc.tty = 4
lxc.pts = 1024
lxc.arch = armhf
lxc.cap.drop = mac_admin mac_override
lxc.pivotdir = lxc_putold

lxc.hook.pre-start = /var/lib/lxc/android/pre-start.sh

lxc.aa_profile = unconfined

/var/lib/lxc/android/pre-start.sh is where the interesting bits happen. It needs to be an executable shell script, containing something along the lines of:

#!/bin/sh
mkdir -p $LXC_ROOTFS_PATH
mount -n -t tmpfs tmpfs $LXC_ROOTFS_PATH

cd $LXC_ROOTFS_PATH
cat /var/lib/lxc/android/initrd.gz | gzip -d | cpio -i

# Create /dev/pts if missing
mkdir -p $LXC_ROOTFS_PATH/dev/pts

Then get the initrd for your device and place it in /var/lib/lxc/android/initrd.gz.

At that point, when starting the LXC container, the Android initrd will be unpacked on a tmpfs (similar to Android’s ramfs) and Android’s init will be started which in turn should mount any partition that Android requires and then start all of the usual services.

Because there are no apparmor, cgroup or even network configuration applied to it, the container will have a lot of rights and will typically completely crash the machine. You unfortunately have to be familiar with the way Android works and not be afraid to modify its init scripts if not even its init process to only start the bits you actually want.

I can’t provide a generic recipe there as it completely depends on what you’re interested on, what version of Android and what device you’re using. But it’s clearly possible to do and you may want to look at Ubuntu Touch to see how we’re doing it by default there.

One last note, Android’s init script isn’t in /sbin/init, so you need to tell LXC where to load it with:

lxc-start -n android -- /init

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.