LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-27-2013, 12:54 PM   #1
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Unwelcome triggering of hp-upgrade on 64-current.


Found this in my /var/log/syslog
Code:
ws1 hp-upgrade: hp-upgrade[1668]: warning:  distro is not found in AUTH_TYPES
Now I don't have a printer attached to this box, but I can remember that I accidentally caught the print hot-key in an app at around the timestamp of this message in my syslog which likely triggered this message.

I *really* don't like some arbitrary bit of python code trying to update bits of my system automatically from an external site, and I especially dislike it when it is an unrequested action and outside of package-management.

I don't know whether others will also perceive this as unwelcome or a problem, but I thought it worth raising.
 
Old 02-27-2013, 04:47 PM   #2
fskmh
Member
 
Registered: Jun 2002
Location: South Africa
Distribution: Custom slackware64-current
Posts: 307

Rep: Reputation: 92
What I find interesting about the script in question (base/password.py) is that although Slackware is listed in AUTH_TYPES:

Code:
AUTH_TYPES ={'mepis':'su',
             'debian':'su',
             'suse':'su',
             'mandriva':'su',
             'fedora':'su',
             'redhat':'su',
             'rhel':'su',
             'slackware':'su',
             'gentoo':'su',
             'redflag':'su',
             'ubuntu':'sudo',
             'xandros':'su',
             'freebsd':'su',
             'linspire':'su',
             'ark':'su',
             'pclinuxos':'su',
             'centos':'su',
             'igos':'su',
             'linuxmint':'sudo',
             'linpus':'sudo',
             'gos':'sudo',
             'boss':'su',
             'lfs':'su',
             }
The function that attempts to identify the name of the distro so that it can initiate the upgrade doesn't know what file to look for on Slackware:

Code:
def get_distro_name():
    os_name = None;
    if utils.which('lsb_release'):
       name = os.popen('lsb_release -i | cut -f 2')
       os_name = name.read().strip()
       name.close()
    else:
       name = os.popen("cat /etc/issue | awk '{print $1}' | head -n 1")
       os_name = name.read().strip()
       name.close()

    if "redhatenterprise" in os_name.lower():
        os_name = 'rhel'
    elif "suse" in os_name.lower():
        os_name = 'suse'

    return os_name
I'm not sure why they fall back to /etc/issue because that is almost always going to have escape sequences in it instead of static strings that can be awked. Seems trivially easy to fix but then instead of getting the warning message we'll get a prompt for the root password whenever upgrade.py gets called.
 
1 members found this post helpful.
Old 02-27-2013, 05:42 PM   #3
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,504

Rep: Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461
Quote:
Originally Posted by fskmh View Post
Seems trivially easy to fix but then instead of getting the warning message we'll get a prompt for the root password whenever upgrade.py gets called.
And who knows what the upgrade will do, entirely outside of the packaging system? Seems better to leave it broken. I looked to see if there was a ./configure option to disable this behavior, but it appears that there is not.
 
Old 02-27-2013, 06:01 PM   #4
cwizardone
LQ Veteran
 
Registered: Feb 2007
Distribution: Slackware64-current with "True Multilib" and KDE4Town.
Posts: 9,097

Rep: Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276Reputation: 7276
Not sure if this has anything at all to do with it, but since the "upgrade" I've noticed it, hplips, automatically turns on my printer whether I want it to or not.
 
