Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debian 12 Bookworm Support? #27

Closed
astridx opened this issue Aug 26, 2023 · 14 comments
Closed

Debian 12 Bookworm Support? #27

astridx opened this issue Aug 26, 2023 · 14 comments

Comments

@astridx
Copy link
Contributor

astridx commented Aug 26, 2023

Thank you for the detailed instructions for Debian 11: https://github.com/giggls/osml10n/blob/master/INSTALL.md.

I have tested this for Debian 12 (Bookworm). Install on Debian 11 and update to Debian 12 is fine.

The first part worked fine in a new install, too:

apt install libunac1-dev luarocks lua5.3 libpcre3-dev liblua5.3-dev
luarocks install lrexlib-pcre
apt install python3-icu python3-shapely python3-pip python3-sdnotify python3-requests

But then I get into trouble

PIP

pip install is no longer possible because of https://peps.python.org/pep-0668/

$ pip install pykakasi
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

Virtual environment

First I tried it with a virtual environment. Then I ran into the problems described here:

attapol/tltk#7

--break-system-packages

With the parameter --break-system-packages I could install everything. There were warnings.

$ pip install pykakasi --break-system-packages
Defaulting to user installation because normal site-packages is not writeable
Collecting pykakasi
  Downloading pykakasi-2.2.1-py3-none-any.whl (2.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 1.9 MB/s eta 0:00:00
Collecting jaconv
  Downloading jaconv-0.3.4.tar.gz (16 kB)
  Preparing metadata (setup.py) ... done
Collecting deprecated
  Downloading Deprecated-1.2.14-py2.py3-none-any.whl (9.6 kB)
Collecting wrapt<2,>=1.10
  Downloading wrapt-1.15.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.9/78.9 kB 1.6 MB/s eta 0:00:00
Building wheels for collected packages: jaconv
  Building wheel for jaconv (setup.py) ... done
  Created wheel for jaconv: filename=jaconv-0.3.4-py3-none-any.whl size=16417 sha256=b6dd3aa752842867196dfb3bf1668eed29ba06f24d8eb42ea0010e3ce1726415
  Stored in directory: /home/vagrant/.cache/pip/wheels/36/3e/0d/fe7664bb3c7fdddde7449bc3bc85faaf673a6cda43ed7767c7
Successfully built jaconv
Installing collected packages: jaconv, wrapt, deprecated, pykakasi
Successfully installed deprecated-1.2.14 jaconv-0.3.4 pykakasi-2.2.1 wrapt-1.15.0
$ pip install tltk --break-system-packages
Defaulting to user installation because normal site-packages is not writeable
Collecting tltk
  Downloading tltk-1.6.8.tar.gz (18.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.7/18.7 MB 887.3 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting gensim
  Downloading gensim-4.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (26.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 26.7/26.7 MB 1.4 MB/s eta 0:00:00
Collecting nltk
  Downloading nltk-3.8.1-py3-none-any.whl (1.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 2.0 MB/s eta 0:00:00
Collecting sklearn
  Downloading sklearn-0.0.post7.tar.gz (3.6 kB)
  Preparing metadata (setup.py) ... done
Collecting sklearn_crfsuite
  Downloading sklearn_crfsuite-0.3.6-py2.py3-none-any.whl (12 kB)
Requirement already satisfied: numpy>=1.18.5 in /usr/lib/python3/dist-packages (from gensim->tltk) (1.24.2)
Collecting scipy>=1.7.0
  Downloading scipy-1.11.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (36.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 36.3/36.3 MB 1.8 MB/s eta 0:00:00
Collecting smart-open>=1.8.1
  Downloading smart_open-6.3.0-py3-none-any.whl (56 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.8/56.8 kB 2.5 MB/s eta 0:00:00
Collecting click
  Downloading click-8.1.7-py3-none-any.whl (97 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 97.9/97.9 kB 2.2 MB/s eta 0:00:00
Collecting joblib
  Downloading joblib-1.3.2-py3-none-any.whl (302 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 302.2/302.2 kB 2.8 MB/s eta 0:00:00
Collecting regex>=2021.8.3
  Downloading regex-2023.8.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (782 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 782.4/782.4 kB 2.0 MB/s eta 0:00:00
Collecting tqdm
  Downloading tqdm-4.66.1-py3-none-any.whl (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.3/78.3 kB 2.3 MB/s eta 0:00:00
Collecting python-crfsuite>=0.8.3
  Downloading python_crfsuite-0.9.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 2.3 MB/s eta 0:00:00
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from sklearn_crfsuite->tltk) (1.16.0)
Collecting tabulate
  Downloading tabulate-0.9.0-py3-none-any.whl (35 kB)
Building wheels for collected packages: tltk, sklearn
  Building wheel for tltk (setup.py) ... done
  Created wheel for tltk: filename=tltk-1.6.8-py3-none-any.whl size=18868898 sha256=60d06fda13d0935b1f6d9a7fd018de6f33beb4a1a895f68d4fb6ddb6507dcb0d
  Stored in directory: /home/vagrant/.cache/pip/wheels/76/d2/3d/a1701c265f3734fd29266aa8ee4d9cb6bda32d3c2afad4b980
  Building wheel for sklearn (setup.py) ... done
  Created wheel for sklearn: filename=sklearn-0.0.post7-py3-none-any.whl size=2953 sha256=26ccddbfdab1246b276f143f8ff51a016f834e70a2875e956130673b2480689b
  Stored in directory: /home/vagrant/.cache/pip/wheels/08/17/db/46486df299847133f69165c029fe388fac45781eb5d436c569
Successfully built tltk sklearn
Installing collected packages: sklearn, python-crfsuite, tqdm, tabulate, smart-open, scipy, regex, joblib, click, sklearn_crfsuite, nltk, gensim, tltk
  WARNING: The script tqdm is installed in '/home/vagrant/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script tabulate is installed in '/home/vagrant/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script nltk is installed in '/home/vagrant/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script tltk is installed in '/home/vagrant/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed click-8.1.7 gensim-4.3.2 joblib-1.3.2 nltk-3.8.1 python-crfsuite-0.9.9 regex-2023.8.8 scipy-1.11.2 sklearn-0.0.post7 sklearn_crfsuite-0.3.6 smart-open-6.3.0 tabulate-0.9.0 tltk-1.6.8 tqdm-4.66.1
$ pip install pinyin_jyutping_sentence --break-system-packages
Defaulting to user installation because normal site-packages is not writeable
Collecting pinyin_jyutping_sentence
  Downloading pinyin_jyutping_sentence-1.3.tar.gz (12.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.4/12.4 MB 2.0 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting jieba
  Downloading jieba-0.42.1.tar.gz (19.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 19.2/19.2 MB 1.5 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pinyin_jyutping_sentence, jieba
  Building wheel for pinyin_jyutping_sentence (setup.py) ... done
  Created wheel for pinyin_jyutping_sentence: filename=pinyin_jyutping_sentence-1.3-py3-none-any.whl size=12492668 sha256=5402d35f65468c29f53b68eec01f339062650b565372f52e690e04c2bf7b448a
  Stored in directory: /home/vagrant/.cache/pip/wheels/ac/d9/9a/46f4077d8c97134b748d1662a829b63e4845c85f7916fac8b9
  Building wheel for jieba (setup.py) ... done
  Created wheel for jieba: filename=jieba-0.42.1-py3-none-any.whl size=19314458 sha256=175706510a98b0e2a9cca318d779cffa8ee9f3f5f8bb11e4e8ae12f2d508683a
  Stored in directory: /home/vagrant/.cache/pip/wheels/ac/60/cf/538a1f183409caf1fc136b5d2c2dee329001ef6da2c5084bef
Successfully built pinyin_jyutping_sentence jieba
Installing collected packages: jieba, pinyin_jyutping_sentence
Successfully installed jieba-0.42.1 pinyin_jyutping_sentence-1.3


Debian Pakete

Then I created the Debian packages and get the message Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 145.

apt install debhelper
/osml10n$ make deb
sed -e 's;/usr/local;/usr;g' transcription-daemon/geo-transcript-srv.service >debian/osml10n.service
dpkg-buildpackage -b -uc
dpkg-buildpackage: info: source package osml10n
dpkg-buildpackage: info: source version 1.0.1
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Sven Geggus <[email protected]>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build .
 fakeroot debian/rules clean
make[1]: Entering directory '/home/vagrant/osml10n'
dh clean
   dh_auto_clean
	make -j1 clean
make[2]: Entering directory '/home/vagrant/osml10n'
echo "there is nothing to clean"
there is nothing to clean
make[2]: Leaving directory '/home/vagrant/osml10n'
   dh_clean
make[1]: Leaving directory '/home/vagrant/osml10n'
 debian/rules build
make[1]: Entering directory '/home/vagrant/osml10n'
dh build
   dh_update_autotools_config
   dh_autoreconf
   dh_auto_configure
   dh_auto_build
	make -j1 "INSTALL=install --strip-program=true"
make[2]: Entering directory '/home/vagrant/osml10n'
echo "These are lua and python scripts, there is nothing to build here"
These are lua and python scripts, there is nothing to build here
make[2]: Leaving directory '/home/vagrant/osml10n'
   debian/rules override_dh_auto_test
make[2]: Entering directory '/home/vagrant/osml10n'
/bin/true
make[2]: Leaving directory '/home/vagrant/osml10n'
   create-stamp debian/debhelper-build-stamp
make[1]: Leaving directory '/home/vagrant/osml10n'
 fakeroot debian/rules binary
make[1]: Entering directory '/home/vagrant/osml10n'
dh binary
   dh_testroot
   dh_prep
   dh_installdirs
   debian/rules override_dh_auto_install
make[2]: Entering directory '/home/vagrant/osml10n'
dh_auto_install -- prefix=/usr
	make -j1 install DESTDIR=/home/vagrant/osml10n/debian/osml10n AM_UPDATE_INFO_DIR=no "INSTALL=install --strip-program=true" prefix=/usr
make[3]: Entering directory '/home/vagrant/osml10n'
mkdir -p /home/vagrant/osml10n/debian/osml10n/usr/share/lua/5.3
cp -a lua_osml10/osml10n /home/vagrant/osml10n/debian/osml10n/usr/share/lua/5.3/
chmod -R go+rX /home/vagrant/osml10n/debian/osml10n/usr/share/lua/5.3/osml10n
sed -e 's;/usr/local;/usr;g' transcription-daemon/geo-transcript-srv.service >debian/osml10n.service
mkdir -p /home/vagrant/osml10n/debian/osml10n/usr/bin
cp -a transcription-daemon/geo-transcript-srv.py /home/vagrant/osml10n/debian/osml10n/usr/bin
chmod 755 /home/vagrant/osml10n/debian/osml10n/usr/bin/geo-transcript-srv.py
mkdir -p /home/vagrant/osml10n/debian/osml10n/usr/share/osml10n/boundaries
cp -a boundaries/* /home/vagrant/osml10n/debian/osml10n/usr/share/osml10n/boundaries
cp transcription-cli/transcribe.py /home/vagrant/osml10n/debian/osml10n/usr/bin
chmod 755 /home/vagrant/osml10n/debian/osml10n/usr/bin/transcribe.py
make[3]: Leaving directory '/home/vagrant/osml10n'
make[2]: Leaving directory '/home/vagrant/osml10n'
   dh_installdocs
   dh_installchangelogs
   dh_installinit
   dh_installsystemd
   dh_perl
   dh_link
   dh_strip_nondeterminism
   dh_compress
   dh_fixperms
   dh_missing
   dh_installdeb
   dh_gencontrol
   dh_md5sums
   dh_builddeb
dpkg-deb: building package 'osml10n' in '../osml10n_1.0.1_all.deb'.
make[1]: Leaving directory '/home/vagrant/osml10n'
 dpkg-genbuildinfo --build=binary -O../osml10n_1.0.1_amd64.buildinfo
 dpkg-genchanges --build=binary -O../osml10n_1.0.1_amd64.changes
dpkg-genchanges: info: binary-only upload (no source code included)
 dpkg-source --after-build .
dpkg-buildpackage: info: binary-only upload (no source included)
vagrant@bookworm:~/osml10n$ cd lua_unac/
vagrant@bookworm:~/osml10n/lua_unac$ make deb
dpkg-buildpackage -b -uc
dpkg-buildpackage: info: source package lua-unaccent
dpkg-buildpackage: info: source version 1.8-1
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by Sven Geggus <[email protected]>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build .
 fakeroot debian/rules clean
make[1]: Entering directory '/home/vagrant/osml10n/lua_unac'
dh clean
   dh_auto_clean
	make -j1 clean
make[2]: Entering directory '/home/vagrant/osml10n/lua_unac'
rm -f unaccent.so
make[2]: Leaving directory '/home/vagrant/osml10n/lua_unac'
   dh_clean
make[1]: Leaving directory '/home/vagrant/osml10n/lua_unac'
 debian/rules build
make[1]: Entering directory '/home/vagrant/osml10n/lua_unac'
dh build
   dh_update_autotools_config
   dh_autoreconf
   dh_auto_configure
   dh_auto_build
	make -j1 "INSTALL=install --strip-program=true"
make[2]: Entering directory '/home/vagrant/osml10n/lua_unac'
gcc -Wall -shared -fPIC -o unaccent.so -I/usr/include/lua5.3 -llua5.3 -Wl,--no-as-needed -lunac lua_unac.c
make[2]: Leaving directory '/home/vagrant/osml10n/lua_unac'
   dh_auto_test
   create-stamp debian/debhelper-build-stamp
make[1]: Leaving directory '/home/vagrant/osml10n/lua_unac'
 fakeroot debian/rules binary
make[1]: Entering directory '/home/vagrant/osml10n/lua_unac'
dh binary
   dh_testroot
   dh_prep
   dh_installdirs
   dh_auto_install --destdir=debian/lua-unaccent/
	make -j1 install DESTDIR=/home/vagrant/osml10n/lua_unac/debian/lua-unaccent AM_UPDATE_INFO_DIR=no "INSTALL=install --strip-program=true"
make[2]: Entering directory '/home/vagrant/osml10n/lua_unac'
install -m 644 unaccent.so /home/vagrant/osml10n/lua_unac/debian/lua-unaccent/usr/lib/x86_64-linux-gnu/lua/5.3/
make[2]: Leaving directory '/home/vagrant/osml10n/lua_unac'
   dh_installdocs
   dh_installchangelogs
   dh_perl
   dh_link
   dh_strip_nondeterminism
   dh_compress
   dh_fixperms
   dh_missing
   dh_strip
   dh_makeshlibs
   dh_shlibdeps
   dh_installdeb
   dh_gencontrol
dpkg-gencontrol: warning: package lua-unaccent: substitution variable ${shlibs:Depends} unused, but is defined
dpkg-gencontrol: warning: package lua-unaccent: substitution variable ${shlibs:Depends} unused, but is defined
   dh_md5sums
   dh_builddeb
dpkg-deb: building package 'lua-unaccent' in '../lua-unaccent_1.8-1_amd64.deb'.
dpkg-deb: building package 'lua-unaccent-dbgsym' in '../lua-unaccent-dbgsym_1.8-1_amd64.deb'.
make[1]: Leaving directory '/home/vagrant/osml10n/lua_unac'
 dpkg-genbuildinfo --build=binary -O../lua-unaccent_1.8-1_amd64.buildinfo
 dpkg-genchanges --build=binary -O../lua-unaccent_1.8-1_amd64.changes
dpkg-genchanges: info: binary-only upload (no source code included)
 dpkg-source --after-build .
dpkg-buildpackage: info: binary-only upload (no source included)
/osml10n$ sudo dpkg -i lua-unaccent_*.deb
Selecting previously unselected package lua-unaccent.
(Reading database ... 43498 files and directories currently installed.)
Preparing to unpack lua-unaccent_1.8-1_amd64.deb ...
Unpacking lua-unaccent (1.8-1) ...
Setting up lua-unaccent (1.8-1) ...
/osml10n$ sudo dpkg -i ../osml10n_*_all.deb
Selecting previously unselected package osml10n.
(Reading database ... 43502 files and directories currently installed.)
Preparing to unpack ../osml10n_1.0.1_all.deb ...
Unpacking osml10n (1.0.1) ...
Setting up osml10n (1.0.1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/osml10n.service → /lib/systemd/system/osml10n.service.
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 145.

Line 145 of the file /usr/bin/deb-systemd-invoke is the one in this if-statement:

if (@start_units) {
    system('systemctl', '--quiet', @instance_args, $action, @start_units) == 0 or die("Could not execute systemctl: $!");
 }

This is my whole file /usr/bin/deb-systemd-invoke.


/usr/bin$ cat deb-systemd-invoke 
#!/usr/bin/perl
# vim:ts=4:sw=4:expandtab
# © 2013 Michael Stapelberg <[email protected]>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#
#     * Redistributions in binary form must reproduce the above copyright
#       notice, this list of conditions and the following disclaimer in the
#       documentation and/or other materials provided with the distribution.
#
#     * Neither the name of Michael Stapelberg nor the
#       names of contributors may be used to endorse or promote products
#       derived from this software without specific prior written permission.
# .
# THIS SOFTWARE IS PROVIDED BY Michael Stapelberg ''AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Michael Stapelberg BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

=head1 NAME

deb-systemd-invoke - wrapper around systemctl, respecting policy-rc.d

=head1 SYNOPSIS

B<deb-systemd-invoke> [B<--user>] start|stop|restart S<I<unit file> ...>

=head1 DESCRIPTION

B<deb-systemd-invoke> is a Debian-specific helper script which asks
/usr/sbin/policy-rc.d before performing a systemctl call.

B<deb-systemd-invoke> is intended to be used from maintscripts to start
systemd unit files. It is specifically NOT intended to be used interactively by
users. Instead, users should run systemd and use systemctl, or not bother about
the systemd enabled state in case they are not running systemd.

=cut

use strict;
use warnings;
use Getopt::Long; # in core since Perl 5

if (@ARGV < 2) {
    print STDERR "Syntax: $0 <action> <unit file> [<unit file> ...]\n";
    exit 1;
}

my $is_system = 1;
my @instances = ();
my $result = GetOptions(
    "user" => sub { $is_system = 0; },
    "system" => sub { $is_system = 1; }, # default
);

my $policyhelper = '/usr/sbin/policy-rc.d';
if (length $ENV{DPKG_ROOT}) {
    $policyhelper = $ENV{DPKG_ROOT} . $policyhelper;
}
my @units = @ARGV;
my $action = shift @units;
if (-x $policyhelper) {
    for my $unit (@units) {
        system(qq|$policyhelper $unit "$action"|);

        # 0 or 104 means run
        # 101 means do not run
        my $exitcode = ($? >> 8);
        if ($exitcode == 101) {
            print STDERR "$policyhelper returned 101, not running '" . join(' ', @ARGV) . "'\n";
            exit 0;
        } elsif ($exitcode != 104 && $exitcode != 0) {
            print STDERR "deb-systemd-invoke only supports $policyhelper return codes 0, 101, and 104!\n";
            print STDERR "Got return code $exitcode, ignoring.\n";
        }
    }
}

if (!$is_system) {
    # '--machine <ID>@' was added in v250 and v249.10, before that we can't talk to arbitrary user instances
    my $systemctl_version = `systemctl --version --quiet | sed -n -r "s/systemd ([0-9]+) \\(.*/\\1/p"`;
    chomp ($systemctl_version);
    if (system('dpkg', '--compare-versions', $systemctl_version, 'ge', '249') != 0) {
            print STDERR "systemctl version $systemctl_version does not support acting on user instance, skipping\n";
            exit 0;
    }

    # Each user instance of the manager has a corresponding user@<id<.service unit.
    # Get the full list of IDs, so that we can talk to each user instance to start/stop
    # user units.
    @instances = `systemctl --no-legend --quiet list-units 'user@*' | sed -n -r 's/.*user@([0-9]+).service.*/\\1/p'`;
} else {
    push @instances, 'system';
}

# If the job is disabled and is not currently running, the job is not started or restarted.
# However, if the job is disabled but has been forced into the running state, we *do* stop
# and restart it since this is expected behaviour for the admin who forced the start.
# We don't autostart static units either.
if ($action eq "start" || $action eq "restart") {
    my $global_exit_code = 0;
    my @start_units = ();

    for my $instance (@instances) {
        my @instance_args = ();

        if ($instance eq 'system') {
            push @instance_args, '--system';
        } else {
            chomp ($instance);
            push @instance_args, '--user', '--machine', "$instance@";
        }

        for my $unit (@units) {
            my $unit_installed = 0;
            my $enabled_output = `systemctl @instance_args is-enabled -- '$unit'`;
            # matching enabled and enabled-runtime as an installed non static unit
            if ($enabled_output =~ /enabled/) {
                $unit_installed = 1;
            }
            system('systemctl', @instance_args, '--quiet', 'is-active', '--', $unit);
            my $unit_active = $?>>8 == 0 ? 1 : 0;
            if (!$unit_installed && $action eq "start") {
                print STDERR "$unit is a disabled or a static unit, not starting it.\n";
            } elsif (!$unit_installed && !$unit_active && $action eq "restart") {
                print STDERR "$unit is a disabled or a static unit not running, not starting it.\n";
            }
            else {
                push @start_units, $unit;
            }
        }
        if (@start_units) {
            system('systemctl', '--quiet', @instance_args, $action, @start_units) == 0 or die("Could not execute systemctl: $!");
        }
    }
    exit(0);
} elsif ($action eq "stop" && !$is_system) {
    my $global_exit_code = 0;

    for my $instance (@instances) {
        chomp ($instance);
        system('systemctl', '--quiet', '--user', '--machine', "$instance@", $action, @units);
    }
    exit(0);
} else {
    exec('systemctl', @ARGV);
}

sudo journalctl -u osml10n looks like this:

$ sudo journalctl -u osml10n
Aug 26 07:49:50 bookworm systemd[1]: [🡕] /lib/systemd/system/osml10n.service:10: Special user nobody configured, this is not safe!
Aug 26 07:49:50 bookworm systemd[1]: Starting osml10n.service - OSM l10n transcription server...
Aug 26 07:49:52 bookworm geo-transcript-srv.py[13842]: Loading osml10n transcription server:
Aug 26 07:49:52 bookworm systemd[1]: osml10n.service: Main process exited, code=exited, status=1/FAILURE
Aug 26 07:49:52 bookworm systemd[1]: osml10n.service: Failed with result 'exit-code'.
Aug 26 07:49:52 bookworm systemd[1]: Failed to start osml10n.service - OSM l10n transcription server.
Aug 26 07:49:52 bookworm systemd[1]: osml10n.service: Consumed 1.221s CPU time.
Aug 26 07:49:52 bookworm systemd[1]: osml10n.service: Scheduled restart job, restart counter is at 1.
Aug 26 07:49:52 bookworm systemd[1]: Stopped osml10n.service - OSM l10n transcription server.
Aug 26 07:49:52 bookworm systemd[1]: osml10n.service: Consumed 1.221s CPU time.
Aug 26 07:49:52 bookworm systemd[1]: Starting osml10n.service - OSM l10n transcription server...
Aug 26 07:49:52 bookworm geo-transcript-srv.py[13845]: Loading osml10n transcription server:
Aug 26 07:49:52 bookworm systemd[1]: osml10n.service: Main process exited, code=exited, status=1/FAILURE
Aug 26 07:49:52 bookworm systemd[1]: osml10n.service: Failed with result 'exit-code'.
Aug 26 07:49:52 bookworm systemd[1]: Failed to start osml10n.service - OSM l10n transcription server.
Aug 26 07:49:52 bookworm systemd[1]: osml10n.service: Scheduled restart job, restart counter is at 2.
Aug 26 07:49:52 bookworm systemd[1]: Stopped osml10n.service - OSM l10n transcription server.
Aug 26 07:49:52 bookworm systemd[1]: Starting osml10n.service - OSM l10n transcription server...
Aug 26 07:49:53 bookworm geo-transcript-srv.py[13847]: Loading osml10n transcription server:
Aug 26 07:49:53 bookworm systemd[1]: osml10n.service: Main process exited, code=exited, status=1/FAILURE
Aug 26 07:49:53 bookworm systemd[1]: osml10n.service: Failed with result 'exit-code'.
Aug 26 07:49:53 bookworm systemd[1]: Failed to start osml10n.service - OSM l10n transcription server.
Aug 26 07:49:53 bookworm systemd[1]: osml10n.service: Scheduled restart job, restart counter is at 3.
Aug 26 07:49:53 bookworm systemd[1]: Stopped osml10n.service - OSM l10n transcription server.
Aug 26 07:49:53 bookworm systemd[1]: Starting osml10n.service - OSM l10n transcription server...
Aug 26 07:49:53 bookworm geo-transcript-srv.py[13849]: Loading osml10n transcription server:
Aug 26 07:49:53 bookworm systemd[1]: osml10n.service: Main process exited, code=exited, status=1/FAILURE
Aug 26 07:49:53 bookworm systemd[1]: osml10n.service: Failed with result 'exit-code'.
Aug 26 07:49:53 bookworm systemd[1]: Failed to start osml10n.service - OSM l10n transcription server.
Aug 26 07:49:53 bookworm systemd[1]: osml10n.service: Scheduled restart job, restart counter is at 4.
Aug 26 07:49:53 bookworm systemd[1]: Stopped osml10n.service - OSM l10n transcription server.
Aug 26 07:49:53 bookworm systemd[1]: Starting osml10n.service - OSM l10n transcription server...
Aug 26 07:49:54 bookworm geo-transcript-srv.py[13851]: Loading osml10n transcription server:
Aug 26 07:49:54 bookworm systemd[1]: osml10n.service: Main process exited, code=exited, status=1/FAILURE
Aug 26 07:49:54 bookworm systemd[1]: osml10n.service: Failed with result 'exit-code'.
Aug 26 07:49:54 bookworm systemd[1]: Failed to start osml10n.service - OSM l10n transcription server.
Aug 26 07:49:54 bookworm systemd[1]: osml10n.service: Scheduled restart job, restart counter is at 5.
Aug 26 07:49:54 bookworm systemd[1]: Stopped osml10n.service - OSM l10n transcription server.
Aug 26 07:49:54 bookworm systemd[1]: osml10n.service: Start request repeated too quickly.
Aug 26 07:49:54 bookworm systemd[1]: osml10n.service: Failed with result 'exit-code'.
Aug 26 07:49:54 bookworm systemd[1]: Failed to start osml10n.service - OSM l10n transcription server.
Aug 26 08:04:21 bookworm systemd[1]: [🡕] /lib/systemd/system/osml10n.service:10: Special user nobody configured, this is not safe!


Are you using this repo under Debian 12 Bookworm? Am I doing something wrong? Which procedure do you recommend?
Could it be that I have a similar problem as in #25

@astridx astridx changed the title Debian 12 Debian 12 Bookworm Aug 26, 2023
@astridx astridx changed the title Debian 12 Bookworm Debian 12 Bookworm Support? Aug 26, 2023
@giggls
Copy link
Owner

giggls commented Aug 26, 2023

We do actually use this code on Debian 12 in production on tile.openstreetmap.de.
The problem is not with /usr/bin/deb-systemd-invoke.
This is just a subsequent error of a problem with recent versions of tltk which seem now to need sklearn. Thus you will either need to install python3-sklearn package or install the older versions as documented in INSATLL.md.
Looks like I will need try to make the error messages more verbose here.

@giggls giggls closed this as completed in 3053b30 Aug 26, 2023
@lonvia
Copy link
Contributor

lonvia commented Aug 26, 2023

@giggls We are talking about the servers for tile.openstreetmap.de here. ;) They broke after sklearn went into deprecation mode: https://pypi.org/project/sklearn/

The approach with the Debian package is becoming problematic because it requires dependencies that are not provided by Debian. Custom Python packages need a virtualenv and that is not compatible with a Debian installed systemd script.

My suggestion here would be to have the setup to create luarocks and pip packages instead and drop the Debian approach. What do you think?

@giggls
Copy link
Owner

giggls commented Aug 26, 2023

Ähm if you already knew the problem you should have reported it this way.

The problem description here looked like my software is not running on Debian 12 which I can not confirm.

The missing sklearn dependency is not a Debian 12 issue but a tltk one. Did I already report this there? I might have.

If I understand this correctly Debian does not remove deprecated packages from stable release so I tend to relax here a little bit as tltk is not orphaned AFAIK and did not need sklearn in older versions anyway. If we go for them we would not even need sklearn.

@giggls
Copy link
Owner

giggls commented Aug 26, 2023

BTW I think about moving deployment of the python daemon into a podman/docker container rather than a Debian package. As the Debian package in its current form is somewhat broken anyway.

@giggls giggls reopened this Aug 26, 2023
@lonvia
Copy link
Contributor

lonvia commented Aug 26, 2023

This is a bad idea imo. Docker is a tool for deployment. It is not a replacement for proper installation procedures. Leave the decision if somebody wants to use docker or not to the user.

@lonvia
Copy link
Contributor

lonvia commented Aug 26, 2023

If I understand this correctly Debian does not remove deprecated packages from stable release

Debian 12 installs scikit-learn when installing the python3-sklearn package:

me@debain12:~$ apt show python3-sklearn
Package: python3-sklearn
Version: 1.2.1+dfsg-1
Priority: optional
Section: python
Source: scikit-learn
Maintainer: Debian Science Maintainers <[email protected]>
Installed-Size: 11.6 MB
Depends: python3-joblib, python3-numpy, python3-scipy (>= 1.1.10~), python3-threadpoolctl, python3:any, python3-sklearn-lib (>= 1.2.1+dfsg-1)
Recommends: python3-nose, python3-pytest, python3-matplotlib
Suggests: python3-dap, python-sklearn-doc, ipython3
Enhances: python3-mdp, python3-mvpa2
Homepage: https://scikit-learn.org
Download-Size: 2,103 kB
APT-Sources: http://debian.inf.tu-dresden.de/debian bookworm/main amd64 Packages
Description: Python modules for machine learning and data mining - Python 3
 scikit-learn is a collection of Python modules relevant to
 machine/statistical learning and data mining.  Non-exhaustive list of
 included functionality:
  - Gaussian Mixture Models
  - Manifold learning
  - kNN
  - SVM (via LIBSVM)
 .
 This package contains the Python 3 version.

That's why pip install tltk then pulls sklearn. We can keep installing sklearn from a local source for a while but eventually you need to find a replacement for tltk if that is abandonware.

@giggls
Copy link
Owner

giggls commented Aug 27, 2023

There is no replacement as far as I know. Deprecating tltk would mean deprecating Thai language support. This said I do not consider tltk deprecated. Latest release is from may. https://pypi.org/project/tltk/

@giggls
Copy link
Owner

giggls commented Aug 27, 2023

This is a bad idea imo. Docker is a tool for deployment. It is not a replacement for proper installation procedures. Leave the decision if somebody wants to use docker or not to the user.

A proper build container is arguably better than a broken Debian package. I know that the cleanest way would be to have all the needed Python modules as Debian packages instead of using pip.

@datendelphin
Copy link

Pip is fine, no problem with that from my side.
The Problem seems that since at least March, tltk can only be installed (with pip) by chance, because of sklearn. And tltk knows it since March (I hope) as the issue astrid linked above shows. A release in May which does not address this issue is not helping or building confidence. Switching to some other deployment system will be painful itself, but just postpone the other pain of tltk a bit I think.

The fix seems available and a simple one liner https://github.com/attapol/tltk/pull/8/files let's hope...

@giggls
Copy link
Owner

giggls commented Aug 28, 2023

This tltk repo is obviously not where the development happens (issues filed there seem to be ignored).
Current version is 1.6.8 and latest commit there is from 2021.

datendelphin pushed a commit to fossgis-routing-server/ansible_openstreetmap.de that referenced this issue Sep 11, 2023
@otbutz
Copy link

otbutz commented Jan 12, 2024

The dependency problem seems to be fixed with the release of tltk 1.7 which switched from sklearn to scikit-learn.

@giggls
Copy link
Owner

giggls commented Jan 12, 2024

Nice!
I will check if I can get rid of the workaround I currently have in the 1.1.1 release and prepare a tltk 1.7 based 1.2.0 release.

@otbutz
Copy link

otbutz commented Jan 12, 2024

1.8 seems to be the latest release

@giggls
Copy link
Owner

giggls commented Jan 14, 2024

OK, closing this as sklearn is now gone with release 1.2.0

@giggls giggls closed this as completed Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants