Screenlets/ Sysmonitor Screenlet

Questions about applications and software
Forum rules
Before you post please read this

Screenlets/ Sysmonitor Screenlet

Postby mmesantos1 on Thu Jul 30, 2009 9:24 pm

Hello,
I am running Linux Mint 7 x64 and ran sysmonitor screenlet and noticed instead of showing Ubuntu 9.04 it displayed Debian 5.0. I was wondering if something changed as far as what distro Linux Mint 7 x64 is based off of?
Last edited by mmesantos1 on Thu Jul 30, 2009 9:31 pm, edited 1 time in total.
Image
User avatar
mmesantos1
Level 8
Level 8
 
Posts: 2280
Joined: Tue Jan 29, 2008 9:14 pm
Location: VA. USA

Linux Mint is funded by ads and donations.
 

Re: Screenlets/ Sysmonitor Screenlet

Postby richyrich on Thu Jul 30, 2009 9:30 pm

Must be a bug somewhere. . as I have Mint 7 kde, and the SysMon Plasma widget tells me the same thing ???

Image
User avatar
richyrich
Level 13
Level 13
 
Posts: 4635
Joined: Mon May 04, 2009 8:31 pm

Re: Screenlets/ Sysmonitor Screenlet

Postby mmesantos1 on Thu Jul 30, 2009 9:33 pm

richyrich wrote:Must be a bug somewhere. . as I have Mint 7 kde, and the SysMon Plasma widget tells me the same thing ???

Image


You think a bug?
Image
User avatar
mmesantos1
Level 8
Level 8
 
Posts: 2280
Joined: Tue Jan 29, 2008 9:14 pm
Location: VA. USA

Re: Screenlets/ Sysmonitor Screenlet

Postby richyrich on Thu Jul 30, 2009 9:44 pm

Bug might be too harsh . . . but whatever the SysMonitor app looks for, is getting the wrong info.

I wonder . . I upgraded my kernel to 2.6.30 . . . wonder if that has anything to do with it . . I'll turn on my Gloria Main 32bit and check it out . . will post back.

Richy
Last edited by richyrich on Thu Jul 30, 2009 9:46 pm, edited 1 time in total.
User avatar
richyrich
Level 13
Level 13
 
Posts: 4635
Joined: Mon May 04, 2009 8:31 pm

Re: Screenlets/ Sysmonitor Screenlet

Postby mmesantos1 on Thu Jul 30, 2009 9:45 pm

richyrich wrote:Bug might be too harsh . . . but whatever the SysMonitor app looks for, is getting the wrong info.



I see, Thanks for the info richyrich. :)
Image
User avatar
mmesantos1
Level 8
Level 8
 
Posts: 2280
Joined: Tue Jan 29, 2008 9:14 pm
Location: VA. USA

Re: Screenlets/ Sysmonitor Screenlet

Postby richyrich on Thu Jul 30, 2009 9:50 pm

Checked Gloria Main 32, and it says Debian 5.0 too . . . . ?
User avatar
richyrich
Level 13
Level 13
 
Posts: 4635
Joined: Mon May 04, 2009 8:31 pm

Re: Screenlets/ Sysmonitor Screenlet

Postby mmesantos1 on Thu Jul 30, 2009 10:25 pm

richyrich wrote:Checked Gloria Main 32, and it says Debian 5.0 too . . . . ?



Hmm, I wonder if someone could shed more light on this? :?:
Image
User avatar
mmesantos1
Level 8
Level 8
 
Posts: 2280
Joined: Tue Jan 29, 2008 9:14 pm
Location: VA. USA

Re: Screenlets/ Sysmonitor Screenlet

Postby pneumapilot on Wed Sep 23, 2009 5:23 pm

It seems that the code for the sensor object (which is a part of the screenlets object) is searching for a certain text file in the /etc/ folder. Many distros have a file called "X-release" where X is the name of the distro, like fedora-release, for example. In Ubuntu and Linux Mint, this file is lsb-release. Apparently, the sysmontor screenlet is either not set up to look for something beginning with 'lsb' or it is not set up to properly interpret the contents of that file. So, instead, it finds the file called 'Debian' in /etc/ and reads its contents, which is simply "5.0".

This is what I have been able to gather today anyway. I'm still looking for a way to solve the problem. If I could find where the screenlets.sensor object is stored locally, I might could tweak it to read the 'lsb-release' file.
"Resolution 1: I will live for God. Resolution 2: If no one else does, I still will."
- Jonathan Edwards
User avatar
pneumapilot
Level 1
Level 1
 
Posts: 5
Joined: Mon Sep 14, 2009 3:20 pm

Re: Screenlets/ Sysmonitor Screenlet

Postby vrkalak on Wed Sep 23, 2009 5:36 pm

I recently upgraded my Linux kernel to 2.6.31-10 generic . . . and it says Ubuntu 9.10
Even my Conky says that. Actually the Conky says: Ubuntu 9.10 (development)

Weird . . . ?? :?
Image
:: LinuxMint-Debian-Edition (Fluxbox) :: Manjaro/Arch (Xfce) ::
Registered Linux User: #497031 :: DeviantART Page
User avatar
vrkalak
Level 10
Level 10
 
Posts: 3292
Joined: Mon Jul 20, 2009 5:53 pm
Location: Santa Fe, NM, USA

Re: Screenlets/ Sysmonitor Screenlet

Postby DrHu on Wed Sep 23, 2009 5:46 pm

mmesantos1 wrote:I am running Linux Mint 7 x64 and ran sysmonitor screenlet and noticed instead of showing Ubuntu 9.04 it displayed Debian 5.0. I was wondering if something changed as far as what distro Linux Mint 7 x64 is based off of?

...noticed instead of showing Ubuntu 9.04 it displayed Debian 5.0...
OK, it shows the wrong parent name for a Ubuntu based release (Ubuntu 9.04 (jaunty) or Linux mint 7(gloria)), so what!..

It, if it can even be called a bug; it is nothing to worry about, nor waste any development resources correcting: the name for the applet (or screenlet if you will).
User avatar
DrHu
Level 16
Level 16
 
Posts: 6714
Joined: Wed Jun 17, 2009 8:20 pm

Re: Screenlets/ Sysmonitor Screenlet

Postby pneumapilot on Wed Sep 23, 2009 5:56 pm

Aha! Here is the code in /usr/share/pyshared/screenlets/sensors.py that is the culprit:

Code: Select all
def sys_get_distrib_name():
   try:
      if os.path.exists('/etc/lsb-release') and str(commands.getoutput('cat /etc/lsb-release')).lower().find('ubuntu') != -1:
         return str(commands.getoutput('cat /etc/issue')).replace('\\n','').replace('\l','').replace('\r','').strip()

      elif os.path.exists('/etc/lsb-release'):
         return 'Debian ' + str(commands.getoutput('cat /etc/debian_version'))
      elif os.path.exists('/etc/mandriva-release'):
         return 'Mandriva ' + str(commands.getoutput("cat /etc/mandriva-release | sed -e 's/[A-Za-z ]* release //'"))
      elif os.path.exists('/etc/fedora-release'):
         return 'Fedora ' + str(commands.getoutput("cat /etc/fedora-release | sed -e 's/[A-Za-z ]* release //'"))
      elif os.path.exists('/etc/SuSE-release'):

         if str(commands.getoutput('cat /etc/SuSE-release')).lower().find('openSUSE') != -1:
            return 'openSUSE ' + str(commands.getoutput("""cat /etc/SuSE-release | grep "VERSION" | sed -e 's/VERSION = //'"""))
         else:
            return 'SUSE ' + str(commands.getoutput("""cat /etc/SuSE-release | grep "VERSION" | sed -e 's/VERSION = //'"""))
      elif os.path.exists('/etc/gentoo-release'):
         return 'Gentoo ' + str(commands.getoutput("cat /etc/gentoo-release | sed -e 's/[A-Za-z ]* release //'"))
      elif os.path.exists('/etc/slackware-version'):
         return 'Slackware ' + str(commands.getoutput("cat /etc/slackware-version | sed -e 's/Slackware //'"))
      elif os.path.exists('/etc/arch-release'):
         return 'Arch Linux'
      elif os.path.exists('/etc/redhat-release'):
         return 'Redhat ' + str(commands.getoutput("cat /etc/redhat-release | sed -e 's/[A-Za-z ]* release //'"))
      else:
         f = open("/etc/issue", "r")
         tmp = f.readlines(100)
         f.close()
         return tmp[0].replace('\\n','').replace('\l','').replace('\r','').strip()
   except:
      print _("Error getting distro name")
   return 'Error'


You can see how a distro that uses the lsb-release file will either return 'Ubuntu' or 'Debian', there is no accounting for Mint. Now, I can change this on my machine, but it really needs to be something that is submitted to whoever manages the screenlets code.

Here's how I would change it:

Add this line immediately after the check for ubuntu
Code: Select all
elif os.path.exists('/etc/lsb-release') and str(commands.getoutput('cat /etc/lsb-release')).lower().find('linuxmint') != -1:
         return str(commands.getoutput('cat /etc/issue')).replace('- Main Edition','').replace('\\n','').replace('\l','').replace('\r','').strip()


I had to also remove the text "- Main Edition" because it made the name of the distro too long to be properly displayed. See the attachment for the results on my system.
Screenshot.jpg
Screenshot.jpg (35.88 KiB) Viewed 1406 times
"Resolution 1: I will live for God. Resolution 2: If no one else does, I still will."
- Jonathan Edwards
User avatar
pneumapilot
Level 1
Level 1
 
Posts: 5
Joined: Mon Sep 14, 2009 3:20 pm

Re: Screenlets/ Sysmonitor Screenlet

Postby optimize me on Wed Sep 23, 2009 7:40 pm

I don't think it's the lsb_release info. Here's a screen shot of my conky proudly displaying Mint 7 Gloria and the line that fetches the info:
Code: Select all
${pre_exec lsb_release -d | cut -c14-32}

Screenshot.png
Screenshot.png (45.25 KiB) Viewed 1400 times


And yet, you've done what you've done and it worked.

I am not knowing.
AMD Phenom II X6 1045T 2.8GHz 8GB DDR3 RAM ATI Radeon HD6970
User avatar
optimize me
Level 5
Level 5
 
Posts: 639
Joined: Wed Jun 03, 2009 5:25 pm

Re: Screenlets/ Sysmonitor Screenlet

Postby pneumapilot on Wed Sep 23, 2009 10:07 pm

But it's not the exact same thing as conky, right?
"Resolution 1: I will live for God. Resolution 2: If no one else does, I still will."
- Jonathan Edwards
User avatar
pneumapilot
Level 1
Level 1
 
Posts: 5
Joined: Mon Sep 14, 2009 3:20 pm

Re: Screenlets/ Sysmonitor Screenlet

Postby optimize me on Thu Sep 24, 2009 4:25 am

True enough.

I don't know - it was late and I was having trouble sleeping when I wrote that. It seems to make more sense to me now.

So, OK - carry on.
AMD Phenom II X6 1045T 2.8GHz 8GB DDR3 RAM ATI Radeon HD6970
User avatar
optimize me
Level 5
Level 5
 
Posts: 639
Joined: Wed Jun 03, 2009 5:25 pm

Linux Mint is funded by ads and donations.
 

Return to Software & Applications

Who is online

Users browsing this forum: iru and 15 guests