[mb-status] Large disks,indexing system freeze (SOLVED)

[priority:LOW]

Issue with mb-status and external disks.

I am starting to use mb-status, but I’ve run into a known problem. And remember why i didn’t use it till now.

I have two external drives that are always attached and mounted. One of them is a 1TB backup drive that’s about 80% full.

Whenever I hover over the menu item related to these drives, the system gets stuck trying to collect information from the disk.

The system doesn’t exactly freeze, but it becomes unresponsive—probably because jgmenu can’t handle gathering data from large disks for this system.

If I wait long enough (about an hour), the system eventually recovers. (hypotheses)
C-A-F2 TTY Reboot…

I understand that jgmenu isn’t optimized for handling large disks.
For ‘jgbrowser’ I added a max of data to check.

snippet jgbrowser-ce

  # Set the maximum number of files to load. Loading time of the menu. 
    Can take a while with realy large wallpaper collection and limited hardware.
    MAX_FILES=200  # set as high as possible like 10000 or more. 
    Slow menu, lower number. 


  # Check if the maximum number of files has been reached
    if [ $count -eq $MAX_FILES ]; then
        break
    fi
jgbrowser tweaked
#!/bin/bash
# Daniel Napora 2020 - 2023 <napcok@gmail.com>
# edit by musqz 2023 - 2024

# Set the maximum number of files to load. Loading time of the menu. Can take a while with realy large wallpaper collection and limited hardware.
MAX_FILES=200  # set as high as possible like 10000 or more. When slow menu, lower number. 

. "$HOME"/.config/mabox/mabox.conf

CONFIG_DIR="$HOME/.config/mbwallpaper"
CONF_FILE="$CONFIG_DIR/mbwallpaper.conf"

source <(grep = "$CONF_FILE")


case $LANG in
    pl*)
        DIRECTORIES="Katalogi"
        FILES="Pliki"
        ADDBOOKMARK="Dodaj do zakładek"
        OPENDIR="Otwórz w menadżerze plików"
        OPENTERM="Otwórz w terminalu"
        ;;
    es*)
        DIRECTORIES="Directorios"
        FILES="Archivos"
        ADDBOOKMARK="Agregar a marcadores"
        OPENDIR="Abrir Gestor de archivos aquí"
        OPENTERM="Abrir terminal aquí"
        ;;
    *)
        DIRECTORIES="Directories"
        FILES="Files"
        ADDBOOKMARK="Add to Bookmarks"
        OPENDIR="Open filemanager here"
        OPENTERM="Open terminal here"
        SET_WDIR="Set wallpaper dir for  (0)" 
        SET_WDIR2="Set wallpaper dir for  (1)"
     ;;
esac
    
: "${JGMENU_RESOURCE_OPENER="xdg-open"}"

    
    DIRECTORY=${1:-$HOME}

    # If '$DIRECTORY' is '/', unset it to avoid '//'.
    [[ $DIRECTORY == / ]] && DIRECTORY=

if [ "$jgbrowser_show_hidden" == false ]; then
    count=0  # Counter to keep track of processed items
    for item in "$DIRECTORY"/*; do
        if [[ -d $item ]]; then
            dirs+=("${item##*/},^pipe(jgbrowser \"$DIRECTORY/${item##*/}\")")
        else
            if [[ -f $item ]]; then
                files+=("${item##*/},xdg-open \"$DIRECTORY/${item##*/}\"")
                ((count++))
            fi
        fi

        # Check if the maximum number of files has been reached
        if [ $count -eq $MAX_FILES ]; then
            break
        fi
    done
else
    count=0
    for item in "$DIRECTORY"/* "$DIRECTORY"/.[^.]*; do
        if [[ -d $item ]]; then
            dirs+=("${item##*/},^pipe(jgbrowser \"$DIRECTORY/${item##*/}\")")
        else
            if [[ -f $item ]]; then
                files+=("${item##*/},xdg-open \"$DIRECTORY/${item##*/}\"")
                ((count++))
            fi
        fi

        if [ $count -eq $MAX_FILES ]; then
            break
        fi
    done
fi

printf "%b\n" "^sep(<small><i>${DIRECTORY:-/}</i></small>)"
printf "%b\n" "  ${ADDBOOKMARK},\"\"\"echo \"  ${DIRECTORY##*/},^pipe(jgbrowser ${DIRECTORY:-/})\" >> $HOME/.config/mabox/places.csv;mb-places -s\"\"\""
printf "%b\n" "^sep()"
printf "%b\n" " $SET_WDIR,awk -v newdir='${DIRECTORY:-/}' '/^wallpaper_dir=/{\$1=\"wallpaper_dir=\"newdir}1' $CONF_FILE > $CONF_FILE.tmp && mv $CONF_FILE.tmp $CONF_FILE"
printf "%b\n" " $SET_WDIR2,awk -v newdir='${DIRECTORY:-/}' '/^wallpaper_dir2=/{\$1=\"wallpaper_dir2=\"newdir}1' $CONF_FILE > $CONF_FILE.tmp && mv $CONF_FILE.tmp $CONF_FILE"
printf "%b\n" "^sep()"
printf "%b\n" " $OPENDIR,${JGMENU_RESOURCE_OPENER} \"${DIRECTORY:-/}\""
printf "%b\n" "<big></big> $OPENTERM,exo-open --launch TerminalEmulator --working-directory=\"${DIRECTORY:-/}\""
if [ ${#dirs[@]} -ne 0 ]; then
    printf "%b\n" "^sep($DIRECTORIES <small>(${#dirs[@]})</small>)"
    printf "%s\n" "${dirs[@]/&/&amp;}"
fi

# Count the total number of files in the folder
total_files=$(find "$DIRECTORY" -type f | wc -l)

if [ ${#files[@]} -ne 0 ]; then
    printf "%b\n" "^sep($FILES <small>($total_files)</small>)"
    #printf "%s\n" "${files[@]}"
    #okfiles=("${files[@]/</ &lt;}")
    printf "%s\n" "${files[@]/&/&amp;}"
    
fi

With setting ‘max_files = 200’ jgmenu reacts quick enough with large disks.

Suggestion:
Thinking of an option in mb-status to manage external drive visibility. For example:

  • A checkbox to show/hide external disks.
  • Or maybe even better, individual check-boxes for each USB drive.
why? Because a small sticky is ok to show up.
  • Another idea: automatically hide drives larger than XXXGB.
  • Or another solution.

For now, I’ve disabled the DISK/USB section in mb-status to avoid accidentally hovering over the large disk and causing the system to hang.

:bird:

1 Like

Thank you @muzqs for writing this thread.

I’m aware that the mb-status menu can be quite slow on older devices.

But I didn’t expect it to be this extremely slow.

I’ll have to work on this for a while, but I think it would be a good idea to not show external drives by default.

Questions:
What is filesystem on your problematic external drive?
How long does it take to run du -sh on it?

I have some pendrives and external disks, but all of them formatted as ext4 filesystem and work pretty fast.

By the way…
Jgmenu is very well optimized. And also jgbrowser script. I think the problem is elsewhere.

napcok@mabox ~ $ time jgbrowser /usr/bin |wc -l
5535

real	0m0.094s
user	0m0.057s
sys	0m0.042s

Most of the disks I use are ext4.

I stopped process (Ctrl-c) after

sdd         disk                    1,8T TOSHIBA MQ04UBD200      
└─sdd1      part ext4   TerraBird   1,8T               80% full         

time du -sh
^C

real	1m50,986s
user	0m0,775s
sys	0m10,684s

Home Directory. 1TB. 37% full.

time du -sh

real	0m17,087s
user	0m0,595s
sys	0m4,478s

time mb-status status /usr/bin/ | wc -l
1

real	0m0,011s
user	0m0,006s
sys	0m0,009s


time jgbrowser /usr/bin/ | wc -l
209

real	0m0,021s
user	0m0,012s
sys	0m0,010s

Pendrives are fine. It’s just the large disks.

:bird:

Thinking about how to exclude external drives from the loop…
Can you please paste output of command mount | grep 'dev/sd' while external disk is mounted?

mount |grep 'dev/sd'
/dev/sda2 on / type ext4 (rw,noatime)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
/dev/sdb1 on /run/media/napcok/4ec18261-7448-46aa-9fd9-fc4000373690 type ext4 (rw,nosuid,nodev,relatime,errors=remount-ro,uhelper=udisks2)

Removable media filtered out with recent mabox-tools update.

Also added:

  • Update with yay (no AUR) option
  • Update with pacman

Removed:

  • Update with Pamac (gui) - no need to learn users a bad practice

1 Like
mount |grep 'dev/sd'
/dev/sdd1 on /run/media/vogel/TerraBird type ext4 (rw,nosuid,nodev,relatime,errors=remount-ro,uhelper=udisks2)
/dev/sdc1 on /run/media/vogel/mkgifs type ext4 (rw,nosuid,nodev,relatime,errors=remount-ro,uhelper=udisks2)

Another thing what happens with mb-status.

After an update update_list is not empty.

bat /tmp/updates/updates_list
───────┬────────────────────────────────────────────────────────────────────────────────────────
       │ File: /tmp/updates/updates_list
───────┼────────────────────────────────────────────────────────────────────────────────────────
   1   │ mabox-tools 20250820-2 -> 20250824-1

For now i replaced updates with

updates=$(checkupdates | wc -l)
#updates=$(wc -l ${UPDATES_LIST} |awk '{print $1}')

edit mmmm… not sure now. file is empty . i refreshed tint2 every time.
keep a watch on this one…
:bird:

@napcok

I attached the usb disks on a old laptop with fresh mabox install.
And all disk are fine with jgmenu.
So i have to look at my desktop hardware setup.

Sorry for confusion.

:bird: