sebhildebrandt / systeminformation

System Information Library for Node.JS
MIT License
2.75k stars 311 forks source link

`fsSize` returns empty array on some devices #885

Open MauriceNino opened 10 months ago

MauriceNino commented 10 months ago

Describe the bug I am using systeminformation on my project inside a docker container, and some users (mostly Ubuntu 22-23) reported that fsSize returns an empty array.

To Reproduce Hard to reproduce, as I can't really do so with my system either. It is a common error though, so you can look into MauriceNino/dashdot/issues/944 or MauriceNino/dashdot/issues/1032.

Current Output

Output gathered by user @SecOps-7, who is one of the users encountering this problem.

docker exec Dashdot df -kPT

Filesystem           Type       1024-blocks    Used Available Capacity Mounted on
overlay              overlay    959786032  72771224 838186600   8% /
tmpfs                tmpfs          65536         0     65536   0% /dev
shm                  tmpfs          65536         0     65536   0% /dev/shm
/dev/nvme0n1p2       ext4       959786032  72771224 838186600   8% /mnt/host
udev                 devtmpfs    16160512         0  16160512   0% /mnt/host/dev
tmpfs                tmpfs       16198784         0  16198784   0% /mnt/host/dev/shm
tmpfs                tmpfs        3239760      6048   3233712   0% /mnt/host/run
tmpfs                tmpfs           5120         4      5116   0% /mnt/host/run/lock
tmpfs                tmpfs        3239760      6048   3233712   0% /mnt/host/run/snapd/ns
tmpfs                tmpfs        3239756       112   3239644   0% /mnt/host/run/user/1000
efivarfs             efivarfs         192       114        73  61% /mnt/host/sys/firmware/efi/efivars
/dev/loop0           squashfs         128       128         0 100% /mnt/host/snap/bare/5
/dev/loop1           squashfs        9856      9856         0 100% /mnt/host/snap/canonical-livepatch/246
/dev/loop2           squashfs        9600      9600         0 100% /mnt/host/snap/certbot-dns-cloudflare/3182
/dev/loop4           squashfs        9600      9600         0 100% /mnt/host/snap/certbot-dns-cloudflare/3077
/dev/loop3           squashfs      108416    108416         0 100% /mnt/host/snap/core/16202
/dev/loop5           squashfs       65024     65024         0 100% /mnt/host/snap/core20/2015
/dev/loop6           squashfs       65536     65536         0 100% /mnt/host/snap/core20/2105
/dev/loop7           squashfs       75904     75904         0 100% /mnt/host/snap/core22/1033
/dev/loop8           squashfs       75776     75776         0 100% /mnt/host/snap/core22/864
/dev/loop9           squashfs      251904    251904         0 100% /mnt/host/snap/firefox/3600
/dev/loop10          squashfs      358144    358144         0 100% /mnt/host/snap/gnome-3-38-2004/143
/dev/loop11          squashfs      251904    251904         0 100% /mnt/host/snap/firefox/3626
/dev/loop12          squashfs      497280    497280         0 100% /mnt/host/snap/gnome-42-2204/120
/dev/loop13          squashfs      508928    508928         0 100% /mnt/host/snap/gnome-42-2204/141
/dev/loop14          squashfs       93952     93952         0 100% /mnt/host/snap/gtk-common-themes/1535
/dev/loop15          squashfs       12672     12672         0 100% /mnt/host/snap/snap-store/959
/dev/loop16          squashfs       41856     41856         0 100% /mnt/host/snap/snapd/20290
/dev/loop17          squashfs       41472     41472         0 100% /mnt/host/snap/snapd/20671
/dev/nvme0n1p2       ext4       959786032  72771224 838186600   8% /mnt/host/var/snap/firefox/common/host-hunspell
/dev/loop18          squashfs         512       512         0 100% /mnt/host/snap/snapd-desktop-integration/83
/dev/nvme0n1p1       vfat          523248      6220    517028   1% /mnt/host/boot/efi
//10.0.0.20/Media/UFC  cifs       39345255876 9628426672 29716829204  24% /mnt/host/DATA/Media/UFC
//10.0.0.20/Media/Photos     cifs       39345255876 9628426672 29716829204  24% /mnt/host/DATA/Media/Photos
//10.0.0.20/Media/Documentaries            cifs       39345255876 9628426672 29716829204  24% /mnt/host/DATA/Media/Documentaries
//10.0.0.20/Media/Comedy     cifs       39345255876 9628426672 29716829204  24% /mnt/host/DATA/Media/Comedy
//10.0.0.20/Media/Backup     cifs       39345255876 9628426672 29716829204  24% /mnt/host/DATA/Backup
//10.0.0.20/Media/Movies     cifs       39345255876 9628426672 29716829204  24% /mnt/host/DATA/Media/Movies
df: /mnt/host/DATA/Media/TV\040Shows: No such file or directory
//10.0.0.20/Media/Music    cifs       39345255876 9628426672 29716829204  24% /mnt/host/DATA/Media/Music
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/609b3711d4d40a122bff2618c055282cf7621c5db0887331f141b0e7a1fabe50/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/792681f63aac9b60917018ab7521053bab14dfb7d2c33aac7c79c91664a32668/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/daf29832440922f7e7be22900a766d7e444cd0db81d44f50f238d3a6064f11cc/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/c120998fe94f81804d36d4c955490e795716b916560816910a836b8ddce2f3ee/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/890c9f9f4c84da38bcdd8f04586737235c22498c56f48df6e585d5efac4930dc/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/ba5a342d8cb11ceb07d5f7f502daaaec107627ced540990f81c06105ff56d0e5/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/a8416f2c5689ba4e511c8391c67c12fc42ca636f9a32c6561c3800b86a372a23/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/769bc06e0709900d1baac2688fd36de4466ae04a57e32f951c947198012e3e56/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/c8c2d87d1a8a792825767332092a59d4dfe54e9c7aa977e09156a852bef26984/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/ecfe327328e392093dead3950021a9a274c30926b99a8dfca11caef8ea2ade8e/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/cac7ab0bc56db7a85d676f2e9ae7f9816426e682190782d1ddfcfa7782b98586/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/bea9eda233c02b805e77f6b15218f5316307b29ffb13a9cbff5eeaa546a5e36d/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/dad052dcc97c729f9168482d1b9355742c5f2be8cd4811a619d3ca52b2a16f46/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/13b54b79bdd876a46bef879d52242a087e91accb2bb1990712b9e019fb184d8c/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/b3fbb5da518f45a39316e65d029877900f56a0356aa58d262d094a81ad4885f0/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/b3fbb5da518f45a39316e65d029877900f56a0356aa58d262d094a81ad4885f0/merged
tmpfs                tmpfs          65536         0     65536   0% /mnt/host/var/lib/docker/overlay2/b3fbb5da518f45a39316e65d029877900f56a0356aa58d262d094a81ad4885f0/merged/dev
shm                  tmpfs          65536         0     65536   0% /mnt/host/var/lib/docker/overlay2/b3fbb5da518f45a39316e65d029877900f56a0356aa58d262d094a81ad4885f0/merged/dev/shm
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/228ef67d243a2dfff1f1ed9f4e6a91c468ed86b3f8f630f127874e3b513937f8/merged
/dev/nvme0n1p2       ext4       959786032  72771220 838186604   8% /etc/resolv.conf
/dev/nvme0n1p2       ext4       959786032  72771220 838186604   8% /etc/hostname
/dev/nvme0n1p2       ext4       959786032  72771220 838186604   8% /etc/hosts
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/e4a73ae9ac0d6bb36d200933b28619cac8c6651885dcab25dbc01c94d16067ca/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/91f151eccaddad2d3e0c82e8fce66954f767b4f3228605640f011ab5f2973c77/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/4256ed12378be75adbd9db14ee8acbf67493a8ab5f9b0a9edd08a9b629bee75b/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/3c780521520f4ba9d98b477686dcdb9519e7e619300e2ccd0782bfd9d374ff13/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/a44619aa4420bf471e17f5c07754f8d702628f5ab685bd1628c9e169cd56229e/merged
overlay              overlay    959786032  72771220 838186604   8% /mnt/host/var/lib/docker/overlay2/9a20a660bb6a4a38525ffee6529344056f0b7f77138dd482eece389aabf03e37/merged

Environment (please complete the following information):

Additional context

I tried parsing the output above with your code as well, but managed to do so just fine, so I am wondering which part is making the problems?

Example ```js const _linux = true; const _darwin = false; const _freebsd = false; const _openbsd = false; const _netbsd = false; function getmacOsFsType(fs) { if (!fs.startsWith('/')) { return 'NFS'; } const parts = fs.split('/'); const fsShort = parts[parts.length - 1]; const macOsDisksSingle = macOsDisks.filter(item => item.indexOf(fsShort) >= 0); if (macOsDisksSingle.length === 1 && macOsDisksSingle[0].indexOf('APFS') >= 0) { return 'APFS'; } return 'HFS'; } function isLinuxTmpFs(fs) { const linuxTmpFileSystems = ['rootfs', 'unionfs', 'squashfs', 'cramfs', 'initrd', 'initramfs', 'devtmpfs', 'tmpfs', 'udev', 'devfs', 'specfs', 'type', 'appimaged']; let result = false; linuxTmpFileSystems.forEach(linuxFs => { if (fs.toLowerCase().indexOf(linuxFs) >= 0) { result = true; } }); return result; } function filterLines(stdout) { let lines = stdout.toString().split('\n'); lines.shift(); if (stdout.toString().toLowerCase().indexOf('filesystem')) { let removeLines = 0; for (let i = 0; i < lines.length; i++) { if (lines[i] && lines[i].toLowerCase().startsWith('filesystem')) { removeLines = i; } } for (let i = 0; i < removeLines; i++) { lines.shift(); } } return lines; } function parseDf(lines) { let data = []; lines.forEach(function (line) { if (line !== '') { line = line.replace(/ +/g, ' ').split(' '); if (line && ((line[0].startsWith('/')) || (line[6] && line[6] === '/') || (line[0].indexOf('/') > 0) || (line[0].indexOf(':') === 1) || !_darwin && !isLinuxTmpFs(line[1]))) { const fs = line[0]; const fsType = ((_linux || _freebsd || _openbsd || _netbsd) ? line[1] : getmacOsFsType(line[0])); const size = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[2] : line[1])) * 1024; const used = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[3] : line[2])) * 1024; const available = parseInt(((_linux || _freebsd || _openbsd || _netbsd) ? line[4] : line[3])) * 1024; const use = parseFloat((100.0 * (used / (used + available))).toFixed(2)); let rw = true; line.splice(0, (_linux || _freebsd || _openbsd || _netbsd) ? 6 : 5); const mount = line.join(' '); if (!data.find(el => (el.fs === fs && el.type === fsType))) { data.push({ fs, type: fsType, size, used, available, use, mount, rw }); } } } }); return data; } const stdout = `Filesystem Type 1024-blocks Used Available Capacity Mounted on overlay overlay 959786032 72771224 838186600 8% / tmpfs tmpfs 65536 0 65536 0% /dev shm tmpfs 65536 0 65536 0% /dev/shm /dev/nvme0n1p2 ext4 959786032 72771224 838186600 8% /mnt/host udev devtmpfs 16160512 0 16160512 0% /mnt/host/dev tmpfs tmpfs 16198784 0 16198784 0% /mnt/host/dev/shm tmpfs tmpfs 3239760 6048 3233712 0% /mnt/host/run tmpfs tmpfs 5120 4 5116 0% /mnt/host/run/lock tmpfs tmpfs 3239760 6048 3233712 0% /mnt/host/run/snapd/ns tmpfs tmpfs 3239756 112 3239644 0% /mnt/host/run/user/1000 efivarfs efivarfs 192 114 73 61% /mnt/host/sys/firmware/efi/efivars /dev/loop0 squashfs 128 128 0 100% /mnt/host/snap/bare/5 /dev/loop1 squashfs 9856 9856 0 100% /mnt/host/snap/canonical-livepatch/246 /dev/loop2 squashfs 9600 9600 0 100% /mnt/host/snap/certbot-dns-cloudflare/3182 /dev/loop4 squashfs 9600 9600 0 100% /mnt/host/snap/certbot-dns-cloudflare/3077 /dev/loop3 squashfs 108416 108416 0 100% /mnt/host/snap/core/16202 /dev/loop5 squashfs 65024 65024 0 100% /mnt/host/snap/core20/2015 /dev/loop6 squashfs 65536 65536 0 100% /mnt/host/snap/core20/2105 /dev/loop7 squashfs 75904 75904 0 100% /mnt/host/snap/core22/1033 /dev/loop8 squashfs 75776 75776 0 100% /mnt/host/snap/core22/864 /dev/loop9 squashfs 251904 251904 0 100% /mnt/host/snap/firefox/3600 /dev/loop10 squashfs 358144 358144 0 100% /mnt/host/snap/gnome-3-38-2004/143 /dev/loop11 squashfs 251904 251904 0 100% /mnt/host/snap/firefox/3626 /dev/loop12 squashfs 497280 497280 0 100% /mnt/host/snap/gnome-42-2204/120 /dev/loop13 squashfs 508928 508928 0 100% /mnt/host/snap/gnome-42-2204/141 /dev/loop14 squashfs 93952 93952 0 100% /mnt/host/snap/gtk-common-themes/1535 /dev/loop15 squashfs 12672 12672 0 100% /mnt/host/snap/snap-store/959 /dev/loop16 squashfs 41856 41856 0 100% /mnt/host/snap/snapd/20290 /dev/loop17 squashfs 41472 41472 0 100% /mnt/host/snap/snapd/20671 /dev/nvme0n1p2 ext4 959786032 72771224 838186600 8% /mnt/host/var/snap/firefox/common/host-hunspell /dev/loop18 squashfs 512 512 0 100% /mnt/host/snap/snapd-desktop-integration/83 /dev/nvme0n1p1 vfat 523248 6220 517028 1% /mnt/host/boot/efi //10.0.0.20/Media/UFC cifs 39345255876 9628426672 29716829204 24% /mnt/host/DATA/Media/UFC //10.0.0.20/Media/Photos cifs 39345255876 9628426672 29716829204 24% /mnt/host/DATA/Media/Photos //10.0.0.20/Media/Documentaries cifs 39345255876 9628426672 29716829204 24% /mnt/host/DATA/Media/Documentaries //10.0.0.20/Media/Comedy cifs 39345255876 9628426672 29716829204 24% /mnt/host/DATA/Media/Comedy //10.0.0.20/Media/Backup cifs 39345255876 9628426672 29716829204 24% /mnt/host/DATA/Backup //10.0.0.20/Media/Movies cifs 39345255876 9628426672 29716829204 24% /mnt/host/DATA/Media/Movies df: /mnt/host/DATA/Media/TV Shows: No such file or directory //10.0.0.20/Media/Music cifs 39345255876 9628426672 29716829204 24% /mnt/host/DATA/Media/Music overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/609b3711d4d40a122bff2618c055282cf7621c5db0887331f141b0e7a1fabe50/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/792681f63aac9b60917018ab7521053bab14dfb7d2c33aac7c79c91664a32668/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/daf29832440922f7e7be22900a766d7e444cd0db81d44f50f238d3a6064f11cc/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/c120998fe94f81804d36d4c955490e795716b916560816910a836b8ddce2f3ee/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/890c9f9f4c84da38bcdd8f04586737235c22498c56f48df6e585d5efac4930dc/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/ba5a342d8cb11ceb07d5f7f502daaaec107627ced540990f81c06105ff56d0e5/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/a8416f2c5689ba4e511c8391c67c12fc42ca636f9a32c6561c3800b86a372a23/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/769bc06e0709900d1baac2688fd36de4466ae04a57e32f951c947198012e3e56/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/c8c2d87d1a8a792825767332092a59d4dfe54e9c7aa977e09156a852bef26984/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/ecfe327328e392093dead3950021a9a274c30926b99a8dfca11caef8ea2ade8e/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/cac7ab0bc56db7a85d676f2e9ae7f9816426e682190782d1ddfcfa7782b98586/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/bea9eda233c02b805e77f6b15218f5316307b29ffb13a9cbff5eeaa546a5e36d/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/dad052dcc97c729f9168482d1b9355742c5f2be8cd4811a619d3ca52b2a16f46/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/13b54b79bdd876a46bef879d52242a087e91accb2bb1990712b9e019fb184d8c/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/b3fbb5da518f45a39316e65d029877900f56a0356aa58d262d094a81ad4885f0/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/b3fbb5da518f45a39316e65d029877900f56a0356aa58d262d094a81ad4885f0/merged tmpfs tmpfs 65536 0 65536 0% /mnt/host/var/lib/docker/overlay2/b3fbb5da518f45a39316e65d029877900f56a0356aa58d262d094a81ad4885f0/merged/dev shm tmpfs 65536 0 65536 0% /mnt/host/var/lib/docker/overlay2/b3fbb5da518f45a39316e65d029877900f56a0356aa58d262d094a81ad4885f0/merged/dev/shm overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/228ef67d243a2dfff1f1ed9f4e6a91c468ed86b3f8f630f127874e3b513937f8/merged /dev/nvme0n1p2 ext4 959786032 72771220 838186604 8% /etc/resolv.conf /dev/nvme0n1p2 ext4 959786032 72771220 838186604 8% /etc/hostname /dev/nvme0n1p2 ext4 959786032 72771220 838186604 8% /etc/hosts overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/e4a73ae9ac0d6bb36d200933b28619cac8c6651885dcab25dbc01c94d16067ca/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/91f151eccaddad2d3e0c82e8fce66954f767b4f3228605640f011ab5f2973c77/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/4256ed12378be75adbd9db14ee8acbf67493a8ab5f9b0a9edd08a9b629bee75b/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/3c780521520f4ba9d98b477686dcdb9519e7e619300e2ccd0782bfd9d374ff13/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/a44619aa4420bf471e17f5c07754f8d702628f5ab685bd1628c9e169cd56229e/merged overlay overlay 959786032 72771220 838186604 8% /mnt/host/var/lib/docker/overlay2/9a20a660bb6a4a38525ffee6529344056f0b7f77138dd482eece389aabf03e37/merged` let lines = filterLines(stdout); data = parseDf(lines); console.log(data); ``` Output: ```js [ { fs: 'overlay', type: 'overlay', size: 982820896768, used: 74517733376, available: 858303078400, use: 7.99, mount: '/', rw: true }, { fs: '/dev/nvme0n1p2', type: 'ext4', size: 982820896768, used: 74517733376, available: 858303078400, use: 7.99, mount: '/mnt/host', rw: true }, { fs: 'efivarfs', type: 'efivarfs', size: 196608, used: 116736, available: 74752, use: 60.96, mount: '/mnt/host/sys/firmware/efi/efivars', rw: true }, { fs: '/dev/loop0', type: 'squashfs', size: 131072, used: 131072, available: 0, use: 100, mount: '/mnt/host/snap/bare/5', rw: true }, { fs: '/dev/loop1', type: 'squashfs', size: 10092544, used: 10092544, available: 0, use: 100, mount: '/mnt/host/snap/canonical-livepatch/246', rw: true }, { fs: '/dev/loop2', type: 'squashfs', size: 9830400, used: 9830400, available: 0, use: 100, mount: '/mnt/host/snap/certbot-dns-cloudflare/3182', rw: true }, { fs: '/dev/loop4', type: 'squashfs', size: 9830400, used: 9830400, available: 0, use: 100, mount: '/mnt/host/snap/certbot-dns-cloudflare/3077', rw: true }, { fs: '/dev/loop3', type: 'squashfs', size: 111017984, used: 111017984, available: 0, use: 100, mount: '/mnt/host/snap/core/16202', rw: true }, { fs: '/dev/loop5', type: 'squashfs', size: 66584576, used: 66584576, available: 0, use: 100, mount: '/mnt/host/snap/core20/2015', rw: true }, { fs: '/dev/loop6', type: 'squashfs', size: 67108864, used: 67108864, available: 0, use: 100, mount: '/mnt/host/snap/core20/2105', rw: true }, { fs: '/dev/loop7', type: 'squashfs', size: 77725696, used: 77725696, available: 0, use: 100, mount: '/mnt/host/snap/core22/1033', rw: true }, { fs: '/dev/loop8', type: 'squashfs', size: 77594624, used: 77594624, available: 0, use: 100, mount: '/mnt/host/snap/core22/864', rw: true }, { fs: '/dev/loop9', type: 'squashfs', size: 257949696, used: 257949696, available: 0, use: 100, mount: '/mnt/host/snap/firefox/3600', rw: true }, { fs: '/dev/loop10', type: 'squashfs', size: 366739456, used: 366739456, available: 0, use: 100, mount: '/mnt/host/snap/gnome-3-38-2004/143', rw: true }, { fs: '/dev/loop11', type: 'squashfs', size: 257949696, used: 257949696, available: 0, use: 100, mount: '/mnt/host/snap/firefox/3626', rw: true }, { fs: '/dev/loop12', type: 'squashfs', size: 509214720, used: 509214720, available: 0, use: 100, mount: '/mnt/host/snap/gnome-42-2204/120', rw: true }, { fs: '/dev/loop13', type: 'squashfs', size: 521142272, used: 521142272, available: 0, use: 100, mount: '/mnt/host/snap/gnome-42-2204/141', rw: true }, { fs: '/dev/loop14', type: 'squashfs', size: 96206848, used: 96206848, available: 0, use: 100, mount: '/mnt/host/snap/gtk-common-themes/1535', rw: true }, { fs: '/dev/loop15', type: 'squashfs', size: 12976128, used: 12976128, available: 0, use: 100, mount: '/mnt/host/snap/snap-store/959', rw: true }, { fs: '/dev/loop16', type: 'squashfs', size: 42860544, used: 42860544, available: 0, use: 100, mount: '/mnt/host/snap/snapd/20290', rw: true }, { fs: '/dev/loop17', type: 'squashfs', size: 42467328, used: 42467328, available: 0, use: 100, mount: '/mnt/host/snap/snapd/20671', rw: true }, { fs: '/dev/loop18', type: 'squashfs', size: 524288, used: 524288, available: 0, use: 100, mount: '/mnt/host/snap/snapd-desktop-integration/83', rw: true }, { fs: '/dev/nvme0n1p1', type: 'vfat', size: 535805952, used: 6369280, available: 529436672, use: 1.19, mount: '/mnt/host/boot/efi', rw: true }, { fs: '//10.0.0.20/Media/UFC', type: 'cifs', size: 40289542017024, used: 9859508912128, available: 30430033104896, use: 24.47, mount: '/mnt/host/DATA/Media/UFC', rw: true }, { fs: '//10.0.0.20/Media/Photos', type: 'cifs', size: 40289542017024, used: 9859508912128, available: 30430033104896, use: 24.47, mount: '/mnt/host/DATA/Media/Photos', rw: true }, { fs: '//10.0.0.20/Media/Documentaries', type: 'cifs', size: 40289542017024, used: 9859508912128, available: 30430033104896, use: 24.47, mount: '/mnt/host/DATA/Media/Documentaries', rw: true }, { fs: '//10.0.0.20/Media/Comedy', type: 'cifs', size: 40289542017024, used: 9859508912128, available: 30430033104896, use: 24.47, mount: '/mnt/host/DATA/Media/Comedy', rw: true }, { fs: '//10.0.0.20/Media/Backup', type: 'cifs', size: 40289542017024, used: 9859508912128, available: 30430033104896, use: 24.47, mount: '/mnt/host/DATA/Backup', rw: true }, { fs: '//10.0.0.20/Media/Movies', type: 'cifs', size: 40289542017024, used: 9859508912128, available: 30430033104896, use: 24.47, mount: '/mnt/host/DATA/Media/Movies', rw: true }, { fs: 'df:', type: '/mnt/host/DATA/Media/TV', size: NaN, used: NaN, available: NaN, use: NaN, mount: 'or directory', rw: true }, { fs: '//10.0.0.20/Media/Music', type: 'cifs', size: 40289542017024, used: 9859508912128, available: 30430033104896, use: 24.47, mount: '/mnt/host/DATA/Media/Music', rw: true } ] ```

Do you have any idea?

sebhildebrandt commented 9 months ago

@MauriceNino thank you! Will try to work on it this weekend. So basically, instead of returning what you provided in the example, we just get an empty array?

sebhildebrandt commented 9 months ago

@MauriceNino ... as your command getting the underlying information from the OS is different to what I am using in the library ... can you make sure to retrieve the following info an from the target machine:

export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL

Thank you in advance.

MauriceNino commented 9 months ago

Thank you for looking into this! As far as I know some flag of those is not working in alpine linux. I think it was the l one, that's why I asked the user for the command I posted - thats the fallback provided in your code.

@SecOps-7 can you please test this by executing the command as well?

docker exec CONTAINER export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL

and also try the following because I don't know if the above one works without a shell:

docker exec CONTAINER export sh -c "LC_ALL=C; df -lkPTx squashfs; unset LC_ALL"
MauriceNino commented 9 months ago

I have executed the command on my container - can only provide a screenshot as I am on my phone right now, but I expect this to happen for the other users as well:

Screenshot_20240122_234035_Chrome

But for clarification, fsSize works fine on my machine, so that should not be an issue. I can provide a log of any other commands on my machine/container as well so you have something to compare against.

sebhildebrandt commented 9 months ago

@MauriceNino I am a little confused ....

I just need to exactly know the environment to be able to reproduce the issue. Can you provide more details about the environment? If it is a docker container, it would also be interesting to know things like volume shares, ...

Thank you in advance.

MauriceNino commented 9 months ago

@sebhildebrandt Sorry I could have worded this better. What I meant is that all the users who have had problems with this, had Ubuntu 22 or 23 as a host, but all had the alpine docker container running that my application is running in.

Unfortunately I don't know what volume shares are, but maybe @SecOps-7 can answer that question?

SecOps-7 commented 9 months ago

Thank you for looking into this! As far as I know some flag of those is not working in alpine linux. I think it was the l one, that's why I asked the user for the command I posted - thats the fallback provided in your code.

@SecOps-7 can you please test this by executing the command as well?

docker exec CONTAINER export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL

and also try the following because I don't know if the above one works without a shell:

docker exec CONTAINER export sh -c "LC_ALL=C; df -lkPTx squashfs; unset LC_ALL"

Morning, I ran the requested commands, I get the following output.

sudo docker exec Dashdot export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL

OCI runtime exec failed: exec failed: unable to start container process: exec: "export": executable file not found in $PATH: unknown
Filesystem     Type     1024-blocks     Used Available Capacity Mounted on
tmpfs          tmpfs        3239756     5992   3233764       1% /run
/dev/nvme0n1p2 ext4       959786032 75713552 835244272       9% /
tmpfs          tmpfs       16198776        0  16198776       0% /dev/shm
tmpfs          tmpfs           5120        4      5116       1% /run/lock
efivarfs       efivarfs         192      115        73      62% /sys/firmware/efi/efivars
/dev/nvme0n1p1 vfat          523248     6220    517028       2% /boot/efi
tmpfs          tmpfs        3239752      108   3239644       1% /run/user/1000
sudo docker exec Dashdot export sh -c "LC_ALL=C; df -lkPTx squashfs; unset LC_ALL"

OCI runtime exec failed: exec failed: unable to start container process: exec: "export": executable file not found in $PATH: unknown
MauriceNino commented 9 months ago

@SecOps-7 thank you for running the commands, unfortunately I messed one up. Can you please run this one again?

sudo docker exec Dashdot sh -c "export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL"
SecOps-7 commented 9 months ago

@sebhildebrandt Sorry I could have worded this better. What I meant is that all the users who have had problems with this, had Ubuntu 22 or 23 as a host, but all had the alpine docker container running that my application is running in.

Unfortunately I don't know what volume shares are, but maybe @SecOps-7 can answer that question?

I don't have any volumes shared on the Ubuntu host itself. I do however have all my NAS Media folders mounted via cifs. Apart from that I believe I have a symlink or two somewhere. Not sure if this is what you are looking for.

df -kPT

Filesystem                      Type     1024-blocks       Used   Available Capacity Mounted on
tmpfs                           tmpfs        3239756       5992     3233764       1% /run
/dev/nvme0n1p2                  ext4       959786032   76583148   834374676       9% /
tmpfs                           tmpfs       16198776          0    16198776       0% /dev/shm
tmpfs                           tmpfs           5120          4        5116       1% /run/lock
efivarfs                        efivarfs         192        115          73      62% /sys/firmware/efi/efivars
/dev/nvme0n1p1                  vfat          523248       6220      517028       2% /boot/efi
//10.0.0.20/Media/Music         cifs     39345255876 9687791720 29657464156      25% /DATA/Media/Music
//10.0.0.20/Media/Movies        cifs     39345255876 9687791720 29657464156      25% /DATA/Media/Movies
//10.0.0.20/Media/Series        cifs     39345255876 9687791720 29657464156      25% /DATA/Media/TV Shows
//10.0.0.20/Media/Comedy        cifs     39345255876 9687791720 29657464156      25% /DATA/Media/Comedy
//10.0.0.20/Media/Documentaries cifs     39345255876 9687791720 29657464156      25% /DATA/Media/Documentaries
//10.0.0.20/Media/Backup        cifs     39345255876 9687791720 29657464156      25% /DATA/Backup
//10.0.0.20/Media/Photos        cifs     39345255876 9687791720 29657464156      25% /DATA/Media/Photos
//10.0.0.20/Media/UFC           cifs     39345255876 9687791720 29657464156      25% /DATA/Media/UFC
tmpfs                           tmpfs        3239752        108     3239644       1% /run/user/1000
SecOps-7 commented 9 months ago

