Bug 218977 - sysutils/py-glances: Failed to start after update
Summary: sysutils/py-glances: Failed to start after update
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-30 15:14 UTC by iron.udjin
Modified: 2018-02-08 20:48 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (gasol.wu)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description iron.udjin 2017-04-30 15:14:23 UTC
Hello,

System: 11.0-STABLE r317528
After update from py27-glances-2.8.1 to py27-glances-2.8.8:

# glances 
Traceback (most recent call last):
  File "/usr/local/bin/glances", line 11, in <module>
    load_entry_point('Glances==2.8.8', 'console_scripts', 'glances')()
  File "/usr/local/lib/python2.7/site-packages/glances/__init__.py", line 225, in main
    start_standalone(config=config, args=args)
  File "/usr/local/lib/python2.7/site-packages/glances/__init__.py", line 105, in start_standalone
    standalone = GlancesStandalone(config=config, args=args)
  File "/usr/local/lib/python2.7/site-packages/glances/standalone.py", line 43, in __init__
    self.stats = GlancesStats(config=config, args=args)
  File "/usr/local/lib/python2.7/site-packages/glances/stats.py", line 43, in __init__
    self.load_modules(self.args)
  File "/usr/local/lib/python2.7/site-packages/glances/stats.py", line 77, in load_modules
    self.load_plugins(args=args)
  File "/usr/local/lib/python2.7/site-packages/glances/stats.py", line 96, in load_plugins
    plugin = __import__(os.path.basename(item)[:-3])
  File "/usr/local/lib/python2.7/site-packages/glances/plugins/glances_batpercent.py", line 38, in <module>
    psutil.sensors_battery()
  File "/usr/local/lib/python2.7/site-packages/psutil/__init__.py", line 2263, in sensors_battery
    return _psplatform.sensors_battery()
  File "/usr/local/lib/python2.7/site-packages/psutil/_psbsd.py", line 411, in sensors_battery
    percent, minsleft, power_plugged = cext.sensors_battery()
OSError: [Errno 2] No such file or directory

I've tested update on several servers. Result is the same.
Comment 1 Gasol Wu 2017-05-04 03:25:36 UTC
I can't reproduce this problem, Which version of psutil do you have?

This is mine

> $ glances --version
Glances v2.8.8 with psutil v5.0.1
Comment 2 Walter Schwarzenfeld 2017-05-04 04:58:21 UTC
Same error. Seem glances does not recognize if no battery sensor is there.
Comment 3 Walter Schwarzenfeld 2017-05-04 05:53:18 UTC
I am tried 2.9.1. It provides a correct ErrorMessage and does not segfault.
Comment 4 iron.udjin 2017-05-04 05:56:54 UTC
(In reply to Gasol Wu from comment #1)
> Which version of psutil do you have?

I use glances with recent version of psutil from ports: 5.2.2
Comment 5 Walter Schwarzenfeld 2017-05-04 06:26:09 UTC
(Segfault was wrong).

2.9.1 states:
Error while initializing the batpercent plugin ([Errno 2] No such file or directory)
Error while initializing the sensors plugin ([Errno 2] No such file or directory)

and starts normal and as expected.
Comment 6 Gasol Wu 2017-05-07 13:19:40 UTC
https://github.com/nicolargo/glances/issues/1051

Seems like this issue, fixed in 2.9.1. I will submit update PR soon.
Comment 7 Gasol Wu 2017-05-08 03:49:09 UTC
here is patch for 2.9.1

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219129
Comment 8 iron.udjin 2017-05-08 04:56:29 UTC
(In reply to Gasol Wu from comment #7)

I just tested 2.9.1. It starts and works fine. But it says at start:

Error while initializing the sensors plugin ([Errno 2] No such file or directory)
Error while initializing the batpercent plugin ([Errno 2] No such file or directory
Comment 9 Walter Schwarzenfeld 2017-05-08 08:14:19 UTC
work/glances-2.9.1/glances/plugins/glances_sensors.py:

234         except OSError as e:
    235             # FreeBSD: If oid 'hw.acpi.battery' not present, Glances wont start #1055
    236             logger.error("Can not grab temperatures sensors ({})".format(e))
Comment 10 Gasol Wu 2017-05-09 01:55:47 UTC
What output generate by command `cat /tmp/glances-${USER}.log`?
Comment 11 iron.udjin 2017-05-09 13:19:10 UTC
(In reply to Gasol Wu from comment #10)

2017-05-08 08:07:12,404 -- INFO -- Start Glances 2.9.1
2017-05-08 08:07:12,404 -- INFO -- CPython 2.7.13 and PSutil 5.2.2 detected
2017-05-08 08:07:12,416 -- INFO -- Start GlancesStandalone mode
2017-05-08 08:07:12,420 -- CRITICAL -- Error while initializing the sensors plugin ([Errno 2] No such file or directory)
2017-05-08 08:07:12,421 -- ERROR -- Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/glances/stats.py", line 100, in _load_plugin
    plugin = __import__(plugin_script[:-3])
  File "/usr/local/lib/python2.7/site-packages/glances/plugins/glances_sensors.py", line 26, in <module>
    from glances.plugins.glances_batpercent import Plugin as BatPercentPlugin
  File "/usr/local/lib/python2.7/site-packages/glances/plugins/glances_batpercent.py", line 38, in <module>
    psutil.sensors_battery()
  File "/usr/local/lib/python2.7/site-packages/psutil/__init__.py", line 2263, in sensors_battery
    return _psplatform.sensors_battery()
  File "/usr/local/lib/python2.7/site-packages/psutil/_psbsd.py", line 411, in sensors_battery
    percent, minsleft, power_plugged = cext.sensors_battery()
OSError: [Errno 2] No such file or directory

2017-05-08 08:07:12,421 -- CRITICAL -- Error while initializing the batpercent plugin ([Errno 2] No such file or directory)
2017-05-08 08:07:12,421 -- ERROR -- Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/glances/stats.py", line 100, in _load_plugin
    plugin = __import__(plugin_script[:-3])
  File "/usr/local/lib/python2.7/site-packages/glances/plugins/glances_batpercent.py", line 38, in <module>
    psutil.sensors_battery()
  File "/usr/local/lib/python2.7/site-packages/psutil/__init__.py", line 2263, in sensors_battery
    return _psplatform.sensors_battery()
  File "/usr/local/lib/python2.7/site-packages/psutil/_psbsd.py", line 411, in sensors_battery
    percent, minsleft, power_plugged = cext.sensors_battery()
OSError: [Errno 2] No such file or directory

2017-05-08 08:07:57,029 -- INFO -- Stop Glances
Comment 12 Gasol Wu 2017-05-10 04:51:34 UTC
Related changes: 
https://github.com/giampaolo/psutil/compare/release-5.0.0...release-5.2.2#diff-dabf94c696c08b27cf46a08fdff4adf2R1004

Related issues: https://github.com/giampaolo/psutil/issues/966

It seems like plugins sensors_battery is not support on your system.

With glances 2.9.1, It will start normally but generate some warnings like this, It should be ok.
Comment 13 Danilo G. Baio freebsd_committer freebsd_triage 2017-09-23 15:31:04 UTC
Is this PR still relevant?

Current version 2.11.1 --> ports r449629
Comment 14 Walter Schwarzenfeld 2017-09-23 19:19:14 UTC
Compiles fine on 10.3.
Comment 15 Walter Schwarzenfeld 2018-02-08 20:48:18 UTC
(In reply to Danilo G. Baio from comment #13)
No further feedback. So I close it as solved.
If there still problems, please reopen.