rbreaves / kinto

Mac-style shortcut keys for Linux & Windows.
http://kinto.sh
GNU General Public License v2.0
4.41k stars 213 forks source link

Install script fails on Lunar Lobster (23.04) #807

Open chaim1221 opened 1 year ago

chaim1221 commented 1 year ago

Describe the bug I tried the install script. It failed.

I heard about the project from multiple sources and had high hopes. I was a little worried when it started messing with Python. To be clear the solution I'm looking for is not --break-system-packages haha.

Expected behavior Expected the install script to succeed.

Install Type: Bare Metal, haven’t tried VM Distro: Ubuntu Lunar Lobster 23.04 DE: Gnome Branch: master Commit:

Logs and status if relevant

# xkeysnail
sudo systemctl status xkeysnail
sudo journalctl --unit=xkeysnail.service -b

# xkb
systemctl --user status keyswap
journalctl --user-unit=keyswap.service -b
celiyah@xanity:~$ sudo systemctl status xkeysnail
Unit xkeysnail.service could not be found.
celiyah@xanity:~$ systemctl --user status keyswap
Unit keyswap.service could not be found.

Screenshots

celiyah@xanity:~$ /bin/bash -c "$(wget -qO- https://raw.githubusercontent.com/rbreaves/kinto/HEAD/install/linux.sh || curl -fsSL https://raw.githubusercontent.com/rbreaves/kinto/HEAD/install/linux.sh)"
--2023-05-11 02:23:08--  https://github.com/rbreaves/kinto/archive/refs/heads/master.zip
Resolving github.com (github.com)... 140.82.114.4
Connecting to github.com (github.com)|140.82.114.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/rbreaves/kinto/zip/refs/heads/master [following]
--2023-05-11 02:23:09--  https://codeload.github.com/rbreaves/kinto/zip/refs/heads/master
Resolving codeload.github.com (codeload.github.com)... 140.82.112.10
Connecting to codeload.github.com (codeload.github.com)|140.82.112.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/zip]
Saving to: ‘/home/celiyah/Downloads/kinto.zip’

/home/celiyah/Downloads/kinto.zip        [  <=>                                                                ] 678.60K  2.14MB/s    in 0.3s    

2023-05-11 02:23:09 (2.14 MB/s) - ‘/home/celiyah/Downloads/kinto.zip’ saved [694886]

Archive:  /home/celiyah/Downloads/kinto.zip
9a13549c10fa7d1bf9e6ac4bc289d347e07d842f
   creating: /home/celiyah/Downloads/kinto-master/
  inflating: /home/celiyah/Downloads/kinto-master/.gitattributes  
   creating: /home/celiyah/Downloads/kinto-master/.github/
   creating: /home/celiyah/Downloads/kinto-master/.github/ISSUE_TEMPLATE/
  inflating: /home/celiyah/Downloads/kinto-master/.github/ISSUE_TEMPLATE/bug_report.md  
  inflating: /home/celiyah/Downloads/kinto-master/.github/ISSUE_TEMPLATE/feature_request.md  
  inflating: /home/celiyah/Downloads/kinto-master/.github/ISSUE_TEMPLATE/gratitude.md  
  inflating: /home/celiyah/Downloads/kinto-master/.github/ISSUE_TEMPLATE/question.md  
   creating: /home/celiyah/Downloads/kinto-master/.github/workflows/
  inflating: /home/celiyah/Downloads/kinto-master/.github/workflows/01-ubuntu-budgie.yml  
  inflating: /home/celiyah/Downloads/kinto-master/.gitignore  
  inflating: /home/celiyah/Downloads/kinto-master/LICENSE  
  inflating: /home/celiyah/Downloads/kinto-master/README.md  
   creating: /home/celiyah/Downloads/kinto-master/assets/
  inflating: /home/celiyah/Downloads/kinto-master/assets/kinto-black-invert.ico  
  inflating: /home/celiyah/Downloads/kinto-master/assets/kinto-black.ico  
  inflating: /home/celiyah/Downloads/kinto-master/assets/kinto-color-black-invert.ico  
  inflating: /home/celiyah/Downloads/kinto-master/assets/kinto-color-black.ico  
  inflating: /home/celiyah/Downloads/kinto-master/assets/kinto-color-invert-border.ico  
  inflating: /home/celiyah/Downloads/kinto-master/assets/kinto-color-invert.ico  
  inflating: /home/celiyah/Downloads/kinto-master/assets/kinto-color-white-invert.ico  
  inflating: /home/celiyah/Downloads/kinto-master/assets/kinto-color.ico  
  inflating: /home/celiyah/Downloads/kinto-master/assets/kinto-white-invert.ico  
  inflating: /home/celiyah/Downloads/kinto-master/assets/kinto-white.ico  
   creating: /home/celiyah/Downloads/kinto-master/install/
  inflating: /home/celiyah/Downloads/kinto-master/install/linux.sh  
  inflating: /home/celiyah/Downloads/kinto-master/install/windows.ps1  
   creating: /home/celiyah/Downloads/kinto-master/linux/
  inflating: /home/celiyah/Downloads/kinto-master/linux/gnome_logoff.sh  
   creating: /home/celiyah/Downloads/kinto-master/linux/gui/
  inflating: /home/celiyah/Downloads/kinto-master/linux/gui/capslock_1200x720.png  
  inflating: /home/celiyah/Downloads/kinto-master/linux/gui/keys_1200x720.png  
  inflating: /home/celiyah/Downloads/kinto-master/linux/gui/kinto-gui.py  
  inflating: /home/celiyah/Downloads/kinto-master/linux/gui/kinto.desktop  
  inflating: /home/celiyah/Downloads/kinto-master/linux/gui/tuxbg.png  
  inflating: /home/celiyah/Downloads/kinto-master/linux/gui/tuxcry4.png  
  inflating: /home/celiyah/Downloads/kinto-master/linux/gui/tuxerror.png  
  inflating: /home/celiyah/Downloads/kinto-master/linux/gui/tuxuninstall.png  
  inflating: /home/celiyah/Downloads/kinto-master/linux/initkb  
  inflating: /home/celiyah/Downloads/kinto-master/linux/killdups.sh  
  inflating: /home/celiyah/Downloads/kinto-master/linux/kinto-service.sh  
  inflating: /home/celiyah/Downloads/kinto-master/linux/kinto.py  
  inflating: /home/celiyah/Downloads/kinto-master/linux/limitedadmins  
  inflating: /home/celiyah/Downloads/kinto-master/linux/prexk.sh  
  inflating: /home/celiyah/Downloads/kinto-master/linux/root_logoff.sh  
   creating: /home/celiyah/Downloads/kinto-master/linux/system-config/
  inflating: /home/celiyah/Downloads/kinto-master/linux/system-config/dename.sh  
  inflating: /home/celiyah/Downloads/kinto-master/linux/system-config/unipkg.sh  
   creating: /home/celiyah/Downloads/kinto-master/linux/trayapps/
   creating: /home/celiyah/Downloads/kinto-master/linux/trayapps/appindicator/
   creating: /home/celiyah/Downloads/kinto-master/linux/trayapps/appindicator/icons/
  inflating: /home/celiyah/Downloads/kinto-master/linux/trayapps/appindicator/icons/kinto-color-16.svg  
  inflating: /home/celiyah/Downloads/kinto-master/linux/trayapps/appindicator/icons/kinto-color.svg  
  inflating: /home/celiyah/Downloads/kinto-master/linux/trayapps/appindicator/icons/kinto-invert-16.svg  
  inflating: /home/celiyah/Downloads/kinto-master/linux/trayapps/appindicator/icons/kinto-invert.svg  
  inflating: /home/celiyah/Downloads/kinto-master/linux/trayapps/appindicator/icons/kinto-solid-16.svg  
  inflating: /home/celiyah/Downloads/kinto-master/linux/trayapps/appindicator/icons/kinto-solid.svg  
  inflating: /home/celiyah/Downloads/kinto-master/linux/trayapps/appindicator/icons/kinto.svg  
  inflating: /home/celiyah/Downloads/kinto-master/linux/trayapps/appindicator/kintotray.desktop  
  inflating: /home/celiyah/Downloads/kinto-master/linux/trayapps/appindicator/kintotray.py  
  inflating: /home/celiyah/Downloads/kinto-master/linux/vscode_keybindings.json  
  inflating: /home/celiyah/Downloads/kinto-master/linux/xkeysnail.desktop  
  inflating: /home/celiyah/Downloads/kinto-master/linux/xkeysnail.service  
  inflating: /home/celiyah/Downloads/kinto-master/linux/xkeysnail_sysv.desktop  
  inflating: /home/celiyah/Downloads/kinto-master/linux/xkeystart.sh  
  inflating: /home/celiyah/Downloads/kinto-master/prekinto.py  
  inflating: /home/celiyah/Downloads/kinto-master/setup.py  
   creating: /home/celiyah/Downloads/kinto-master/windows/
  inflating: /home/celiyah/Downloads/kinto-master/windows/NoShell.vbs  
  inflating: /home/celiyah/Downloads/kinto-master/windows/WinToMac_AltWin_swap.skl  
  inflating: /home/celiyah/Downloads/kinto-master/windows/autohotkey.ps1  
  inflating: /home/celiyah/Downloads/kinto-master/windows/detectUSB.ahk  
  inflating: /home/celiyah/Downloads/kinto-master/windows/kinto-start.vbs  
  inflating: /home/celiyah/Downloads/kinto-master/windows/kinto.ahk  
  inflating: /home/celiyah/Downloads/kinto-master/windows/standard_ctrlalt_swap.skl  
  inflating: /home/celiyah/Downloads/kinto-master/windows/theme_ubuntu.reg  
  inflating: /home/celiyah/Downloads/kinto-master/windows/toggle_kb.bat  
   creating: /home/celiyah/Downloads/kinto-master/windows/unused/
  inflating: /home/celiyah/Downloads/kinto-master/windows/unused/macbook_winctrl_capsesc_swap.reg  
  inflating: /home/celiyah/Downloads/kinto-master/windows/unused/macbook_winctrl_swap.reg  
  inflating: /home/celiyah/Downloads/kinto-master/windows/unused/macbook_winctrl_swap.skl  
  inflating: /home/celiyah/Downloads/kinto-master/windows/unused/remove_keyswap.reg  
  inflating: /home/celiyah/Downloads/kinto-master/windows/unused/standard_ctrlalt_capsesc_swap.reg  
  inflating: /home/celiyah/Downloads/kinto-master/windows/unused/standard_ctrlalt_swap.reg  
  inflating: /home/celiyah/Downloads/kinto-master/windows/unused/theme_campbell.reg  
  inflating: /home/celiyah/Downloads/kinto-master/windows/unused/theme_legacy.reg  
  inflating: /home/celiyah/Downloads/kinto-master/windows/unused/theme_onehalfdark.reg  
  inflating: /home/celiyah/Downloads/kinto-master/windows/unused/theme_onehalflight.reg  
  inflating: /home/celiyah/Downloads/kinto-master/windows/usb.vbs  
  inflating: /home/celiyah/Downloads/kinto-master/xkeysnail_service.sh  
Installing Kinto...
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git

Kinto  build 
Type in Linux like it's a Mac.

Overlay key,  'Super_L' , detected. Will be removing so Super-Space can remap to Cmd-Space for app launching..
Will need to install python3-pip...
Debian
Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu lunar InRelease                                                                                        
Get:3 http://us.archive.ubuntu.com/ubuntu lunar-updates InRelease [99.4 kB]                                                                      
Hit:4 https://updates.signal.org/desktop/apt xenial InRelease                                                                                    
Hit:5 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64  InRelease                                                      
Hit:6 https://repo.radeon.com/rocm/apt/5.4.3 focal InRelease                                                                                     
Hit:7 http://us.archive.ubuntu.com/ubuntu lunar-backports InRelease                                                
Get:8 http://us.archive.ubuntu.com/ubuntu lunar-security InRelease [90.7 kB]     
Get:9 http://us.archive.ubuntu.com/ubuntu lunar-updates/main amd64 Packages [14.8 kB]       
Hit:10 https://ppa.launchpadcontent.net/radeon-profile/stable/ubuntu jammy InRelease
Get:11 http://us.archive.ubuntu.com/ubuntu lunar-updates/main amd64 DEP-11 Metadata [13.5 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu lunar-updates/universe amd64 Packages [8,028 B]
Get:13 http://us.archive.ubuntu.com/ubuntu lunar-updates/universe i386 Packages [7,512 B]
Fetched 234 kB in 1s (282 kB/s)                                     
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  fonts-font-awesome libglew2.2 libslopy7.6 slop
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libexpat1-dev libjs-sphinxdoc libjs-underscore libpython3-dev libpython3.11-dev python3-dev python3-distutils python3-setuptools python3-wheel
  python3.11-dev
Suggested packages:
  python-setuptools-doc
The following NEW packages will be installed:
  libexpat1-dev libjs-sphinxdoc libjs-underscore libpython3-dev libpython3.11-dev python3-dev python3-distutils python3-pip python3-setuptools
  python3-wheel python3.11-dev
0 upgraded, 11 newly installed, 0 to remove and 168 not upgraded.
Need to get 8,287 kB of archives.
After this operation, 38.9 MB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu lunar/main amd64 libexpat1-dev amd64 2.5.0-1 [137 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu lunar/main amd64 libjs-underscore all 1.13.4~dfsg+~1.11.4-3 [118 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu lunar/main amd64 libjs-sphinxdoc all 5.3.0-4 [130 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu lunar/main amd64 libpython3.11-dev amd64 3.11.2-6 [5,338 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu lunar/main amd64 libpython3-dev amd64 3.11.2-1 [7,482 B]
Get:6 http://us.archive.ubuntu.com/ubuntu lunar/main amd64 python3.11-dev amd64 3.11.2-6 [614 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu lunar/main amd64 python3-distutils all 3.11.2-2 [130 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu lunar/main amd64 python3-dev amd64 3.11.2-1 [26.8 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu lunar/main amd64 python3-setuptools all 66.1.1-1 [453 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu lunar/universe amd64 python3-wheel all 0.38.4-1 [31.2 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu lunar/universe amd64 python3-pip all 23.0.1+dfsg-1 [1,302 kB]
Fetched 8,287 kB in 1s (6,604 kB/s)     
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database ... 396449 files and directories currently installed.)
Preparing to unpack .../00-libexpat1-dev_2.5.0-1_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.5.0-1) ...
Selecting previously unselected package libjs-underscore.
Preparing to unpack .../01-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 .../02-libjs-sphinxdoc_5.3.0-4_all.deb ...
Unpacking libjs-sphinxdoc (5.3.0-4) ...
Selecting previously unselected package libpython3.11-dev:amd64.
Preparing to unpack .../03-libpython3.11-dev_3.11.2-6_amd64.deb ...
Unpacking libpython3.11-dev:amd64 (3.11.2-6) ...
Selecting previously unselected package libpython3-dev:amd64.
Preparing to unpack .../04-libpython3-dev_3.11.2-1_amd64.deb ...
Unpacking libpython3-dev:amd64 (3.11.2-1) ...
Selecting previously unselected package python3.11-dev.
Preparing to unpack .../05-python3.11-dev_3.11.2-6_amd64.deb ...
Unpacking python3.11-dev (3.11.2-6) ...
Selecting previously unselected package python3-distutils.
Preparing to unpack .../06-python3-distutils_3.11.2-2_all.deb ...
Unpacking python3-distutils (3.11.2-2) ...
Selecting previously unselected package python3-dev.
Preparing to unpack .../07-python3-dev_3.11.2-1_amd64.deb ...
Unpacking python3-dev (3.11.2-1) ...
Selecting previously unselected package python3-setuptools.
Preparing to unpack .../08-python3-setuptools_66.1.1-1_all.deb ...
Unpacking python3-setuptools (66.1.1-1) ...
Selecting previously unselected package python3-wheel.
Preparing to unpack .../09-python3-wheel_0.38.4-1_all.deb ...
Unpacking python3-wheel (0.38.4-1) ...
Selecting previously unselected package python3-pip.
Preparing to unpack .../10-python3-pip_23.0.1+dfsg-1_all.deb ...
Unpacking python3-pip (23.0.1+dfsg-1) ...
Setting up python3-distutils (3.11.2-2) ...
Setting up python3-setuptools (66.1.1-1) ...
Setting up python3-wheel (0.38.4-1) ...
Setting up libexpat1-dev:amd64 (2.5.0-1) ...
Setting up libpython3.11-dev:amd64 (3.11.2-6) ...
Setting up python3-pip (23.0.1+dfsg-1) ...
Setting up libjs-underscore (1.13.4~dfsg+~1.11.4-3) ...
Setting up libpython3-dev:amd64 (3.11.2-1) ...
Setting up python3.11-dev (3.11.2-6) ...
Setting up libjs-sphinxdoc (5.3.0-4) ...
Setting up python3-dev (3.11.2-1) ...
Processing triggers for man-db (2.11.2-1) ...
W: --force-yes is deprecated, use one of the options starting with --allow instead.
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.
Using systemd...
localuser:root being added to access control list
Cloning into 'xkeysnail'...
remote: Enumerating objects: 116, done.
remote: Counting objects: 100% (116/116), done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 116 (delta 70), reused 94 (delta 62), pack-reused 0
Receiving objects: 100% (116/116), 35.81 KiB | 894.00 KiB/s, done.
Resolving deltas: 100% (70/70), done.
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.

Kinto install has failed.

cd into ./xkeysnail
Run 'sudo pip3 install --upgrade .' to debug issue

Additional context Add any other context about the problem here.

RedBearAK commented 1 year ago

@chaim1221

Disclaimer: I'm not the Kinto dev, just a user and minor contributor.

Yeah, so temporary way around this is installing pipx and using pipx to install from the local xkeysnail folder that the Kinto installer clones into ~/Downloads/kinto-master/xkeysnail. I described how this allowed me to complete the Kinto install and get Kinto working, in issue #805.

Long term solution is to do what the Python docs have been recommending for years, which is to create a Python virtual environment if you have any need to install a Python package that isn't provided by a native distro package. Then you can do whatever you want in your venv and the system won't complain about you using pip, or installing any Python packages that might interfere with the system-wide Python installation (and possibly break things like the distro's package managers).

Apparently Python virtual environments are not as scary as I thought. They are just directories with some copies and symlinks to the main Python interpreter and the standard Python libraries, and when you "activate" the virtual environment it tells your app to look for what it needs inside that directory, rather than looking for things in the main system paths. You do have to "source" the activation binary/script before you try to run your Python app, but that's about it.

I have it all working in my own project, which is closely related to Kinto, but using keyszer instead of xkeysnail. So I'm able to install on Xubuntu and I'm sure Ubuntu 23.04 without running into this error. I'll probably test Ubuntu next.

RedBearAK commented 1 year ago

@chaim1221

Sorry, looks like I can't test on Ubuntu until I find some hardware to put it on, because of a bug that makes it impossible to log into an Xorg session in a virtual machine created by software like GNOME Boxes or Virt-Manager (i.e., a QEMU VM).

https://ubuntuforums.org/showthread.php?t=2486167&page=3

Unbelievable that they let this get through QA, and still haven't fixed it with an update.

I have NEVER had the kind of trouble with a Linux distro that I've now had in the last few days with Xubuntu 23.04 (desktop frequently crashed when using file manager) and Ubuntu 23.04 (can't login to Xorg at all). Can't say that I'm impressed with Canonical's work in this release cycle. My testing on Fedora and Mint in the same VM software has gone much better.

Edit: Trying to login to an Xorg session also fails on VirtualBox. Amazing.

chaim1221 commented 1 year ago

Hey there—

re: Lunar Lobster. I’m on bare metal at home, I haven’t tried virtualizing it. I would totally believe they don’t have everything in order.

re: Py. I can make a virtualenv and try installing it there. If it works maybe we could get fpm to install it in a virtualenv, then make a deb and rpm that will put the result on the path somewhere.

What distro are you all developing on? Fedora? Arch?

RedBearAK commented 1 year ago

@chaim1221

FWIW, I tested my installer on Ubuntu 22.04 and had no issues, and it worked on Xubuntu 23.04, so I have no reason to think it wouldn't work on Ubuntu 23.04. If you're feeling particularly adventuresome you can try it:

https://github.com/RedBearAK/toshy/tree/dev_alpha

Note that this is a completely separate project from Kinto, so if you have issues submit them on that repo, please do not report them here in Kinto's issues:

https://github.com/RedBearAK/toshy/issues

The dev_alpha branch is the only one with commits so far, but that's just because I'm still in the process of tweaking the installer to make it as widely compatible as possible. It's more like an early beta as far as the installer goes, but the actual config, if the installer works, should be solid.

There's no explicit "uninstall" yet, but there are some "remove" scripts that will disable and remove basically everything that does anything meaningful, if you want to back it out.

RedBearAK commented 1 year ago

@chaim1221

Tested my installer on Ubuntu 23.04 on a MacBookPro5,5 model. Went perfectly, just had to remember to log in with "GNOME on Xorg" after rebooting, since Ubuntu has been defaulting to a Wayland session for a while now.

There is a working "draft" branch of keyszer with Wayland+GNOME support that would actually work in this situation, but I haven't decided yet if I should integrate it into my installer.

chaim1221 commented 1 year ago

Unfortunately I bricked the computer I tried this on (unrelated), and haven't gotten around to chrooting it again yet. As soon as I do I'll let y'all know. Thanks for taking a look. <3

wtdcode commented 1 year ago

I solve this in a few steps:

  1. First run the installation scripts and get the error.
  2. Create a venv and activate it.
  3. Go to ~/Downloads/kinto-master/xkeysnail and do python3 -m pip install .
  4. Edit ~/Downloads/kinto-master/xkeysnail_service.sh and remove https://github.com/rbreaves/kinto/blob/master/xkeysnail_service.sh#L408 and https://github.com/rbreaves/kinto/blob/master/xkeysnail_service.sh#L569
  5. Rerun setup.py in ~/Downloads/kinto-master and it should be good

I'm not sure why the installation script asks for sudo pip in the two cases, @RedBearAK do you know the reason? If sudo pip could be safely removed, I can draft a PR for this.

RedBearAK commented 1 year ago

@wtdcode

I'm not sure why the installation script asks for sudo pip in the two cases, @RedBearAK do you know the reason? If sudo pip could be safely removed, I can draft a PR for this.

Although my own offshoot project (Toshy) uses a Python virtual environment and I've been poking around in the Kinto installer for a long time, you should take the following with a grain of salt:

From what I understand, historically the keymapper Kinto uses (xkeysnail) has been run as root to get around permission issues with accessing the uinput device (as far as I know). This then required using xhost to open up the X server to root. The installer uses sudo pip3 probably because it was the easiest way to get access to the necessary utilities to get things to work. If you just use pip3 to install things they get installed in a folder structure in your home rather than the system Python library locations. And if you create a Python virtual environment then the packages installed by pip will get installed in the venv location you created. In both cases you have to make sure the install location is in the paths that Python sees when you attempt to use something that needs one of those packages. This usually requires modifying the PYTHONPATH environment variable and sys.path when running a Python script.

And, just in case you're not aware of this, in order to actually use the virtual environment once you leave the shell where you activated it, you need launcher scripts that will re-activate that specific venv before running the actual commands you're trying to use (e.g., the keymapper command that actually loads your config). That's what I've had to do with my own project.

My own project uses a Python virtual environment, activates it whenever it needs to do anything, and doesn't run the keymapper as root. Instead Toshy uses a udev rules file to give your user write access to the uinput device for the virtual keyboard. By not running as a separate user it was possible to modify the keymapper (keyszer, forked from xkeysnail) to make it support a couple of different Wayland environments (KDE and GNOME).

Toshy is in a fairly stable state and has installed successfully on a large selection of the most common Linux distros, including all the Ubuntu flavors I've tried. If you want to try it, just make sure you don't post issues about it here in the Kinto issues. It's a completely separate project, although in a way it is meant as a laboratory to test things that could be added to Kinto in the future.

https://github.com/RedBearAK/toshy

wtdcode commented 1 year ago

@wtdcode

I'm not sure why the installation script asks for sudo pip in the two cases, @RedBearAK do you know the reason? If sudo pip could be safely removed, I can draft a PR for this.

Although my own offshoot project (Toshy) uses a Python virtual environment and I've been poking around in the Kinto installer for a long time, you should take the following with a grain of salt:

From what I understand, historically the keymapper Kinto uses (xkeysnail) has been run as root to get around permission issues with accessing the uinput device (as far as I know). This then required using xhost to open up the X server to root. The installer uses sudo pip3 probably because it was the easiest way to get access to the necessary utilities to get things to work. If you just use pip3 to install things they get installed in a folder structure in your home rather than the system Python library locations. And if you create a Python virtual environment then the packages installed by pip will get installed in the venv location you created. In both cases you have to make sure the install location is in the paths that Python sees when you attempt to use something that needs one of those packages. This usually requires modifying the PYTHONPATH environment variable and sys.path when running a Python script.

This is a bit weird to me as kintosh is a userland program, no?

And, just in case you're not aware of this, in order to actually use the virtual environment once you leave the shell where you activated it, you need launcher scripts that will re-activate that specific venv before running the actual commands you're trying to use (e.g., the keymapper command that actually loads your config). That's what I've had to do with my own project.

I activate a default venv on my shell startup so it should be fine.

My own project uses a Python virtual environment, activates it whenever it needs to do anything, and doesn't run the keymapper as root. Instead Toshy uses a udev rules file to give your user write access to the uinput device for the virtual keyboard. By not running as a separate user it was possible to modify the keymapper (keyszer, forked from xkeysnail) to make it support a couple of different Wayland environments (KDE and GNOME).

Toshy is in a fairly stable state and has installed successfully on a large selection of the most common Linux distros, including all the Ubuntu flavors I've tried. If you want to try it, just make sure you don't post issues about it here in the Kinto issues. It's a completely separate project, although in a way it is meant as a laboratory to test things that could be added to Kinto in the future.

https://github.com/RedBearAK/toshy

I checked it and gave it a start because it looks insanely good! I will definitely give it a try.

RedBearAK commented 1 year ago

This is a bit weird to me as kintosh is a userland program, no?

Not sure how to answer that. The keymapper that actually does the work just needs access to input devices for incoming key codes, then uses /dev/uinput to send key codes into the Linux input system. When keyszer was forked from xkeysnail the running as root was kind of deprecated, in favor of a udev rule solution. Either way some permissions need to be tweaked to make it work, because Linux tries to keep the input stack secure so other users can't eavesdrop on your input that easily. I still only have a superficial understanding of most of what happens at the lower levels.

I activate a default venv on my shell startup so it should be fine.

That will certainly work if you're just running commands in a terminal. Not sure how well that will work when some other process outside the shell needs to run a command with the venv active. My installer creates its own virtual environment specific to what it needs, and installs a very customized version of keyszer to support what it does. You would be able to install the official keyszer package system-wide or in your user Python library and the two (or more) copies of keyszer shouldn't interfere with each other.

I checked it and gave it a star because it looks insanely good! I will definitely give it a try.

Thanks! Let me know if you run into problems.