glances icon indicating copy to clipboard operation
glances copied to clipboard

Glances Web UI shows a blank page on Ubuntu 22.04

Open korikori opened this issue 3 years ago • 36 comments

Describe the bug After upgrading to Ubuntu 22.04 (testing), Glances Web UI shows a blank page.

To Reproduce Steps to reproduce the behavior:

  1. On Ubuntu 22.04, start Glances with either -s or -w;
  2. Open Glances URL with any browser;
  3. See blank page - HTML source:
<!DOCTYPE html>
<html ng-app="[glancesApp]()">

<head>
    <meta http-equiv="[Content-Type]()" content="[text/html; charset=utf-8]()" />
    <meta name="[viewport]()" content="[width=device-width, initial-scale=1.0]()" />
    <[title]() ng-bind="title">Glances</title>

    <link rel="[icon]()" type="[image/x-icon]()" href="[favicon.ico](view-source:https://monitor.tulibu-dibu.com/favicon.ico)" />
    <script type="[text/javascript]()" src="[glances.js](view-source:https://monitor.tulibu-dibu.com/glances.js)"></script>
</head>

<body>
  <glances refresh-time="[8]()"></glances>
</body>
</html>

Expected behavior Glances Web UI should appear.

Desktop (please complete the following information):

  • OS: GNU/Linux Ubuntu Server 22.04
  • Glances Version: Glances v3.2.4.2 with PsUtil v5.9.0
  • Glances logs file
2022-03-22 17:47:54,595 -- INFO -- Start Glances 3.2.4.2
2022-03-22 17:47:54,595 -- INFO -- CPython 3.10.3 (/usr/bin/python3) and psutil 5.9.0 detected
2022-03-22 17:47:54,602 -- INFO -- Read configuration file '/home/kori/.config/glances/glances.conf'
2022-03-22 17:47:54,623 -- INFO -- Start GlancesStandalone mode
2022-03-22 17:47:54,720 -- WARNING -- Missing Python Lib (No module named 'py3nvml'), Nvidia GPU plugin is disabled
2022-03-22 17:47:55,170 -- WARNING -- Sparklines module not found (No module named 'sparklines')
2022-03-22 17:47:55,176 -- WARNING -- Missing Python Lib (No module named 'wifi'), Wifi plugin is disabled
2022-03-22 17:47:55,176 -- WARNING -- Wifi lib is not compliant with Python 3, Wifi plugin is disabled
2022-03-22 17:47:59,782 -- INFO -- Glances stopped (keypressed: CTRL-C)
  • Glances test
=====================================================================================================================================================================================================================
Glances 3.2.4.2 (/usr/lib/python3/dist-packages/glances/__init__.py)
Python 3.10.3 (/usr/bin/python3)
PsUtil 5.9.0 (/usr/lib/python3/dist-packages/psutil/__init__.py)
=====================================================================================================================================================================================================================
alert         [OK]    0.00003s []
amps          [OK]    0.00002s []
cloud         [OK]    0.00002s {}
connections   [OK]    0.00002s {'LISTEN': 21, 'ESTABLISHED': 2, 'SYN_SENT': 1, 'SYN_RECV': 0, 'initiated': 1, 'terminated': 1, 'nf_conntrack_count': 35.0, 'nf_conntrack_max': 262144.0, 'nf_conntrack_perc
core          [OK]    0.00098s {'phys': 2, 'log': 4}
cpu           [OK]    0.00002s {'total': 32.0, 'user': 22.3, 'nice': 0.0, 'system': 5.7, 'idle': 56.3, 'iowait': 12.2, 'irq': 0.0, 'softirq': 3.4, 'steal': 0.0, 'guest': 0.0, 'guest_nice': 0.0, 'time_sin
diskio        [OK]    0.00002s key=disk_name [{'time_since_update': 1, 'disk_name': 'sda', 'read_count': 0, 'write_count': 0, 'read_bytes': 0, 'write_bytes': 0, 'key': 'disk_name'}, {'time_since_update':
docker        [OK]    0.00056s key=name [{'key': 'name', 'name': 'photoprism_photoprism_1', 'Names': ['photoprism_photoprism_1'], 'Id': '1d56de849268c568f33f3fbf872327aaf121e2820d9983e6fce1c3404e747b2e',
folders       [OK]    0.00002s []
fs            [OK]    0.00002s key=mnt_point [{'device_name': '/dev/sda2', 'fs_type': 'ext4', 'mnt_point': '/', 'size': 104522190848, 'used': 31397896192, 'free': 68317548544, 'percent': 31.5, 'key': 'mn
gpu           [OK]    0.00002s []
help          [OK]    0.00001s None
ip            [OK]    0.00002s {'address': '192.168.1.104', 'mask': '255.255.255.0', 'mask_cidr': 24, 'gateway': '192.168.1.1', 'public_address': '77.76.45.72'}
irq           [OK]    0.00002s key=irq_line [{'irq_line': '0_timer', 'irq_rate': 0, 'key': 'irq_line', 'time_since_update': 1}, {'irq_line': '1_i8042', 'irq_rate': 0, 'key': 'irq_line', 'time_since_updat
load          [OK]    0.00002s {'min1': 0.09033203125, 'min5': 0.09375, 'min15': 0.1103515625, 'cpucore': 4}
mem           [OK]    0.00002s {'total': 7224696832, 'available': 5893705728, 'percent': 18.4, 'used': 1330991104, 'free': 5893705728, 'active': 901234688, 'inactive': 3381723136, 'buffers': 196071424, '
memswap       [OK]    0.00002s {'total': 12659453952, 'used': 0, 'free': 12659453952, 'percent': 0.0, 'sin': 0, 'sout': 0, 'time_since_update': 1}
network       [OK]    0.00268s key=interface_name [{'interface_name': 'eno1', 'alias': None, 'time_since_update': 3.009073257446289, 'cumulative_rx': 49874710, 'rx': 9371, 'cumulative_tx': 26204753, 'tx'
now           [OK]    0.00003s 2022-03-22 17:59:19 EET
percpu        [OK]    0.00002s key=cpu_number [{'key': 'cpu_number', 'cpu_number': 0, 'total': 74.4, 'user': 14.9, 'system': 5.0, 'idle': 25.6, 'nice': 0.0, 'iowait': 50.4, 'irq': 0.0, 'softirq': 4.1, 's
ports         [OK]    0.00002s [{'host': '', 'port': 0, 'description': '--services--', 'status': 0.002471, 'refresh': 30, 'timeout': 10, 'rtt_warning': None, 'indice': 'port_1'}, {'host': '192.168.1.1', 
processcount  [OK]    0.00002s {'total': 196, 'running': 1, 'sleeping': 117, 'thread': 458, 'pid_max': 0}
processlist   [OK]    0.00005s key=pid [{'name': 'mysqld', 'io_counters': [0, 0, 0, 0, 0], 'memory_info': pmem(rss=279273472, vms=1779277824, shared=23605248, text=10174464, lib=0, data=574152704, dirty=
psutilversion [OK]    0.00002s (5, 9, 0)
quicklook     [OK]    0.00002s {'cpu': 32.0, 'percpu': [{'key': 'cpu_number', 'cpu_number': 0, 'total': 74.4, 'user': 14.9, 'system': 5.0, 'idle': 25.6, 'nice': 0.0, 'iowait': 50.4, 'irq': 0.0, 'softirq'
raid          [OK]    0.00002s {'md0': {'status': 'active', 'type': 'raid1', 'components': {'sdb1': '0', 'sdc1': '1'}, 'available': '2', 'used': '2', 'config': 'UU'}}
sensors       [OK]    0.00005s key=label [{'label': 'radeon 1', 'value': 14, 'warning': 120, 'critical': 120, 'unit': 'C', 'type': 'temperature_core', 'key': 'label'}, {'label': 'k10temp 1', 'value': 11,
smart         [N/A]
system        [OK]    0.00002s {'os_name': 'Linux', 'hostname': 'hp', 'platform': '64bit', 'linux_distro': 'Ubuntu 22.04', 'os_version': '5.15.0-23-generic', 'hr_name': 'Ubuntu 22.04 64bit'}
uptime        [OK]    0.00002s {'seconds': 52830}
wifi          [OK]    0.00004s []

korikori avatar Mar 22 '22 17:03 korikori

Is it working in terminal mode ?

nicolargo avatar Mar 24 '22 17:03 nicolargo

Yes, it works as expected in terminal mode.

korikori avatar Mar 24 '22 17:03 korikori

Try to clean your web browser cache and restart Glances.

nicolargo avatar Mar 26 '22 16:03 nicolargo

I noticed that glances.js returns a 404 error, and traced this to a noticeable difference in installed size between the packages for Ubuntu 21.10 and 22.04 - the filelist for the latter does not include the /glances/outputs/static/public directory at all. Copying the public directory and its contents from the older package resolves the problem.

I guess a build step was omitted. I have since reported this issue to the Ubuntu package maintainers as well.

korikori avatar Mar 27 '22 20:03 korikori

Hello!

I think this is related with this bug1. In Debian, we had removed a some prebuilt js files.

epsilon77 avatar Apr 17 '22 02:04 epsilon77

Hi @epsilon77, yes, this bug report is related - as one developer has stated in the conversation there:

This makes the remote web interface probably useless, but the package can still be used for most usages (I guess, in standalone mode for example, which is the only mode I use).

I just checked the current version of the package in Debian, and it appears to be identical to the Ubuntu package (lacks the pre-built JS), so this problem would affect all Debian users as well.

korikori avatar Apr 18 '22 17:04 korikori

Hi @epsilon77, yes, this bug report is related - as one developer has stated in the conversation there:

This makes the remote web interface probably useless, but the package can still be used for most usages (I guess, in standalone mode for example, which is the only mode I use).

I just checked the current version of the package in Debian, and it appears to be identical to the Ubuntu package (lacks the pre-built JS), so this problem would affect all Debian users as well.

Hello! I am maintainer of glances in Debian, for Debian policy, the packages should not include prebult files, for this reason, we had to remove those js files from debian package. and this change does WEB-UI useless.

epsilon77 avatar Apr 24 '22 15:04 epsilon77

Hi @epsilon77, yes, this bug report is related - as one developer has stated in the conversation there:

This makes the remote web interface probably useless, but the package can still be used for most usages (I guess, in standalone mode for example, which is the only mode I use).

I just checked the current version of the package in Debian, and it appears to be identical to the Ubuntu package (lacks the pre-built JS), so this problem would affect all Debian users as well.

Hello! I am maintainer of glances in Debian, for Debian policy, the packages should not include prebult files, for this reason, we had to remove those js files from debian package. and this change does WEB-UI useless.

So, how do we fix this? Should we install the JS files ourselves? Thanks.

mptpro avatar May 05 '22 05:05 mptpro

@mptpro that's what I did (took the files from this release), or alternatively, instead of using Ubuntu/Debian packages, you can use the PyPI installation method.

korikori avatar May 05 '22 11:05 korikori

@mptpro that's what I did (took the files from this release)

how did you do that? where do you put the files?

Thanks in advance

gregfr avatar Jun 17 '22 09:06 gregfr

Hello! I am maintainer of glances in Debian, for Debian policy, the packages should not include prebult files, for this reason, we had to remove those js files from debian package. and this change does WEB-UI useless.

Maybe it would be a good idea to mention that in the console (and even better in the web page) when glances starts in web mode, and preferably add a way (a link to a wiki?) for the user to fix the problem, instead of giving the impression that everything is fine despite the 404 error and the blank page...

gregfr avatar Jun 17 '22 09:06 gregfr

I noticed that glances.js returns a 404 error, and traced this to a noticeable difference in installed size between the packages for Ubuntu 21.10 and 22.04 - the filelist for the latter does not include the /glances/outputs/static/public directory at all. Copying the public directory and its contents from the older package resolves the problem.

I guess a build step was omitted. I have since reported this issue to the Ubuntu package maintainers as well.

How do I copy the public directory and its contents from the older package? New to Linux here.

mpadvisory avatar Jul 18 '22 12:07 mpadvisory

@gregfr @mpadvisory: (assuming Ubuntu)

  1. Download the 21.10 package from http://archive.ubuntu.com/ubuntu/pool/universe/g/glances/glances_3.1.5.orig.tar.gz and extract it with tar -xzf glances_3.1.5.orig.tar.gz;
  2. Copy the public subdirectory from the extracted archive (you will likely need sudo for that): cp -r glances-3.1.5/glances/outputs/static/public/ /usr/lib/python3/dist-packages/glances/outputs/static/

You don't have to restart any services, just refresh your Glances view in the browser and it should work now.

korikori avatar Jul 18 '22 12:07 korikori

@gregfr @mpadvisory: (assuming Ubuntu)

  1. Download the 21.10 package from http://archive.ubuntu.com/ubuntu/pool/universe/g/glances/glances_3.1.5.orig.tar.gz and extract it with tar -xzf glances_3.1.5.orig.tar.gz;
  2. Copy the public subdirectory from the extracted archive (you will likely need sudo for that): cp -r glances-3.1.5/glances/outputs/static/public/ /usr/lib/python3/dist-packages/glances/outputs/static/

You don't have to restart any services, just refresh your Glances view in the browser and it should work now.

This fixed it! Thank you korikori!

mpadvisory avatar Jul 18 '22 12:07 mpadvisory

@gregfr @mpadvisory: (assuming Ubuntu)

  1. Download the 21.10 package from http://archive.ubuntu.com/ubuntu/pool/universe/g/glances/glances_3.1.5.orig.tar.gz and extract it with tar -xzf glances_3.1.5.orig.tar.gz;
  2. Copy the public subdirectory from the extracted archive (you will likely need sudo for that): cp -r glances-3.1.5/glances/outputs/static/public/ /usr/lib/python3/dist-packages/glances/outputs/static/

You don't have to restart any services, just refresh your Glances view in the browser and it should work now.

Looks like this workaround is no longer working - http://archive.ubuntu.com/ubuntu/pool/universe/g/glances/glances_3.1.5.orig.tar.gz is no longer available or found. :(

mpadvisory avatar Jul 26 '22 13:07 mpadvisory

I guess Ubuntu delete packages quickly. You can still count on Debian to keep older stuff around:

  1. wget http://deb.debian.org/debian/pool/main/g/glances/glances_3.1.0.orig.tar.gz
  2. tar -xzf glances_3.1.0.orig.tar.gz
  3. cp -r glances-3.1.0/glances/outputs/static/public/ /usr/lib/python3/dist-packages/glances/outputs/static/

korikori avatar Jul 26 '22 17:07 korikori

Funnily enough, this results in a black page being displayed! Ah!

mpadvisory avatar Jul 26 '22 19:07 mpadvisory

I'm attaching an archive of the /usr/lib/python3/dist-packages/glances/outputs/static/public directory from my server: public.tar.gz Hopefully this works for you and anyone else with the same problem (for the current version of glances, anyway). The four files in this archive have to be extracted in /usr/lib/python3/dist-packages/glances/outputs/static/public (the public directory may have to be created manually).

korikori avatar Jul 27 '22 23:07 korikori

Hi all,

the Debian package issue for the Web UI is a pain in the arse... Sorry for that.

My advice is to use the Pypi installation procedure.

Nevertheless, if you can not do that, a cross version workaround will be to install Glances from the .deb repository:

sudo apt install glances

Get the Glances version:

glances -V
Glances v3.2.6.4 with PsUtil v5.9.0
Log file: /home/nicolargo/.local/share/glances/glances.log

As an example, we will download and install the missing files for the version 3.2.6.4 (please replace it by your version):

export GLANCES_VERSION="3.2.6.4"

Download the source:

wget https://github.com/nicolargo/glances/archive/refs/tags/v${GLANCES_VERSION}.tar.gz

Extract the source:

tar zxvf v${GLANCES_VERSION}.tar.gz

Copy the source to the system folder:

sudo cp -r glances-${GLANCES_VERSION}/glances/outputs/static/public/ /usr/lib/python3/dist-packages/glances/outputs/static/

Now your WebUI should work...

nicolargo avatar Jul 28 '22 08:07 nicolargo

Had this issue in clean install of Mint 21. nicolargo's workaround steps worked perfectly.

Went aheadested the pip method for Mint 21.
First uninstalled: $ sudo apt-get purge --auto-remove glances Then: pip install --user 'glances[action,browser,cloud,cpuinfo,docker,export,folders,gpu,graph,ip,raid,snmp,web,wifi]' Placed 'glances -w' in Startup Applications. Works fine.

So either method will fix this issue in Mint 21.

PoleCatRoad avatar Aug 05 '22 12:08 PoleCatRoad

@PoleCatRoad thanks for the help, can you please explain to me why the long --user ... parameter?

gregfr avatar Aug 15 '22 12:08 gregfr

I tried pipx run 'glances[action,browser,cloud,cpuinfo,docker,export,folders,gpu,graph,ip,raid,snmp,web,wifi]' -w, it works, but pipx run 'glances' -w gives:

⚠️  glances is already on your PATH and installed at /root/.local/bin/glances. Downloading and running anyway.
Bottle module not found. Glances cannot start in web server mode.

gregfr avatar Aug 15 '22 13:08 gregfr

@gregfr @mpadvisory: (assuming Ubuntu)

  1. Download the 21.10 package from http://archive.ubuntu.com/ubuntu/pool/universe/g/glances/glances_3.1.5.orig.tar.gz and extract it with tar -xzf glances_3.1.5.orig.tar.gz;
  2. Copy the public subdirectory from the extracted archive (you will likely need sudo for that): cp -r glances-3.1.5/glances/outputs/static/public/ /usr/lib/python3/dist-packages/glances/outputs/static/

You don't have to restart any services, just refresh your Glances view in the browser and it should work now.

this works, thanks!

MarshallBaby avatar Oct 31 '22 17:10 MarshallBaby

Hello, same issue on ubuntu 22.04, installed glances-3.3.0.2 from pip. Running python 3.10.6. It was working previously but only broke after I did update via pip. Now I reinstall it still black screen. 3.2.7 is the last working version. Anything newer will black screen.

edit: accessing the .js gives the actual js not a 404 like the original issue.

aliencaocao avatar Nov 01 '22 10:11 aliencaocao

The installation is still broken under Ubuntu 22.04. Had to go through those hoops to get the web interface working: wget https://github.com/nicolargo/glances/archive/refs/tags/v3.2.7.tar.gz

tar -xzf v3.2.7.tar.gz

sudo cp -r glances-3.2.7/glances/outputs/static/public/ /usr/lib/python3/dist-packages/glances/outputs/static/

Grandsome avatar Feb 04 '23 19:02 Grandsome

This is still present in Ubuntu 22.04.2 LTS using the official repo installation. Using what @Grandsome said made the web interface work again.

AleToledoCR avatar Jun 28 '23 16:06 AleToledoCR

At Debian 12.0 web interface is not working as well, just a white blank page.

vgomenyuk avatar Jun 30 '23 14:06 vgomenyuk

Debian 12 not working for me either. Terminal works as intended.

davidinfosec avatar Jul 17 '23 03:07 davidinfosec

It works like a charm! @Grandsome Thanks...

aaguillon avatar Aug 08 '23 21:08 aaguillon

Hi all,

the Debian package issue for the Web UI is a pain in the arse... Sorry for that.

My advice is to use the Pypi installation procedure.

Nevertheless, if you can not do that, a cross version workaround will be to install Glances from the .deb repository:

sudo apt install glances

Get the Glances version:

glances -V
Glances v3.2.6.4 with PsUtil v5.9.0
Log file: /home/nicolargo/.local/share/glances/glances.log

As an example, we will download and install the missing files for the version 3.2.6.4 (please replace it by your version):

export GLANCES_VERSION="3.2.6.4"

Download the source:

wget https://github.com/nicolargo/glances/archive/refs/tags/v${GLANCES_VERSION}.tar.gz

Extract the source:

tar zxvf v${GLANCES_VERSION}.tar.gz

Copy the source to the system folder:

sudo cp -r glances-${GLANCES_VERSION}/glances/outputs/static/public/ /usr/lib/python3/dist-packages/glances/outputs/static/

Now your WebUI should work...

Thank you very much!

spreadneck avatar Aug 30 '23 02:08 spreadneck

Galaxy brains from Debian broke so many packages removing js assets without noticing their authors and assistance, transmission is the same from stone age in 12 Debian because latest version uses prebuilt minified JS. They live in their bubble

evrial avatar Sep 26 '23 15:09 evrial