Screenlets/ Sysmonitor Screenlet

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
mmesantos1

Screenlets/ Sysmonitor Screenlet

Post by mmesantos1 »

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 LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
richyrich

Re: Screenlets/ Sysmonitor Screenlet

Post by richyrich »

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

Image
mmesantos1

Re: Screenlets/ Sysmonitor Screenlet

Post by mmesantos1 »

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?
richyrich

Re: Screenlets/ Sysmonitor Screenlet

Post by richyrich »

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.
mmesantos1

Re: Screenlets/ Sysmonitor Screenlet

Post by mmesantos1 »

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. :)
richyrich

Re: Screenlets/ Sysmonitor Screenlet

Post by richyrich »

Checked Gloria Main 32, and it says Debian 5.0 too . . . . ?
mmesantos1

Re: Screenlets/ Sysmonitor Screenlet

Post by mmesantos1 »

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

Hmm, I wonder if someone could shed more light on this? :?:
pneumapilot

Re: Screenlets/ Sysmonitor Screenlet

Post by pneumapilot »

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.
vrkalak

Re: Screenlets/ Sysmonitor Screenlet

Post by vrkalak »

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 . . . ?? :?
DrHu

Re: Screenlets/ Sysmonitor Screenlet

Post by DrHu »

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).
pneumapilot

Re: Screenlets/ Sysmonitor Screenlet

Post by pneumapilot »

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
optimize me

Re: Screenlets/ Sysmonitor Screenlet

Post by optimize me »

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
And yet, you've done what you've done and it worked.

I am not knowing.
pneumapilot

Re: Screenlets/ Sysmonitor Screenlet

Post by pneumapilot »

But it's not the exact same thing as conky, right?
optimize me

Re: Screenlets/ Sysmonitor Screenlet

Post by optimize me »

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.
Locked

Return to “Software & Applications”