@SecOps-7 thank you for running the commands, unfortunately I messed one up. Can you please run this one again?

sudo docker exec Dashdot sh -c "export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL"

@MauriceNino seems df does not accept the -l or -x operators...

I got the below errors and then was able to run it successfully after removing l and x. Unfortunately I then get the error that df was unable to find the squashfs mount point.

sudo docker exec Dashdot sh -c "export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL"

df: unrecognized option: l
sudo docker exec Dashdot sh -c "export LC_ALL=C; df -kPTx squashfs; unset LC_ALL"

df: unrecognized option: x
sudo docker exec Dashdot sh -c "export LC_ALL=C; df -kPT squashfs; unset LC_ALL"

Filesystem           Type       1024-blocks    Used Available Capacity Mounted on
df: squashfs: can't find mount point
SecOps-7 commented 9 months ago

The command executes fine with the all the operators on my local Ubuntu. Seems its just having issues running inside the docker container.

export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL

Filesystem     Type     1024-blocks     Used Available Capacity Mounted on
tmpfs          tmpfs        3239756     5800   3233956       1% /run
/dev/nvme0n1p2 ext4       959786032 66938276 844019548       8% /
tmpfs          tmpfs       16198776        0  16198776       0% /dev/shm
tmpfs          tmpfs           5120        4      5116       1% /run/lock
efivarfs       efivarfs         192      115        73      62% /sys/firmware/efi/efivars
/dev/nvme0n1p1 vfat          523248     6220    517028       2% /boot/efi
tmpfs          tmpfs        3239752      104   3239648       1% /run/user/1000
MauriceNino commented 9 months ago

Yeah, that should be fine - that's what the fallback is for, right @sebhildebrandt ? And df -kPT should work fine inside the container.

sebhildebrandt commented 9 months ago

@MauriceNino right, but inside a container I get just the result inside of the container (basically the isolated environment containers are made for) and not the result of the host machine, right?

MauriceNino commented 9 months ago

@sebhildebrandt Yes, but with my application, I instruct my users to mount the entire host path into the container at /mnt/host. That's how systeminformation is able to read the correct data via fsSize.

For example, here is the output of fsSize on my instance of dashdot (inside the docker container, but omitted all the squashfs ones for clarity):

const sizes =  [
  {
    fs: 'overlay',
    type: 'overlay',
    size: 105089261568,
    used: 41191706624,
    available: 58512068608,
    use: 41.31,
    mount: '/',
    rw: false
  },
  {
    fs: '/dev/mapper/ubuntu--vg-ubuntu--lv',
    type: 'ext4',
    size: 105089261568,
    used: 41191706624,
    available: 58512068608,
    use: 41.31,
    mount: '/mnt/host',
    rw: true
  },
  {
    fs: 'efivarfs',
    type: 'efivarfs',
    size: 196608,
    used: 92160,
    available: 99328,
    use: 48.13,
    mount: '/mnt/host/sys/firmware/efi/efivars',
    rw: false
  },
  {
    fs: '/dev/nvme0n1p2',
    type: 'ext4',
    size: 2040373248,
    used: 284254208,
    available: 1631969280,
    use: 14.83,
    mount: '/mnt/host/boot',
    rw: false
  },
  {
    fs: '/dev/nvme0n1p1',
    type: 'vfat',
    size: 1124999168,
    used: 6369280,
    available: 1118629888,
    use: 0.57,
    mount: '/mnt/host/boot/efi',
    rw: false
  },
  {
    fs: '/dev/sda1',
    type: 'ext4',
    size: 3936820690944,
    used: 1772756307968,
    available: 1964008259584,
    use: 47.44,
    mount: '/mnt/host/mnt/media',
    rw: false
  }
]

Also, here is the output of df -kPT of that specific container:

Filesystem           Type       1024-blocks    Used Available Capacity Mounted on
overlay              overlay    102626232  40228436  57138532  41% /
tmpfs                tmpfs          65536         0     65536   0% /dev
shm                  tmpfs          65536         0     65536   0% /dev/shm
/dev/mapper/ubuntu--vg-ubuntu--lv              ext4       102626232  40228436  57138532  41% /mnt/host
udev                 devtmpfs     8005320         0   8005320   0% /mnt/host/dev
tmpfs                tmpfs        8070468         0   8070468   0% /mnt/host/dev/shm
tmpfs                tmpfs        1614096      4300   1609796   0% /mnt/host/run
tmpfs                tmpfs           5120         0      5120   0% /mnt/host/run/lock
tmpfs                tmpfs        1614096      4300   1609796   0% /mnt/host/run/snapd/ns
tmpfs                tmpfs        1614092         4   1614088   0% /mnt/host/run/user/1000
efivarfs             efivarfs         192        90        97  48% /mnt/host/sys/firmware/efi/efivars
/dev/loop0           squashfs       65024     65024         0 100% /mnt/host/snap/core20/1974
/dev/loop1           squashfs       65536     65536         0 100% /mnt/host/snap/core20/2105
/dev/loop2           squashfs      114688    114688         0 100% /mnt/host/snap/lxd/24322
/dev/loop3           squashfs       54656     54656         0 100% /mnt/host/snap/snapd/19457
/dev/loop4           squashfs       41472     41472         0 100% /mnt/host/snap/snapd/20671
/dev/nvme0n1p2       ext4         1992552    277592   1593720  15% /mnt/host/boot
/dev/nvme0n1p1       vfat         1098632      6220   1092412   1% /mnt/host/boot/efi
/dev/sda1            ext4       3844551456 1731207332 1917976816  47% /mnt/host/mnt/media
overlay              overlay    102626232  40228436  57138532  41% /mnt/host/var/lib/docker/overlay2/92794e13ed3b03815679c417e5e0d4a28828dca731a48fd4b61bf4dac29091a6/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/49d366ce338b5eb58c41d8f1fd118260d4caa2be18051ab1e93e1872f275aa5c/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/e165ac700070b75a954ff9806a9d3f3c49842dab592b1edf8678106553a354e8/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/e545d06b4e15afe3fe707b656505ea186a02364bd9d0ffd7af4a11e3b4ed5985/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/15abef1258b13d2c338085bef573f1a9db6eec1bccc942643f062800e7b74dfe/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/8c7557c129a5185d099e5abe8060e0eedf15d4a2309a691ee1a1badf4eb1470c/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/d63487d5b1e51ff6777aa4c50bbe575009800daccc1b5169c22e6a2b68c55332/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/157a3e2110b6d1b0d9afbe0ae5ba41caa9de44fcc94950b6e3ec6e93f8e998b2/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/f5ed3ed61293b72f16f9afec2a1bd5d852ed56f8f21379a279641c87eef8cde4/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/55fc0e699970710d5f979993d0b1f91b80121a10999900e085644e1a51317900/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/22544757b0520ac5e24b8141642af098a8394ae24d5c46ac81341901344adba2/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/709fcbcd209fafbdc18ce844b36e7548474b0ff04abd7948563a74f683004e79/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/42893255bc67486e62418532b77a5c514fe8524b03f823af35b70241adf97aa4/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/525e6e4ee535b05d8af70b7d96325433820b311c8ad0135aa542c384f820cc7d/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/000f94047f3f9142927dd0ade94c98f005f3c01a348ddf070dad7ed006fc4170/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/4ba0d16804d2b1643101f8c8b2fdbf1a4f0ab9a1d5dfea4af5c703939da660a5/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/6b996241168b35364357c63b93b7a552a80ed8cfee7fb2763d5d6c384f2bc051/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/68f11fb05cffe4c59b19fb1884a6f667b4ca578b707a0ae673c05bddc8cf5e51/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/d73a4561db773ce50bea2a24dac54b42bbf59cbd644ae27466a7a22c638c92f2/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/d1110a2ca461faef7eb59249ce45be859c4481f4830772c867e3f8ebf1d1a421/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/8adf711c25dfcd634f3c8cb0a0f22006bf526663764460f2caad8a7d9228085e/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/f26770e717b7caf00f832de2cec1d4d454b0b82ee29c1d98e69a8e6f29dae42c/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/24afe5224f96a7a32730b4babbd8bba7010a5aebc5fca5e8a4314025ca52e69a/merged
overlay              overlay    102626232  40228432  57138536  41% /mnt/host/var/lib/docker/overlay2/24afe5224f96a7a32730b4babbd8bba7010a5aebc5fca5e8a4314025ca52e69a/merged
tmpfs                tmpfs          65536         0     65536   0% /mnt/host/var/lib/docker/overlay2/24afe5224f96a7a32730b4babbd8bba7010a5aebc5fca5e8a4314025ca52e69a/merged/dev
shm                  tmpfs          65536         0     65536   0% /mnt/host/var/lib/docker/overlay2/24afe5224f96a7a32730b4babbd8bba7010a5aebc5fca5e8a4314025ca52e69a/merged/dev/shm
/dev/mapper/ubuntu--vg-ubuntu--lv              ext4       102626232  40228432  57138536  41% /etc/resolv.conf
/dev/mapper/ubuntu--vg-ubuntu--lv              ext4       102626232  40228432  57138536  41% /etc/hostname
/dev/mapper/ubuntu--vg-ubuntu--lv              ext4       102626232  40228428  57138540  41% /etc/hosts
djwinston commented 9 months ago

Hi. dashdot/issues/1032 has updates. After upgrade latest system packages problem resolved. But I can't explain which package. Also attached my log of updates included in fedora 39

sebhildebrandt commented 9 months ago

@MauriceNino ... concerning the last message here: so we can close this issue??

djwinston commented 9 months ago

Not yet. Author of issue after next upgrade again has the problem. We try to investigate packages version on Ubuntu and Fedora

It's related only for dashdot issue 1032, not for 944

MauriceNino commented 9 months ago

@sebhildebrandt No, unfortunately, it still seems to me like there are some issues that could be resolved.

The output of fsSize that I posted in the issue does not match up with the output of docker exec Dashdot df -kPT, which to me indicates that there is maybe some permissions problem, or maybe it parses the export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL wrong and then doesn't fall back to the df -kPT. Honestly, I have no clue, but the issue still seems to persist.

If you have already checked it and there seems to be nothing wrong with systeminformation, you can of course just close this issue for now and wait for users to troubleshoot in MauriceNino/dashdot#1032 - maybe we can figure it out together and see if something needs to be changed here. If that is the case, I will report back. For now, I personally can't really tell where the problem lies.

Thank you for taking your time with this though :)

camspiers commented 6 months ago

For node alpine containers the only solution that I have found for this is to install coreutils:

apk add coreutils

The reason is the following:

In the file lib/filesystem.js, the default command used in alpine is:

export LC_ALL=C; df -lkPTx squashfs; unset LC_ALL

This fails because busybox df doesn't support the l option. This results in the fallback command running:

df -kPT

This command succeeds but also can include some content in stderr (even though there are valid entries in stdout).

Specifically the content in stderr is about the paths like /sys/kernel/xxx not existing.

However because there is a difference in how the output is handled in the fallback command, if there is any content in stderr, the following lines never execute:

              if (!error) {
                let lines = filterLines(stdout);
                data = parseDf(lines);
              }

Because of this the data variable that is passed as the result to the callback or the resolve of the Promise is an empty array.