Old 02-27-2013, 06:40 PM   #5
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Original Poster
Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Quote:
Originally Posted by volkerdi View Post
And who knows what the upgrade will do, entirely outside of the packaging system? Seems better to leave it broken. I looked to see if there was a ./configure option to disable this behavior, but it appears that there is not.
Just did exactly the same Pat. A quick grep seems to show that that hp-upgrade gets called from all over the hplip python sources in /usr/share/hplip. Rather than leave it broken, I wonder if we could replace hp-upgrade with some sort of no-op (just a sys.exit(0) or however it's done in python - not one of my languages). Actually, why not just replace it with a symlink to /usr/bin/true.

Last edited by GazL; 02-27-2013 at 06:59 PM.
 
Old 02-28-2013, 03:26 AM   #6
fskmh
Member
 
Registered: Jun 2002
Location: South Africa
Distribution: Custom slackware64-current
Posts: 307

Rep: Reputation: 92
On further inspection it seems that hplip is not capable of auto-installing on Slackware because get_distro() in installer/core_install.py doesn't have the necessary functionality to identify Slackware due to its reliance on lsb_release:

Code:
def get_distro(self):
        log.debug("Determining distro...")
        self.distro, self.distro_version = DISTRO_UNKNOWN, '0.0'

        found = False

        lsb_release = utils.which("lsb_release")

        if lsb_release:
            log.debug("Using 'lsb_release -is/-rs'")
            cmd = os.path.join(lsb_release, "lsb_release")
            status, name = utils.run(cmd + ' -is', self.passwordObj)
            name = name.lower().strip()
            log.debug("Distro name=%s" % name)
            if name.find("redhatenterprise") > -1:
                name="rhel"
.
.
.
and then the familiar fall-back to /etc/issue:

Code:
if not found:
            try:
                name = file('/etc/issue', 'r').read().lower().strip()
            except IOError:
                # Some O/Ss don't have /etc/issue (Mac)
                self.distro, self.distro_version = DISTRO_UNKNOWN, '0.0'
            else:
                if name.find("redhatenterprise") > -1:
                    name="rhel"
.
.
.
The bottom line is that is_auto_installer_support() must return false:
Code:
def is_auto_installer_support(self, distro_version = DISTRO_VER_UNKNOWN):
        if not self.distro_name:
            self.get_distro()
            self.distro_name = self.distros_index[self.distro]

        if distro_version == DISTRO_VER_UNKNOWN:
            distro_version = self.distro_version

        if self.distro != DISTRO_UNKNOWN and distro_version != DISTRO_VER_UNKNOWN and self.get_ver_data('supported
', False,distro_version):
            log.debug("Auto installation is supported for Distro =%s version =%s "%(self.distro_name, distro_versi
on))
            return True
        else:
            log.debug("Auto installation is not supported for Distro =%s version =%s "%(self.distro_name, distro_v
ersion))
            return False
So the question is, what value can Slackware users derive from having hplip accessory programs other than hp-update being able to identify the distro name? If anyone can think of some benefit, here's my patch:

Code:
--- hplip-3.13.2/base/password.py.orig  2013-02-28 09:30:57.442134662 +0200
+++ hplip-3.13.2/base/password.py       2013-02-28 10:48:43.636353992 +0200
@@ -67,6 +67,14 @@
        name = os.popen("cat /etc/issue | awk '{print $1}' | head -n 1")
        os_name = name.read().strip()
        name.close()
+    try:
+       with open('/etc/os-release') as f: pass
+       name = os.popen("grep -w ID /etc/os-release | awk -F= '{print $2}'")
+       os_name = name.read().strip()
+       log.info(("Distro was identified as %s\n") %os_name)
+       name.close()
+    except IOError as e:
+       log.error("Could not access file named /etc/os-release\n")
 
     if "redhatenterprise" in os_name.lower():
         os_name = 'rhel'
P.S. You don't have to rebuild the hplip package, you can just edit /usr/share/hplip/base/passwd.py with the relevant changes if you like.

Last edited by fskmh; 02-28-2013 at 03:32 AM.
 
1 members found this post helpful.
Old 02-28-2013, 04:36 AM   #7
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Original Poster
Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Thanks for that. Yes, your patch fixes the OS detection, but hplip still makes a couple of unwanted outbound connections to hp.com and sourceforge.

Here's my patch

Code:
--- upgrade.py.orig     2013-02-28 10:23:19.062450195 +0000
+++ upgrade.py  2013-02-28 10:27:38.242010423 +0000
@@ -214,9 +214,8 @@
 try:
     change_spinner_state(False)
     core =  CoreInstall(MODE_CHECK)
-    if not utils.check_network_connection():
-        log.error("Either Internet is not working or Wget is not installed.")
-        clean_exit(0)
+    log.info("Upgrades?  We don't want no stinkin' upgrades!")
+    clean_exit(0)
 
     installed_version=sys_conf.get("hplip","version","0.0.0")
     log.debug("HPLIP previous installed version =%s." %installed_version)
 
2 members found this post helpful.
Old 07-17-2013, 02:55 PM   #8
Nh3xus
Member
 
Registered: Jan 2013
Location: France
Distribution: Slackware 14.1 32 bits
Posts: 211

Rep: Reputation: 57
Bumping this thread for a fix.

There's an even easier fix to this :

You just have to modify this line in the passwd.py :

'slackware':'su',

and change it to this :

'slackware':'su -',

This did the trick on my -current 32 bits Slackware box.

Hope it helps
 
Old 07-17-2013, 04:01 PM   #9
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,504

Rep: Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461
What kind of fix are you looking for? A similar patch to the one above was already applied to -current to disable hp-upgrade on Slackware. Actually making the feature work seems like a bad idea to me.
 
1 members found this post helpful.
Old 07-17-2013, 04:33 PM   #10
Nh3xus
Member
 
Registered: Jan 2013
Location: France
Distribution: Slackware 14.1 32 bits
Posts: 211

Rep: Reputation: 57
Hi Pat,

I was just trying to get my HP Printer to work with my Slackware -Current 32 bits install and a search engine gave me this thread.

My model is supported by hplip.

I was having the same warning as the author about the distro detection not being correctly detected.

The printer was recognized but I had an error saying 'Communication error with the device' making the scanner function not available in Xsane.

After applying my fix, I ran hp-setup again to install my printer the right way.

My post should be concidered as a FYI, nothing more
 
Old 07-17-2013, 07:00 PM   #11
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,971

Rep: Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548
Making it work definitely seems like a bad idea to me.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unwelcome tredegar Linux - Security 1 05-25-2011 12:21 AM
[SOLVED] Can/Should I upgrade to Current? linus72 Slackware 7 03-10-2010 06:40 AM
Upgrade from 12.0 to -current Yalla-One Slackware 2 06-13-2009 06:30 AM
DISCUSSION: Upgrade to Slackware -current without a -current CD truthfatal LinuxAnswers Discussion 0 09-19-2006 01:42 PM
What first upgrade kernel or upgrade slack 10.0 to current Kelean Slackware 7 01-16-2005 06:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration