You are not logged in.

#1 2020-09-16 09:34:43

lilgman
Member
Registered: 2019-11-09
Posts: 8

Lithium with Debian Testing

First of all, I want to say a big thank you to everyone who works on Bunsenlabs.  It is such a great distro that it's easy to take it for granted!  It does it's job and get's out of the way so well that you sometimes hardly notice what a great tool you are using! 

Second, I know that I'm running a Frankenstein version.  I have been for quite a while.  I take all the blame, and yes, I want to keep the pieces.  Sometime in early 2019 I installed Debian from a minimal network install then added Lithium using this guide:  https://forums.bunsenlabs.org/viewtopic.php?id=5547 Then I upgraded to Debian Testing.  I liked it so much that I've been using it full time since then.  I stayed with Buster for a few weeks after it went stable while the testing chaos past then started following testing again. 

This has worked without problems until Testing wanted to remove python 2 this week.  It seemed the main things that would be affected for me were BunsenLabs specific, but I wasn't positive.  I decided to see what would happen since I do have a Buster install that I can fall back on.  Obviously the menus are messed up, but that hasn't been too traumatic so far.  My biggest disappointment has been losing the power manager button and network manager button from my Tint2 setup.  The volume button is still there and works, but everything else is gone.  It appears that it should still be there in the config file.  Can anyone advise on a way to restore this, or were they completely dependent on python 2?

Here's what was removed:

Remove: gimp-plugin-registry:amd64 (9.20180625+nmu1), python-keybinder:amd64 (0.3.1-1+b2), obmenu:amd64 (1.0-4), python-notify:amd64 (0.1.1-4+b2), python:amd64 (2.7.17-2), python-enum34:amd64 (1.1.6-2), python-cryptography:amd64 (2.8-3+b1), libpython-stdlib:amd64 (2.7.17-2), python-ipaddress:amd64 (1.0.17-1), python-paramiko:amd64 (2.6.0-1), bunsen-pipemenus:amd64 (10.2.5-1), python-gtk2:amd64 (2.24.0-6), python-glade2:amd64 (2.24.0-6), python-minimal:amd64 (2.7.17-2)
End-Date: 2020-09-15  09:44:02

Thank you for any help and advice!

Offline

#2 2020-09-16 12:18:25

sleekmason
Member
Registered: 2018-05-22
Posts: 209

Re: Lithium with Debian Testing

You can try a symlink to python:

cd /usr/bin
sudo ln -fs <full_path_to_existing_python_binary> python

Offline

#3 2020-09-16 14:52:29

damo
....moderator....
Registered: 2015-08-20
Posts: 6,329

Re: Lithium with Debian Testing

Bunsenlabs is gradually migrating scripts to Python3, and the plan is to update the packages as we go. Regular upgrades should bring in the new scripts (but they will be done "when they are done"!)


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Online

#4 2020-09-16 15:38:27

lilgman
Member
Registered: 2019-11-09
Posts: 8

Re: Lithium with Debian Testing

Thank you to both of the replies.  @damo, that makes sense.  I'll keep checking back for updates, as I know they will be coming.  Is there a testing branch of BunsenLabs yet?

@sleekmason, I'll look into this a bit more.  It might be a bandage fix at least if it works.

Offline

#5 2020-09-16 17:21:38

damo
....moderator....
Registered: 2015-08-20
Posts: 6,329

Re: Lithium with Debian Testing

lilgman wrote:

Thank you to both of the replies.  @damo, that makes sense.  I'll keep checking back for updates, as I know they will be coming.  Is there a testing branch of BunsenLabs yet?
....

Not yet, but @jmechnich has made pull requests, and started some patching: https://github.com/jmechnich?tab=repositories


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Online

#6 2020-09-17 01:52:11

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,326
Website

Re: Lithium with Debian Testing

lilgman wrote:

My biggest disappointment has been losing the power manager button and network manager button from my Tint2 setup...
Can anyone advise on a way to restore this, or were they completely dependent on python 2?

It's not that bad, in this case. smile
What was starting up xfce4-power-manager and nm-applet was the python script /usr/bin/bl-xdg-autostart which is indeed one of the python2 scripts that will need updating to use python3. That script looks at the .desktop files in /etc/xdg/autostart, checks the contents and executes the appropriate ones.

But you can start those two utilities (or any others) from your personal autostart file instead.

Add these two lines to $HOME/.config/bunsen/autostart, probably in the all-window-manager section around lines 120~145:

xfce4-power-manager &
nm-applet &

It probably wouldn't hurt to comment out the non-functional last line too:

#bl-xdg-autostart

You can add any other applications that should have been started from /etc/xdg/autostart the same way, by checking the Exec= line inside the .desktop files. But be careful, you don't nedd to start everything in there, some things are already handled elsewhere. On a Debian system with python2 you can run 'bl-xdg-autostart --list' to see what should be happening.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#7 2020-09-17 10:37:56

lilgman
Member
Registered: 2019-11-09
Posts: 8

Re: Lithium with Debian Testing

Ahhh!  Thank you so much @johnraff!  That has solved my immediate problems, and as I miss things I now know where to look to get them started.  I assume that once bl-xdg-autostart has been updated I should restore this file to original?

@damo Good news that patching has started.  I wish @jmechnich and everyone the very best!

Offline

#8 2020-09-18 01:18:10

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,326
Website

Re: Lithium with Debian Testing

lilgman wrote:

I assume that once bl-xdg-autostart has been updated I should restore this file to original?

Yes, but that might not be for a while...


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#9 2020-09-18 17:32:32

JCN-9000
Member
From: Turin, Italy
Registered: 2016-04-22
Posts: 10

Re: Lithium with Debian Testing

Hi
Been There Done That, me too running Debian Testing and Lithium.
python disappeared, scripts stopped working for two days before realizing why.
Current solution is using alternatives to have /usr/bin/python point to python2, which is still installed on system.
I suppose python was a meta-package.
this way updates will not disrupt the system.

# update-alternatives --install /usr/bin/python python /usr/bin/python2 50
# update-alternatives --install /usr/bin/python python /usr/bin/python3 20

my 2€c

Offline

#10 2020-09-25 07:28:17

lilgman
Member
Registered: 2019-11-09
Posts: 8

Re: Lithium with Debian Testing

JCN-9000 wrote:

Hi
Been There Done That, me too running Debian Testing and Lithium.
python disappeared, scripts stopped working for two days before realizing why.
Current solution is using alternatives to have /usr/bin/python point to python2, which is still installed on system.
I suppose python was a meta-package.
this way updates will not disrupt the system.

# update-alternatives --install /usr/bin/python python /usr/bin/python2 50
# update-alternatives --install /usr/bin/python python /usr/bin/python3 20

my 2€c

Thank you for this advice!  I looked through the man page for update-alternatives and think I understand this.  However, I have already let apt-get remove the package that evidently require the python meta-package.  Even after updating the alternatives as you suggested, I cannot reinstall them.  I get:

The following packages have unmet dependencies:
 bunsen-pipemenus : Depends: python but it is not installable
                    Depends: python-paramiko but it is not installable
                    Recommends: inotify-tools but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

What would happen if I would force installation?  Will it just make my Frankenstein distribution a little more crazy? So far I'm getting along without them after making the autostart changes that @johnraff suggested.

Offline

#11 2020-09-25 07:45:45

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 7,326
Website

Re: Lithium with Debian Testing

johnraff wrote:
lilgman wrote:

I assume that once bl-xdg-autostart has been updated I should restore this file to original?

Yes, but that might not be for a while...

In fact upgrading bl-xdg-autostart to python3 was very simple (there is a 2to3 utility), so this 2008 vintage script might still work on Debian Bullseye.

Some day we might recode it, but meanwhile anyone with a bit of time, if you could try copying the code below to ~/bin/bl-xdg-autostart, make the file executable, comment out any extra lines you previously added to ~/.config/bunsen/autostart and log out and back in. Do the autostarted programs appear in your system tray?

#!/usr/bin/python3

# openbox-xdg-autostart runs things based on the XDG autostart specification
# Copyright (C) 2008       Dana Jansens
#
# Renamed to bl-xdg-autostart for BunsenLabs Linux 2019
# Upgraded to use python3 for BunsenLabs Linux 2020
#
# XDG autostart specification can be found here:
# http://standards.freedesktop.org/autostart-spec/
#
#
#
# LICENSE:
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.

ME="bl-xdg-autostart"
VERSION="1.1"

import os, glob, sys
try:
    from xdg import BaseDirectory
    from xdg.DesktopEntry import DesktopEntry
    from xdg.Exceptions import ParsingError
except ImportError:
    print()
    print("ERROR:", ME, "requires PyXDG to be installed", file=sys.stderr)
    print()
    sys.exit(1)

def main(argv=sys.argv):
    if "--help" in argv[1:]:
        show_help()
        return 0
    if "--version" in argv[1:]:
        show_version()
        return 0

    # get the autostart directories
    autodirs = BaseDirectory.load_config_paths("autostart")

    # find all the autostart files
    files = []
    for dir in autodirs:
        for path in glob.glob(os.path.join(dir, '*.desktop')):
            try:
                autofile = AutostartFile(path)
            except ParsingError:
                print("Invalid .desktop file: " + path)
            else:
                if not autofile in files:
                    files.append(autofile)

    list = False
    if "--list" in argv[1:]:
        list = True
        argv.remove("--list")

    # run them !
    environments = argv[1:]
    for autofile in files:
        if list: autofile.display(environments)
        else: autofile.run(environments)

class AutostartFile:
    def __init__(self, path):
        self.path = path
        self.filename = os.path.basename(path)
        self.dirname = os.path.dirname(path)
        self.de = DesktopEntry(path)

    def __eq__(self, other):
        return self.filename == other.filename

    def __str__(self):
        return self.path + " : " + self.de.getName()

    def _isexecfile(self, path):
        return os.access(path, os.X_OK)

    def _findFile(self, path, search, match_func):
        # check empty path
        if not path: return None
        # check absolute path
        if path[0] == '/':
            if match_func(path): return path
            else: return None
        else:
            # check relative path
            for dirname in search.split(os.pathsep):
                if dirname != "":
                    candidate = os.path.join(dirname, path)
                    if (match_func(candidate)): return candidate

    def _alert(self, str, info=False):
        if info:
            print("\t ", str)
        else:
            print("\t*", str)

    def _showInEnvironment(self, envs, verbose=False):
        default = not self.de.getOnlyShowIn()
        noshow = False
        force = False
        for i in self.de.getOnlyShowIn():
            if i in envs: force = True
        for i in self.de.getNotShowIn():
            if i in envs: noshow = True

        if verbose:
            if not default and not force:
                s = ""
                for i in self.de.getOnlyShowIn():
                    if s: s += ", "
                    s += i
                self._alert("Excluded by: OnlyShowIn (" + s + ")")
            if default and noshow and not force:
                s = ""
                for i in self.de.getNotShowIn():
                    if s: s += ", "
                    s += i
                self._alert("Excluded by: NotShowIn (" + s + ")")
        return (default and not noshow) or force

    def _shouldRun(self, envs, verbose=False):
        if not self.de.getExec():
            if verbose: self._alert("Excluded by: Missing Exec field")
            return False
        if self.de.getHidden():
            if verbose: self._alert("Excluded by: Hidden")
            return False
        if self.de.getTryExec():
            if not self._findFile(self.de.getTryExec(), os.getenv("PATH"),
                                  self._isexecfile):
                if verbose: self._alert("Excluded by: TryExec (" +
                                        self.de.getTryExec() + ")")
                return False
        if not self._showInEnvironment(envs, verbose):
            return False
        return True

    def display(self, envs):
        if self._shouldRun(envs):
            print("[*] " + self.de.getName())
        else:
            print("[ ] " + self.de.getName())
        self._alert("File: " + self.path, info=True)
        if self.de.getExec():
            self._alert("Executes: " + self.de.getExec(), info=True)
        self._shouldRun(envs, True)
        print()

    def run(self, envs):
        here = os.getcwd()
        if self.de.getPath():
            os.chdir(self.de.getPath())
        if self._shouldRun(envs):
            args = ["/bin/sh", "-c", "exec " + self.de.getExec()]
            os.spawnv(os.P_NOWAIT, args[0], args);
        os.chdir(here)

def show_help():
    print("Usage:", ME, "[OPTION]... [ENVIRONMENT]...")
    print()
    print("This tool will run xdg autostart .desktop files")
    print()
    print("OPTIONS")
    print("  --list        Show a list of the files which would be run")
    print("                Files which would be run are marked with an asterix")
    print("                symbol [*].  For files which would not be run,")
    print("                information is given for why they are excluded")
    print("  --help        Show this help and exit")
    print("  --version     Show version and copyright information")
    print()
    print("ENVIRONMENT specifies a list of environments for which to run autostart")
    print("applications.  If none are specified, only applications which do not ")
    print("limit themselves to certain environments will be run.")
    print()
    print("ENVIRONMENT can be one or more of:")
    print("  GNOME         Gnome Desktop")
    print("  KDE           KDE Desktop")
    print("  ROX           ROX Desktop")
    print("  XFCE          XFCE Desktop")
    print("  Old           Legacy systems")
    print()
    print("*COPYRIGHT*")
    print("openbox-xdg-autostart was written by Dana Jansens in 2008,")
    print("and originally provided in openbox under the GPL-2 licence.")
    print()

def show_version():
    print(ME, VERSION)
    print("Copyright (c) 2008        Dana Jansens")
    print()

if __name__ == "__main__":
        sys.exit(main())

...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

Board footer

Powered by FluxBB