Unable to delete hidden file blocking backup

Discussion in 'ISPConfig 3 Priority Support' started by tlove, Apr 27, 2025.

  1. tlove

    tlove Member HowtoForge Supporter

    Backing up /var/www/ is being stopped by a file with unknown permissions and ownerships and which also blocks chmod and chown to change them and cd to access it via sudo.
    The file details from ll are "d????????? ? ? ? ? ? .mount_CollabZbeFLI/:
    I.e. permissions are d?????????
    Ownership/access is ? ?
    Size and date is ? ?
    The directory name is .mount_CollabZbeFLI/
    I welcome advice!
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    From ChatGPT:

    You’re seeing a file that looks something like:
    d????????? ? ? ? ? ? .mount_CollabZbeFLI/

    In Linux, the ls -l output with d????????? suggests something strange:
    • d means it's (or was) a directory.
    • ????????? instead of normal permissions (rwxr-xr-x, etc.) indicates the file's metadata cannot be read — possibly because:
      • The filesystem is corrupted.
      • The mount point is gone or half-broken.
      • The underlying device disappeared.
      • You don't have permission or there's a "stale" resource.
    Now, about .mount_CollabZbeFLI/:
    • Hidden (starts with a dot .mount_...).
    • Random-looking suffix like CollabZbeFLI — typically these are autogenerated temporary mount points.
    • Common suspects:
      • AppImage apps (they create .mount_* temporary directories under /tmp usually).
      • FUSE-based mounts (e.g., Google Drive, Dropbox, rclone mounts).
      • Flatpak applications sometimes create transient mounts.
      • snapd can create .mount_* too, when snap packages run.
    Specifically:
    • .mount_ directories are almost certainly from AppImage when you run an AppImage file.
    • The random part (CollabZbeFLI) is generated per mount to avoid conflicts.
    When the AppImage runs, it mounts itself to a hidden location like /tmp/.mount_something/, then executes from there. If it crashes or is forcibly killed, the mount might stay orphaned and weird like you're seeing.

    TL;DR:
    ✅ This looks like a leftover AppImage mount.
    Alternative but less likely: FUSE mount (like Google Drive, rclone, or similar user-space mounts).
    Quick check:
    • Run mount | grep CollabZbeFLI — see if the system thinks it's still mounted.
    • Look inside /tmp — AppImage .mount_* usually lands there.
    • Try lsattr or stat — see if it gives errors or more info.
    • lsof might show a process using it.
    Alright! Let's clean this up safely and carefully.
    Here’s a step-by-step plan you can follow:

    1. Check if it’s still mounted
    First, let's see if it's an active mount:

    mount | grep CollabZbeFLI

    or more generally:

    mount | grep .mount_

    If it shows up, it means it's still mounted. If nothing shows, it's likely a stale broken entry (not mounted anymore).

    2. If it is mounted, try to unmount
    If the previous step shows it's mounted, try to unmount it cleanly:

    sudo umount /path/to/.mount_CollabZbeFLI

    (Replace /path/to/ with the actual directory — or just sudo umount ./.mount_CollabZbeFLI/ if you're inside that folder.)

    3. If umount fails (for example: "target is busy")
    You might need to force unmount:

    sudo umount -l /path/to/.mount_CollabZbeFLI

    where -l means "lazy unmount" — disconnects now, cleans up later when the system is ready.

    If still stubborn, even more aggressively:

    sudo umount -f /path/to/.mount_CollabZbeFLI

    (-f = force. Be cautious — only use this if nothing else works.)

    4. If it’s not mounted anymore (but directory is stuck)
    You can simply remove it:

    sudo rm -rf /path/to/.mount_CollabZbeFLI

    ✅ That should fully remove the ghost directory.

    5. Final check
    Make sure it's gone:

    ls -la /path/to/

    (no .mount_CollabZbeFLI should be listed anymore)

    Bonus Tip
    If you encounter many .mount_* folders and want to clean all old broken ones at once (be careful!), you can:

    sudo find /tmp -maxdepth 1 -type d -name ".mount_*" -exec rm -rf {} +

    (Only if you know these are all AppImage leftovers.)

    Summary
    • If mounted → sudo umount.
    • If stuck → sudo umount -l or sudo umount -f.
    • If not mounted → sudo rm -rf.
    • Double check and you're done!
    Would you like me to also give you a small script to automatically detect and clean such orphan .mount_* folders in the future?
    It can be really handy if you often run AppImages!
     
  3. tlove

    tlove Member HowtoForge Supporter

    Wow - Thank you! That cleared things up almost instantly.
    That is from ChatGPT? Amazing.
    Running mount | grep CollabZbeFLI showed that it is still active. The response is
    Collabora_Online.AppImage on /var/www/clients/client1/web11/tmp/.mount_CollabZbeFLI type fuse.Collabora_Online.AppImage (ro,nosuid,nodev,relatime,user_id=5009,group_id=5005)
    That website is running Nextcloud and the Nextcloud Office app loads and uses a Collabora code server.
    I just logged in and disabled and removed the Collabora server but there was no change in response to mount | grep CollabZbeFLI
    Did a reboot and that fixed it .mount_CollabZbeFLI disappeared.
    I've
    Yes please to the script to detect and delete these folders as Nextcloud becomes more popular.
    Thank you!
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    yes. I just asked it:

    Code:
    Linux, which software might be responsible to create such a hidden file:
    
    "d????????? ? ? ? ? ? .mount_CollabZbeFLI/:
     
  5. tlove

    tlove Member HowtoForge Supporter

    Thanks, Till. I'm amazed and impressed. I'll try it myself for the future.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    I just saw that you asked for the script that ChatGPT offered to create; here it is. Please note that I have not tested it :)

    Code:
    #!/bin/bash
    
    # Script: clean_mounts.sh
    # Purpose: Clean up leftover .mount_* directories safely
    # Supports --dry-run and custom scan directory with error handling
    
    DRY_RUN=false
    SCAN_DIR="/tmp"  # Default scan directory
    
    # Help function
    usage() {
        echo "Usage: $0 [--dry-run] [scan_directory]"
        echo "  --dry-run        Only show what would happen, do not modify anything."
        echo "  scan_directory   Directory to scan (default: /tmp)."
        exit 1
    }
    
    # Parse arguments
    while [[ $# -gt 0 ]]; do
        case "$1" in
            --dry-run)
                DRY_RUN=true
                shift
                ;;
            -h|--help)
                usage
                ;;
            *)
                if [ -z "$SCAN_DIR_SET" ]; then
                    SCAN_DIR="$1"
                    SCAN_DIR_SET=true
                    shift
                else
                    echo "Error: Unexpected argument: $1"
                    usage
                fi
                ;;
        esac
    done
    
    # Check if directory exists
    if [ ! -d "$SCAN_DIR" ]; then
        echo "Error: Directory '$SCAN_DIR' does not exist."
        exit 2
    fi
    
    echo "Scanning directory: $SCAN_DIR"
    if $DRY_RUN; then
        echo "Running in DRY-RUN mode: No changes will be made."
    fi
    
    # Start scanning
    FOUND=false
    for dir in "$SCAN_DIR"/.mount_*; do
        if [ -d "$dir" ]; then
            FOUND=true
            echo "Found: $dir"
    
            # Check if it's mounted
            if mount | grep -q "$dir"; then
                echo "Directory is mounted: $dir"
                if $DRY_RUN; then
                    echo "Would unmount: $dir"
                else
                    echo "Unmounting: $dir"
                    sudo umount -l "$dir"
                fi
            fi
    
            # After unmount (or if not mounted), remove it
            if [ -d "$dir" ]; then
                if $DRY_RUN; then
                    echo "Would remove: $dir"
                else
                    echo "Removing directory: $dir"
                    sudo rm -rf "$dir"
                fi
            fi
        fi
    done
    
    if ! $FOUND; then
        echo "No .mount_* directories found in $SCAN_DIR."
    fi
    
    echo "Cleanup process finished."
    if $DRY_RUN; then
        echo "(No actual unmount or delete actions were performed.)"
    fi
    
    You can do a dry-run with:

    Code:
    clean_mounts.sh --dry-run /mnt
    or a live run:

    Code:
    clean_mounts.sh /mnt
    where /mnt is the directory where the mount points are that you would like to clean up.
     

Share This Page