KittyKatt / screenFetch

Fetches system/theme information in terminal for Linux desktop screenshots.
GNU General Public License v3.0
3.89k stars 454 forks source link

Arch Linux: Slow trying to find current package count. #740

Open airvzxf opened 2 years ago

airvzxf commented 2 years ago

I'm submitting a ... (check one with "x")

[x] bug report
[ ] new distro request

Bug report

=> search Github for a similar issue or PR before submitting
=> download the latest revision from Github and check if the bug is still present
   -> https://github.com/KittyKatt/screenFetch/raw/master/screenfetch-dev
=> Show us the output of: screenfetch -v

$ screenfetch -V screenFetch - Version 3.9.1

The problem is coming when I updated the Arc Linux packages, then I noticed every time that I open the terminal it takes a lot of time to show the ScreenFetch. I run the verbose option and the issue looks when it is trying to retrieve the number of packages because it takes around 2 minutes.

:: Finding current package count...found as '1382'

$ time screenfetch
                   -`
                  .o+`                 wolf@MSIGT73EVR7RF
                 `ooo/                 OS: Arch Linux
                `+oooo:                Kernel: x86_64 Linux 5.15.12-arch1-1
               `+oooooo:               Uptime: 1d 20h 49m
               -+oooooo+:              Packages: 1382
             `/:-:++oooo+:             Shell: bash 5.1.12
            `/++++/+++++++:            Resolution: 1920x1080
           `/++++++++++++++:           WM: OpenBox
          `/+++ooooooooooooo/`         WM Theme: Clearlooks
         ./ooosssso++osssssso+`        GTK Theme: Adwaita [GTK3]
        .oossssso-````/ossssss+`       Disk: 178G / 469G (40%)
       -osssssso.      :ssssssso.      CPU: Intel Core i7-7820HK @ 8x 3.9GHz [44.0°C]
      :osssssss/        osssso+++.     GPU: NVIDIA GeForce GTX 1080
     /ossssssss/        +ssssooo/-     RAM: 8950MiB / 64282MiB
   `/ossssso+/:-        -:/+osssso+-
  `+sso+:-`                 `.-/+oso:
 `++:.                           `-/+/
 .`                                 `/

real    2m0.469s
user    0m0.419s
sys 0m0.356s
airvzxf commented 2 years ago

I found the problem, it is on the line number 1449: if [[ "${OSTYPE}" =~ "linux" && -z "${wsl}" ]] && snap list >/dev/null 2>&1; then. In my case, I recently installed the snap package, but I don't enable in the systemctl, it means that my laptop doesn't execute the snapd.service every time that it start, in fact, it runs manually when I execute sudo systemctl start snapd.service. Running the snapd.service, it takes 0m0.496s to complete the process.

The solutions that I found are:

  1. Run a systemctl to check if the snapd.service is running, but I don't know how to check it in other distros.
  2. Comment all of these lines about the snapd. From line 1488 to 1495.

$ sudo systemctl status snapd.service
○ snapd.service - Snap Daemon
     Loaded: loaded (/usr/lib/systemd/system/snapd.service; disabled; vendor preset: disabled)
     Active: inactive (dead)
TriggeredBy: ○ snapd.socket

If I enable the snapd.service, it runs as usually.

$ sudo systemctl status snapd.service
● snapd.service - Snap Daemon
     Loaded: loaded (/usr/lib/systemd/system/snapd.service; disabled; vendor preset: disabled)
     Active: active (running) since Mon 2022-01-03 19:33:28 CST; 1s ago
TriggeredBy: ● snapd.socket
   Main PID: 292059 (snapd)
      Tasks: 13 (limit: 77104)
     Memory: 35.7M
        CPU: 256ms
     CGroup: /system.slice/snapd.service
             └─292059 /usr/lib/snapd/snapd

ScreenFetch execution:

time /usr/bin/screenfetch
                   -`
                  .o+`                 wolf@MSIGT73EVR7RF
                 `ooo/                 OS: Arch Linux
                `+oooo:                Kernel: x86_64 Linux 5.15.12-arch1-1
               `+oooooo:               Uptime: 1d 21h 21m
               -+oooooo+:              Packages: 1384
             `/:-:++oooo+:             Shell: bash 5.1.12
            `/++++/+++++++:            Resolution: 1920x1080
           `/++++++++++++++:           WM: OpenBox
          `/+++ooooooooooooo/`         WM Theme: Clearlooks
         ./ooosssso++osssssso+`        GTK Theme: Adwaita [GTK3]
        .oossssso-````/ossssss+`       Disk: 178G / 469G (40%)
       -osssssso.      :ssssssso.      CPU: Intel Core i7-7820HK @ 8x 3.9GHz [49.0°C]
      :osssssss/        osssso+++.     GPU: NVIDIA GeForce GTX 1080
     /ossssssss/        +ssssooo/-     RAM: 9233MiB / 64282MiB
   `/ossssso+/:-        -:/+osssso+-
  `+sso+:-`                 `.-/+oso:
 `++:.                           `-/+/
 .`                                 `/

real    0m0.496s
user    0m0.274s
sys 0m0.185s