Glances Web UI shows a blank page on Ubuntu 22.04
Describe the bug After upgrading to Ubuntu 22.04 (testing), Glances Web UI shows a blank page.
To Reproduce Steps to reproduce the behavior:
- On Ubuntu 22.04, start Glances with either
-sor-w; - Open Glances URL with any browser;
- 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 []
Is it working in terminal mode ?
Yes, it works as expected in terminal mode.
Try to clean your web browser cache and restart Glances.
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.
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.
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.
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 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.
@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
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...
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.
@gregfr @mpadvisory: (assuming Ubuntu)
- 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; - 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.
@gregfr @mpadvisory: (assuming Ubuntu)
- 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;- 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!
@gregfr @mpadvisory: (assuming Ubuntu)
- 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;- 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. :(
I guess Ubuntu delete packages quickly. You can still count on Debian to keep older stuff around:
wget http://deb.debian.org/debian/pool/main/g/glances/glances_3.1.0.orig.tar.gztar -xzf glances_3.1.0.orig.tar.gzcp -r glances-3.1.0/glances/outputs/static/public/ /usr/lib/python3/dist-packages/glances/outputs/static/
Funnily enough, this results in a black page being displayed! Ah!
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).
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...
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 thanks for the help, can you please explain to me why the long --user ... parameter?
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 @mpadvisory: (assuming Ubuntu)
- 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;- 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!
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.
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/
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.
At Debian 12.0 web interface is not working as well, just a white blank page.
Debian 12 not working for me either. Terminal works as intended.
It works like a charm! @Grandsome Thanks...
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 glancesGet the Glances version:
glances -V Glances v3.2.6.4 with PsUtil v5.9.0 Log file: /home/nicolargo/.local/share/glances/glances.logAs 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.gzExtract 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!
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