Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart plugin error while start glances as root #1806

Closed
marcusboon opened this issue Feb 1, 2021 · 5 comments
Closed

Smart plugin error while start glances as root #1806

marcusboon opened this issue Feb 1, 2021 · 5 comments
Labels
Milestone

Comments

@marcusboon
Copy link

Describe the bug
Trying to start glances as root (not matter what mode, e.g. standalone or web) causes a crash and a python stack trace to be displayed

To Reproduce
Steps to reproduce the behavior:

  1. Start glances either as the root user directly or using sudo

Expected behaviour
Glances starts normally

Actual behaviour'
Glances crashes with this stack trace:

root@malachor:~# glances
Traceback (most recent call last):
  File "/usr/local/bin/glances", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/glances/__init__.py", line 145, in main
    start(config=config, args=args)
  File "/usr/local/lib/python3.8/dist-packages/glances/__init__.py", line 110, in start
    mode = GlancesMode(config=config, args=args)
  File "/usr/local/lib/python3.8/dist-packages/glances/standalone.py", line 78, in __init__
    self.stats.update()
  File "/usr/local/lib/python3.8/dist-packages/glances/stats.py", line 234, in update
    self._plugins[p].update()
  File "/usr/local/lib/python3.8/dist-packages/glances/plugins/glances_plugin.py", line 993, in wrapper
    ret = fct(self, *args, **kw)
  File "/usr/local/lib/python3.8/dist-packages/glances/plugins/glances_plugin.py", line 1003, in wrapper
    ret = fct(*args, **kw)
  File "/usr/local/lib/python3.8/dist-packages/glances/plugins/glances_smart.py", line 155, in update
    stats = get_smart_data()
  File "/usr/local/lib/python3.8/dist-packages/glances/plugins/glances_smart.py", line 98, in get_smart_data
    devlist = DeviceList()
  File "/usr/local/lib/python3.8/dist-packages/pySMART/device_list.py", line 56, in __init__
    self._initialize()
  File "/usr/local/lib/python3.8/dist-packages/pySMART/device_list.py", line 95, in _initialize
    cmd = Popen([SMARTCTL_PATH, '--scan-open'], stdout=PIPE, stderr=PIPE)
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1583, in _execute_child
    and os.path.dirname(executable)
  File "/usr/lib/python3.8/posixpath.py", line 152, in dirname
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Desktop (please complete the following information):

  • OS: Pop_OS! 20.04 (Ubuntu 20.04)

  • Glances Version

{ ~ }  » glances -V                                                                                                                                                                       ~  
Glances v3.1.6.1 with PsUtil v5.8.0
Log file: /home/marcus/.local/share/glances/glances.log
  • Glances logs file
{ ~ }  » tail -10 ~/.local/share/glances/glances.log                                                                                                                                      ~  
2021-02-01 11:08:11,188 -- INFO -- Search glances.conf file in /home/marcus/.config/glances/glances.conf
2021-02-01 11:08:11,188 -- INFO -- Search glances.conf file in /etc/glances/glances.conf
2021-02-01 11:08:11,189 -- INFO -- Read configuration file '/etc/glances/glances.conf'
2021-02-01 11:08:11,193 -- INFO -- Start GlancesStandalone mode
2021-02-01 11:08:11,293 -- WARNING -- Wifi lib is not compliant with Python 3, Wifi plugin is disabled
2021-02-01 11:08:40,470 -- INFO -- Stop Glances (keypressed: 113)
2021-02-01 12:38:28,003 -- INFO -- Start Glances 3.1.6.1
2021-02-01 12:38:28,003 -- INFO -- CPython 3.8.5 and psutil 5.8.0 detected
2021-02-01 12:38:52,303 -- INFO -- Start Glances 3.1.6.1
2021-02-01 12:38:52,303 -- INFO -- CPython 3.8.5 and psutil 5.8.0 detected

Additional context
Python is at version 3.8.5 for both my user and the root user (not using any fancy virtual env setup)

{ ~ }  » python --version                                                                                                                                                                 ~  
Python 3.8.5
{ ~ }  » sudo python --version                                                                                                                                                            ~  
Python 3.8.5
@nicolargo
Copy link
Owner

Hum...
Can you try to run Glances without the smart plugin (--disable-plugin smart)?

@marcusboon
Copy link
Author

Ok it works without the smart plugin. Weird.

@nicolargo
Copy link
Owner

I will have a look as soon as possible.

Thanks for the issue report!

@marcusboon
Copy link
Author

Cheers! Thanks for looking into it :)

@nicolargo nicolargo added the bug label Feb 6, 2021
@nicolargo nicolargo added this to the Glances 3.1.7 milestone Feb 6, 2021
@nicolargo nicolargo changed the title Can't start glances as root (affects systemd start) Smart plugin error while start glances as root Mar 5, 2021
@nicolargo
Copy link
Owner

Corrected (catched) in last commit on the DEVELOP branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants