subuser-security / subuser

Run programs on linux with selectively restricted permissions.
http://subuser.org
GNU Lesser General Public License v3.0
890 stars 65 forks source link

Can't get subuser to run Ubuntu 22.04 / KDE neon #365

Open itsamemarkus opened 1 year ago

itsamemarkus commented 1 year ago

When I try to install subuser via repositories on a fresh Ubuntu 22.04 or KDE neon I get this error:

root@ubuntugnome:~# subuser list
Traceback (most recent call last):
  File "/usr/bin/subuser", line 24, in <module>
    command = subuserlib.commands.getCommand(sys.argv[1])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/subuserlib/commands.py", line 49, in getCommand
    commandModule = __import__("subuserlib.builtInCommands."+command, fromlist=[''])
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/subuserlib/builtInCommands/list.py", line 9, in <module>
    import subuserlib.classes.user
  File "/usr/lib/python3/dist-packages/subuserlib/classes/user.py", line 14, in <module>
    from subuserlib.classes import registry
  File "/usr/lib/python3/dist-packages/subuserlib/classes/registry.py", line 14, in <module>
    from subuserlib.classes import repositories
  File "/usr/lib/python3/dist-packages/subuserlib/classes/repositories.py", line 19, in <module>
    class Repositories(collections.Mapping,UserOwnedObject,FileBackedObject):
                       ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'collections' has no attribute 'Mapping'

This happens on my hardware and on a VM. The output for this issue is from the VM. Couldn't find a matching issue, is there a known fix for this?

The full install output with the fresh system that had no docker installed before

root@ubuntugnome:~# apt update && apt install subuser
Hit:1 http://de.archive.ubuntu.com/ubuntu lunar InRelease
Get:2 http://de.archive.ubuntu.com/ubuntu lunar-updates InRelease [90.7 kB]
Hit:3 http://de.archive.ubuntu.com/ubuntu lunar-backports InRelease
Get:4 http://de.archive.ubuntu.com/ubuntu lunar-security InRelease [90.7 kB]
Get:5 http://de.archive.ubuntu.com/ubuntu lunar-updates/main amd64 Packages [5,856 B]
Get:6 http://de.archive.ubuntu.com/ubuntu lunar-updates/main Translation-en [2,532 B]
Get:7 http://de.archive.ubuntu.com/ubuntu lunar-updates/main amd64 c-n-f Metadata [424 B]
Get:8 http://de.archive.ubuntu.com/ubuntu lunar-updates/universe amd64 Packages [4,212 B]
Get:9 http://de.archive.ubuntu.com/ubuntu lunar-updates/universe Translation-en [2,180 B]
Get:10 http://de.archive.ubuntu.com/ubuntu lunar-updates/universe amd64 c-n-f Metadata [220 B]
Get:11 http://de.archive.ubuntu.com/ubuntu lunar-security/main amd64 Packages [4,980 B]
Get:12 http://de.archive.ubuntu.com/ubuntu lunar-security/main Translation-en [2,368 B]
Get:13 http://de.archive.ubuntu.com/ubuntu lunar-security/main amd64 c-n-f Metadata [396 B]
Get:14 http://de.archive.ubuntu.com/ubuntu lunar-security/universe amd64 Packages [3,340 B]
Get:15 http://de.archive.ubuntu.com/ubuntu lunar-security/universe Translation-en [1,944 B]
Get:16 http://de.archive.ubuntu.com/ubuntu lunar-security/universe amd64 c-n-f Metadata [184 B]
Fetched 210 kB in 0s (469 kB/s)          
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  bridge-utils containerd docker.io fonts-font-awesome fonts-lato git git-man
  javascript-common liberror-perl libjs-jquery libjs-sphinxdoc
  libjs-underscore pigz runc sphinx-rtd-theme-common ubuntu-fan
Suggested packages:
  ifupdown aufs-tools btrfs-progs cgroupfs-mount | cgroup-lite debootstrap
  docker-doc rinse zfs-fuse | zfsutils git-daemon-run | git-daemon-sysvinit
  git-doc git-email git-gui gitk gitweb git-cvs git-mediawiki git-svn apache2
  | lighttpd | httpd
The following NEW packages will be installed:
  bridge-utils containerd docker.io fonts-font-awesome fonts-lato git git-man
  javascript-common liberror-perl libjs-jquery libjs-sphinxdoc
  libjs-underscore pigz runc sphinx-rtd-theme-common subuser ubuntu-fan
0 upgraded, 17 newly installed, 0 to remove and 0 not upgraded.
Need to get 83.0 MB of archives.
After this operation, 331 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://de.archive.ubuntu.com/ubuntu lunar/main amd64 fonts-lato all 2.0-2.1 [2,696 kB]
Get:2 http://de.archive.ubuntu.com/ubuntu lunar/universe amd64 pigz amd64 2.6-1 [63.6 kB]
Get:3 http://de.archive.ubuntu.com/ubuntu lunar/main amd64 bridge-utils amd64 1.7.1-1ubuntu1 [34.9 kB]
Get:4 http://de.archive.ubuntu.com/ubuntu lunar/main amd64 runc amd64 1.1.4-0ubuntu3 [4,452 kB]
Get:5 http://de.archive.ubuntu.com/ubuntu lunar/main amd64 containerd amd64 1.6.12-0ubuntu3 [35.2 MB]
Get:6 http://de.archive.ubuntu.com/ubuntu lunar/universe amd64 docker.io amd64 20.10.21-0ubuntu3 [33.7 MB]
Get:7 http://de.archive.ubuntu.com/ubuntu lunar/main amd64 fonts-font-awesome all 5.0.10+really4.7.0~dfsg-4.1 [516 kB]
Get:8 http://de.archive.ubuntu.com/ubuntu lunar/main amd64 liberror-perl all 0.17029-2 [25.6 kB]
Get:9 http://de.archive.ubuntu.com/ubuntu lunar-updates/main amd64 git-man all 1:2.39.2-1ubuntu1.1 [1,075 kB]
Get:10 http://de.archive.ubuntu.com/ubuntu lunar-updates/main amd64 git amd64 1:2.39.2-1ubuntu1.1 [3,572 kB]
Get:11 http://de.archive.ubuntu.com/ubuntu lunar/main amd64 javascript-common all 11+nmu1 [5,936 B]
Get:12 http://de.archive.ubuntu.com/ubuntu lunar/main amd64 libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB]
Get:13 http://de.archive.ubuntu.com/ubuntu lunar/main amd64 libjs-underscore all 1.13.4~dfsg+~1.11.4-3 [118 kB]
Get:14 http://de.archive.ubuntu.com/ubuntu lunar/main amd64 libjs-sphinxdoc all 5.3.0-4 [130 kB]
Get:15 http://de.archive.ubuntu.com/ubuntu lunar/main amd64 sphinx-rtd-theme-common all 1.2.0+dfsg-1 [991 kB]
Get:16 http://de.archive.ubuntu.com/ubuntu lunar/universe amd64 subuser all 0.6.2-3 [130 kB]
Get:17 http://de.archive.ubuntu.com/ubuntu lunar/universe amd64 ubuntu-fan all 0.12.16 [35.2 kB]
Fetched 83.0 MB in 4s (22.2 MB/s)      
Preconfiguring packages ...
Selecting previously unselected package fonts-lato.
(Reading database ... 175353 files and directories currently installed.)
Preparing to unpack .../00-fonts-lato_2.0-2.1_all.deb ...
Unpacking fonts-lato (2.0-2.1) ...
Selecting previously unselected package pigz.
Preparing to unpack .../01-pigz_2.6-1_amd64.deb ...
Unpacking pigz (2.6-1) ...
Selecting previously unselected package bridge-utils.
Preparing to unpack .../02-bridge-utils_1.7.1-1ubuntu1_amd64.deb ...
Unpacking bridge-utils (1.7.1-1ubuntu1) ...
Selecting previously unselected package runc.
Preparing to unpack .../03-runc_1.1.4-0ubuntu3_amd64.deb ...
Unpacking runc (1.1.4-0ubuntu3) ...
Selecting previously unselected package containerd.
Preparing to unpack .../04-containerd_1.6.12-0ubuntu3_amd64.deb ...
Unpacking containerd (1.6.12-0ubuntu3) ...
Selecting previously unselected package docker.io.
Preparing to unpack .../05-docker.io_20.10.21-0ubuntu3_amd64.deb ...
Unpacking docker.io (20.10.21-0ubuntu3) ...
Selecting previously unselected package fonts-font-awesome.
Preparing to unpack .../06-fonts-font-awesome_5.0.10+really4.7.0~dfsg-4.1_all.de
b ...
Unpacking fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ...
Selecting previously unselected package liberror-perl.
Preparing to unpack .../07-liberror-perl_0.17029-2_all.deb ...
Unpacking liberror-perl (0.17029-2) ...
Selecting previously unselected package git-man.
Preparing to unpack .../08-git-man_1%3a2.39.2-1ubuntu1.1_all.deb ...
Unpacking git-man (1:2.39.2-1ubuntu1.1) ...
Selecting previously unselected package git.
Preparing to unpack .../09-git_1%3a2.39.2-1ubuntu1.1_amd64.deb ...
Unpacking git (1:2.39.2-1ubuntu1.1) ...
Selecting previously unselected package javascript-common.
Preparing to unpack .../10-javascript-common_11+nmu1_all.deb ...
Unpacking javascript-common (11+nmu1) ...
Selecting previously unselected package libjs-jquery.
Preparing to unpack .../11-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ...
Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ...
Selecting previously unselected package libjs-underscore.
Preparing to unpack .../12-libjs-underscore_1.13.4~dfsg+~1.11.4-3_all.deb ...
Unpacking libjs-underscore (1.13.4~dfsg+~1.11.4-3) ...
Selecting previously unselected package libjs-sphinxdoc.
Preparing to unpack .../13-libjs-sphinxdoc_5.3.0-4_all.deb ...
Unpacking libjs-sphinxdoc (5.3.0-4) ...
Selecting previously unselected package sphinx-rtd-theme-common.
Preparing to unpack .../14-sphinx-rtd-theme-common_1.2.0+dfsg-1_all.deb ...
Unpacking sphinx-rtd-theme-common (1.2.0+dfsg-1) ...
Selecting previously unselected package subuser.
Preparing to unpack .../15-subuser_0.6.2-3_all.deb ...
Unpacking subuser (0.6.2-3) ...
Selecting previously unselected package ubuntu-fan.
Preparing to unpack .../16-ubuntu-fan_0.12.16_all.deb ...
Unpacking ubuntu-fan (0.12.16) ...
Setting up javascript-common (11+nmu1) ...
Setting up fonts-lato (2.0-2.1) ...
Setting up runc (1.1.4-0ubuntu3) ...
Setting up liberror-perl (0.17029-2) ...
Setting up bridge-utils (1.7.1-1ubuntu1) ...
Setting up pigz (2.6-1) ...
Setting up git-man (1:2.39.2-1ubuntu1.1) ...
Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ...
Setting up containerd (1.6.12-0ubuntu3) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service \u2192
 /lib/systemd/system/containerd.service.
