[SOLVED] installing whoogle without docker

Hello all!
I installing whoogle without docker but getting issue.
Probably something to do with the permissions or/and venv.

systemd[1]: whoogle.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: whoogle.service: Failed with result 'exit-code'.
systemd[1]: whoogle.service: Scheduled restart job, restart counter is at 89.
systemd[1]: Stopped whoogle.service - Whoogle.
systemd[1]: Started whoogle.service - Whoogle.
whoogle[6140]: Traceback (most recent call last):
whoogle[6140]:   File "<frozen runpy>", line 189, in _run_module_as_main
whoogle[6140]:   File "<frozen runpy>", line 148, in _get_module_details
whoogle[6140]:   File "<frozen runpy>", line 112, in _get_module_details
whoogle[6140]:   File "/opt/whoogle-search/app/__init__.py", line 1, in <module>
whoogle[6140]:     from app.filter import clean_query
whoogle[6140]:   File "/opt/whoogle-search/app/filter.py", line 1, in <module>
whoogle[6140]:     import cssutils
whoogle[6140]: ModuleNotFoundError: No module named 'cssutils'

background:

$ uname -srmo
Linux 5.15.93-meson armv7l GNU/Linux
$ cat /boot/dietpi/.version
G_DIETPI_VERSION_CORE=9
G_DIETPI_VERSION_SUB=0
G_DIETPI_VERSION_RC=2
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
$ grep "whoogle" /etc/passwd
whoogle:x:995:995:Whoogle:/opt/whoogle-search:/usr/sbin/nologin
$ ll /opt/whoogle-search/
total 48
drwxr-xr-x 7 whoogle whoogle 4096 Feb 11 10:31 app
-rw-r--r-- 1 whoogle whoogle 7919 Feb 11 09:58 app.json
drwxr-xr-x 3 whoogle whoogle 4096 Feb 11 09:58 charts
drwxr-xr-x 2 whoogle whoogle 4096 Feb 11 09:58 letsencrypt
-rw-r--r-- 1 whoogle whoogle 1066 Feb 11 09:58 LICENSE
drwxr-xr-x 3 whoogle whoogle 4096 Feb 11 09:58 misc
-rw-r--r-- 1 whoogle whoogle   90 Feb 11 09:58 pyproject.toml
-rwxr-xr-x 1 whoogle whoogle  982 Feb 11 09:58 run
-rw-r--r-- 1 whoogle whoogle  982 Feb 11 09:58 setup.cfg
drwxr-xr-x 5 whoogle whoogle 4096 Feb 11 10:00 venv
-rw-r--r-- 1 whoogle whoogle 3201 Feb 11 09:58 whoogle.template.env
/opt/whoogle-search/venv$ sudo pip list
Package            Version
------------------ ---------
attrs              22.2.0
beautifulsoup4     4.11.2
blinker            1.7.0
Brotli             1.0.9
cachelib           0.10.2
certifi            2023.7.22
cffi               1.15.1
chardet            5.1.0
charset-normalizer 3.3.2
click              8.1.3
cryptography       3.3.2
cssutils           2.6.0
defusedxml         0.7.1
Flask              2.3.2
idna               3.4
iniconfig          2.0.0
itsdangerous       2.1.2
Jinja2             3.1.3
MarkupSafe         2.1.2
more-itertools     9.0.0
packaging          23.0
pip                24.0
pluggy             1.0.0
pycodestyle        2.10.0
pycparser          2.21
pyOpenSSL          19.1.0
pyparsing          3.0.9
PySocks            1.7.1
pytest             7.2.1
python-dateutil    2.8.2
python-dotenv      0.21.1
requests           2.31.0
setuptools         69.0.3
six                1.16.0
soupsieve          2.4
stem               1.8.1
urllib3            1.26.18
validators         0.22.0
waitress           2.1.2
wcwidth            0.2.6
Werkzeug           3.0.1
wheel              0.42.0
$ cat /usr/lib/systemd/system/whoogle.service
[Unit]
Description=Whoogle
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=whoogle
WorkingDirectory=/opt/whoogle-search
#EnvironmentFile=/etc/default/whoogle
ExecStart=/opt/whoogle-search/venv/bin/python -um app --host 127.0.0.1 --port 5000
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
RestartSec=3
SyslogIdentifier=whoogle

[Install]
WantedBy=multi-user.target

Why not asking whoogle support on this?

Probably Python module cssutils has not been installed correctly.

because it’s not a whoogle problem

/opt/whoogle-search# ./run
Running on http://0.0.0.0:5000

no. proof above :point_up_2:

in addition

/opt/whoogle-search# pip check
No broken requirements found.

ok it’s a problem how you create the whoogle.service configuration.

I just did a test, installed whoogle-search via pip method and created a very simple service. After reboot, service is working without issue.

root@DietPi5:~# systemctl status whoogle.service
● whoogle.service - Whoogle
     Loaded: loaded (/lib/systemd/system/whoogle.service; enabled; preset: enabled)
     Active: active (running) since Sun 2024-02-11 13:35:47 CET; 46s ago
   Main PID: 410 (whoogle-search)
      Tasks: 5 (limit: 4768)
        CPU: 551ms
     CGroup: /system.slice/whoogle.service
             └─410 /usr/bin/python3 /usr/local/bin/whoogle-search --host 0.0.0.0 --port 5000

Feb 11 13:35:47 DietPi5 systemd[1]: Started whoogle.service - Whoogle.
root@DietPi5:~#
root@DietPi5:~# journalctl -u whoogle.service
Feb 11 13:35:47 DietPi5 systemd[1]: Started whoogle.service - Whoogle.
root@DietPi5:~#
root@DietPi5:~# ss -tulpn | grep LISTEN
tcp   LISTEN 0      1000         0.0.0.0:22        0.0.0.0:*    users:(("dropbear",pid=592,fd=3))
tcp   LISTEN 0      1024         0.0.0.0:5000      0.0.0.0:*    users:(("whoogle-search",pid=1188,fd=6))
tcp   LISTEN 0      1000            [::]:22           [::]:*    users:(("dropbear",pid=592,fd=4))
root@DietPi5:~#

))
Did you install via pip directly into the system? That’s not good. I have no problems with this installation either. But it’s bad practice. It’s not safe.

I need to install so that the service works without privileges, as I did above.

By the way, don’t not need the installation method. It’s already there. I need help in solving the problem with permissions or venv. Nothing else

thx

If you understand PKGBUILDS from archlinux, here is an example of how it should be installed:
https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=whoogle-git

by the same principle some software are installed in dietpi as well

It’s not a DietPi problem either. It’s the way you setup the systemd service because you missed the activate the Python3 venv.

I did the resource for you now on whoogle-search github. [BUG] systemd launch script does not work · Issue #1063 · benbusby/whoogle-search · GitHub

For me it is running as user whoogle

root@DietPi:~# ps -ef | grep whoogle
whoogle     2056       1  0 22:56 ?        00:00:00 /opt/whoogle/whoogle-search/venv/bin/python3 -um app --host 127.0.0.1 --port 8786
root@DietPi:~#
root@DietPi:~# ss -tulpn | grep LISTEN
tcp   LISTEN 0      128          0.0.0.0:22        0.0.0.0:*    users:(("sshd",pid=427,fd=3))
tcp   LISTEN 0      1024       127.0.0.1:8786      0.0.0.0:*    users:(("python3",pid=2056,fd=6))
tcp   LISTEN 0      128             [::]:22           [::]:*    users:(("sshd",pid=427,fd=4))

it’s a error in unit systemd.

wrong:

ExecStart=/opt/whoogle-search/venv/bin/python -um app --host 127.0.0.1 --port 5000

properly:

ExecStart=python3 -um app --host 127.0.0.1 --port 5000

and it’s working fine now.

● whoogle.service - Whoogle
     Loaded: loaded (/lib/systemd/system/whoogle.service; disabled; preset: enabled)
     Active: active (running) since Tue 2024-02-13 18:43:40 MSK; 6s ago
   Main PID: 1661 (python3)
      Tasks: 5 (limit: 2206)
     Memory: 46.5M
        CPU: 3.227s
     CGroup: /system.slice/whoogle.service
             └─1661 python3 -um app --host 127.0.0.1 --port 5000