Python2 command not found in core20

Hi, I’m moving my folding-at-home snap to core20 as a base.

However, python got deprecated and is now python2. However, if I add python2 as a stage package, then I’m not able to find its content anywhere. I considered it could have been an issue with dependencies. So I made a part just to pull them all:

    plugin: nil
      - python2
      - libpython2-stdlib 
      - libpython2.7-minimal 
      - libpython2.7-stdlib 
      - python2-minimal 
      - python2.7 
      - python2.7-minimal

Then I have other parts to require it with after:

# <--- Desktop frontend --->
    plugin: dump
    source-type: deb
      - libxtst6
      - libcanberra-gtk-module
      - libatk-adaptor
      - libgail-common
      - desktop-gtk2
      - python2
      - python-gtk2
      - fahclient

Still building fails with:

Failed to generate snap metadata: The specified command 'desktop-launch python2 $SNAP/usr/bin/FAHControl' defined in the app 'FAHControl' does not exist.
Ensure that 'desktop-launch python2 $SNAP/usr/bin/FAHControl' is installed with the correct path.

As I build with --debug option I get into the snap, and indeed python2 is nowhere to be found:

ubuntu # ls /usr/lib
X11          binfmt.d   environment.d  gnupg    kernel  modules-load.d  pkg-config.multiarch  python3.8  snapd  sysctl.d    tmpfiles.d
apt          compat-ld  gcc            gnupg2   locale  openssh         pkgconfig             python3.9  ssl    systemd     valgrind
bfd-plugins  dpkg       git-core       gold-ld  mime    os-release      python3               sasl2      sudo   sysusers.d  x86_64-linux-gnu
ubuntu # ls /usr/bin
 X11                         dpkg-genchanges           glib-genmarshal              md5sum                      resolvectl                tr
'['                          dpkg-gencontrol           glib-gettextize              md5sum.textutils            rev                       truncate
 aa-enabled                  dpkg-gensymbols           glib-mkenums                 mesg                        rgrep                     tset
 aa-exec                     dpkg-maintscript-helper   gobject-query                mkfifo                      rlogin                    tsort
 addpart                     dpkg-mergechangelogs      gold                         mksquashfs                  rpcgen                    tty
 addr2line                   dpkg-name                 gpasswd                      mtrace                      rsh                       tzselect
 advdef                      dpkg-parsechangelog       gpg                          namei                       run-mailcap               ubuntu-core-launcher
 advmng                      dpkg-query                gpg-agent                    nawk                        runcon                    ucf
 advpng                      dpkg-scanpackages         gpg-connect-agent            newgrp                      savelog                   ucfq
 advzip                      dpkg-scansources          gpgconf                      nice                        scp                       ucfr
 apt                         dpkg-shlibdeps            gpgv                         nl                          script                    uconv
 apt-cache                   dpkg-source               gprof                        nm                          scriptreplay              unexpand
 apt-cdrom                   dpkg-split                gresource                    nohup                       sdiff                     uniq
 apt-config                  dpkg-statoverride         groups                       nproc                       see                       unlink
 apt-get                     dpkg-trigger              gsettings                    nsenter                     select-editor             unlzma
 apt-key                     dpkg-vendor               gtester                      numfmt                      sensible-browser          unshare
 apt-mark                    du                        gtester-report               objcopy                     sensible-editor           unsquashfs
 ar                          dwp                       gtk-builder-convert          objdump                     sensible-pager            unxz
 arch                        edit                      gtk-update-icon-cache        od                          seq                       update-alternatives
 as                          elfedit                   h2ph                         openssl                     setarch                   update-mime-database
 awk                         enc2xs                    h2xs                         optipng                     setpriv                   uptime
 b2sum                       encguess                  head                         pager                       setsid                    users
 base32                      env                       hostid                       pango-list                  setterm                   utmpdump
 base64                      expand                    hostnamectl                  pango-view                  sftp                      vmstat
 basename                    expiry                    i386                         partx                       sg                        w
 bashbug                     expr                      iconv                        passwd                      sha1sum                   w.procps
 bootctl                     factor                    icuinfo                      paste                       sha224sum                 wall
 busctl                      faillog                   id                           patch                       sha256sum                 watch
 c++                         faked-sysv                infocmp                      pathchk                     sha384sum                 wc
 c++filt                     faked-tcp                 infotocap                    pcre-config                 sha512sum                 whereis
 c89                         fakeroot                  install                      pcre2-config                shasum                    which
 c89-gcc                     fakeroot-sysv             instmodsh                    pdb3                        shred                     who
 c99                         fakeroot-tcp              ionice                       pdb3.8                      shuf                      whoami
 c99-gcc                     fallocate                 ipcmk                        perl                        size                      x86_64
 c_rehash                    fc-cache                  ipcrm                        perl5.30-x86_64-linux-gnu   skill                     x86_64-linux-gnu-addr2line
 captoinfo                   fc-cat                    ipcs                         perl5.30.0                  slabtop                   x86_64-linux-gnu-ar
 catchsegv                   fc-conflist               ischroot                     perlbug                     slogin                    x86_64-linux-gnu-as
 cautious-launcher           fc-list                   join                         perldoc                     snap                      x86_64-linux-gnu-c++filt
 cc                          fc-match                  json_pp                      perlivp                     snapctl                   x86_64-linux-gnu-cpp
 chage                       fc-pattern                kernel-install               perlthanks                  snapfuse                  x86_64-linux-gnu-cpp-9
 chattr                      fc-query                  last                         pgrep                       snice                     x86_64-linux-gnu-dwp
 chcon                       fc-scan                   lastb                        piconv                      sort                      x86_64-linux-gnu-elfedit
 chfn                        fc-validate               lastlog                      pinentry                    sotruss                   x86_64-linux-gnu-g++
 choom                       fincore                   lcf                          pinentry-curses             splain                    x86_64-linux-gnu-g++-9
 chrt                        find                      ld                           pinky                       split                     x86_64-linux-gnu-gcc
 chsh                        flock                     ld.bfd                       pkg-config                  sprof                     x86_64-linux-gnu-gcc-9
 cksum                       fmt                                   pkgdata                     ssh                       x86_64-linux-gnu-gcc-ar
 clear                       fold                      ldd                          pkgmaintainermangler        ssh-add                   x86_64-linux-gnu-gcc-ar-9
 clear_console               free                      libnetcfg                    pkgsanitychecks             ssh-agent                 x86_64-linux-gnu-gcc-nm
 cmp                         g++                       libpng-config                pkgstripfiles               ssh-argv0                 x86_64-linux-gnu-gcc-nm-9
 comm                        g++-9                     libpng16-config              pkgstriptranslations        ssh-copy-id               x86_64-linux-gnu-gcc-ranlib
 compose                     gapplication              link                         pkill                       ssh-keygen                x86_64-linux-gnu-gcc-ranlib-9
 corelist                    gcc                       linux32                      pl2pm                       ssh-keyscan               x86_64-linux-gnu-gcov
 cpan                        gcc-9                     linux64                      pldd                        stat                      x86_64-linux-gnu-gcov-9
 cpan5.30-x86_64-linux-gnu   gcc-ar                    locale                       pmap                        stdbuf                    x86_64-linux-gnu-gcov-dump
 cpp                         gcc-ar-9                  locale-check                 pod2html                    strings                   x86_64-linux-gnu-gcov-dump-9
 cpp-9                       gcc-nm                    localectl                    pod2man                     strip                     x86_64-linux-gnu-gcov-tool
 csplit                      gcc-nm-9                  localedef                    pod2text                    sudo                      x86_64-linux-gnu-gcov-tool-9
 cut                         gcc-ranlib                lockfile-check               pod2usage                   sudoedit                  x86_64-linux-gnu-gold
 cvtsudoers                  gcc-ranlib-9              lockfile-create              podchecker                  sudoreplay                x86_64-linux-gnu-gprof
 deb-systemd-helper          gcov                      lockfile-remove              podselect                   sum                       x86_64-linux-gnu-ld
 deb-systemd-invoke          gcov-9                    lockfile-touch               pr                          systemd-analyze           x86_64-linux-gnu-ld.bfd
 debconf                     gcov-dump                 logger                       print                       systemd-cat     
 debconf-apt-progress        gcov-dump-9               logname                      printenv                    systemd-cgls              x86_64-linux-gnu-nm
 debconf-communicate         gcov-tool                 lsattr                       printf                      systemd-cgtop             x86_64-linux-gnu-objcopy
 debconf-copydb              gcov-tool-9               lscpu                        prlimit                     systemd-delta             x86_64-linux-gnu-objdump
 debconf-escape              gdbus                     lsipc                        prove                       systemd-detect-virt       x86_64-linux-gnu-pkg-config
 debconf-set-selections      gdbus-codegen             lslocks                      ptar                        systemd-id128             x86_64-linux-gnu-ranlib
 debconf-show                gdk-pixbuf-csource        lslogins                     ptardiff                    systemd-mount             x86_64-linux-gnu-readelf
 delpart                     gdk-pixbuf-pixdata        lsmem                        ptargrep                    systemd-path              x86_64-linux-gnu-size
 derb                        gdk-pixbuf-thumbnailer    lsns                         ptx                         systemd-resolve           x86_64-linux-gnu-strings
 dh_builddeb                 genbrk                    lzcat                        pwdx                        systemd-run               x86_64-linux-gnu-strip
 diff                        gencat                    lzcmp                        py3clean                    systemd-socket-activate   x86_64-pc-linux-gnu-pkg-config
 diff3                       gencfu                    lzdiff                       py3compile                  systemd-stdio-bridge      xargs
 dircolors                   gencnval                  lzegrep                      py3versions                 systemd-umount            xmlcatalog
 dirmngr                     gendict                   lzfgrep                      pydoc3                      tabs                      xmllint
 dirmngr-client              genrb                     lzgrep                       pydoc3.8                    tac                       xsubpp
 dirname                     getconf                   lzless                       pygettext3                  tail                      xz
 dotlockfile                 getent                    lzma                         pygettext3.8                taskset                   xzcat
 dpkg                        getopt                    lzmainfo                     python3                     tee                       xzcmp
 dpkg-architecture           gio                       lzmore                       python3.8                   test                      xzdiff
 dpkg-buildflags             gio-querymodules          mail-lock                    ranlib                      tic                       xzegrep
 dpkg-buildpackage           git                       mail-touchlock               rcp                         timedatectl               xzfgrep
 dpkg-checkbuilddeps         git-receive-pack          mail-unlock                  readelf                     timeout                   xzgrep
 dpkg-deb                    git-shell                 make                         realpath                    tload                     xzless
 dpkg-deb.pkgbinarymangler   git-upload-archive        make-first-existing-target   rename.ul                   toe                       xzmore
 dpkg-distaddfile            git-upload-pack           makeconv                     renice                      top                       yes
 dpkg-divert                 glib-compile-resources    mawk                         reset                       touch                     zdump
 dpkg-genbuildinfo           glib-compile-schemas      mcookie                      resizepart                  tput                      zipdetails

Can someone help me with this? :blush:

The command isn’t complaining it can’t find python2 but that it can’t find desktop-launch, iirc core 20 changed the behaviour of the ‘command:’ entry so that you HAVE to specify a full path, relative to $SNAP, whereas core18 was lenient. Assuming desktop-launch is in $SNAP/bin, try command: bin/desktop-launch ...

Thanks, I’ll try that.

But still, why is python not present in such folders? :thinking:

About such changes in core20, do you have any reference to check for more info? :blush:

You would find python2 in either: /root/parts/python2/install/usr/bin (after python2 part is built) /root/stage/usr/bin (after python2 part is staged)

Also, you probably want to use $SNAP to find python2:

bin/desktop-launch $SNAP/usr/bin/python2 ....

We could improve the error message a bit there to suggest bin/desktop-launch instead of that current message.

It’s scattered among the changelogs (e.g. and relevant plugin / yaml documentation, but I believe there is effort underway to put together a better guide for migrating to core20.

Thanks a lot, indeed everything seems to work now :blush:

1 Like