Setting up fonts-font-awesome (5.0.10+really4.7.0~dfsg-4.1) ...
Setting up sphinx-rtd-theme-common (1.2.0+dfsg-1) ...
Setting up libjs-underscore (1.13.4~dfsg+~1.11.4-3) ...
Setting up ubuntu-fan (0.12.16) ...
Created symlink /etc/systemd/system/multi-user.target.wants/ubuntu-fan.service \u2192
 /lib/systemd/system/ubuntu-fan.service.
Setting up docker.io (20.10.21-0ubuntu3) ...
Adding group `docker' (GID 130) ...
Done.
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service \u2192 /li
b/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket \u2192 /lib/sy
stemd/system/docker.socket.
Setting up git (1:2.39.2-1ubuntu1.1) ...
Setting up libjs-sphinxdoc (5.3.0-4) ...
Setting up subuser (0.6.2-3) ...
Processing triggers for fontconfig (2.14.1-3ubuntu3) ...
Processing triggers for man-db (2.11.2-1) ...
p-himik commented 1 year ago

Just stumbled upon this as well. Apparently, in Python 3.10 they have moved collections.Mapping to collections.abc.Mapping, because breaking changes are always fun to deal with (I was probably made a bit salty by Python 3.10's changelog, but boy am I glad I don't deal with Python anymore).

So with its current implementation, subuser cannot be run on Python 3.10 or higher. One way around it is to either launch it with python3.9 manually (that you have to install separately via e.g. pyenv since it's not in the repos of Ubuntu 22.04 and newer) or to install it with pip from Python 3.9 (again, easier to do with pyenv).