Looking for some advice with unmounting problem

loqur

New Member
Joined
Jul 12, 2021
Messages
5
Reaction score
3
Credits
65
Hello there,

I'll start by apologizing for my bad English, I can understand everything, but I have trouble writing

I'm noob with linux. I ran one small home linux debian server. It has 1 small hd (500gb) where i have Debian GNU/Linux 9 (stretch) running on it (yes its very outdated) and another 3 four tb drives running in raid-0 (yes, i understead i can loose all my data, i'm looking for performace)

So long story short, that is my home server, and i run just a few things on it, like a plex server, an ftp server and a torrent client. i build it like four years ago, and i did everything reading tutorials (and asking A LOT on irc channels). Everything i setup i did via terminal, altough i have it connected via kvm, so i can use the gui when i need/want.

Everything just works. I never had any issue at all. That is a default linux install, with a root and a sudo user. I never did the upgrade to buster because i'm afraid if something "break" after the upgrade, i'll not be able to fix it, or get it working by myself, so that is the reason i never touched it.

Some days ago, i have to manual turn off it, because we would have a "planed" power lost on my build, so i prefred to shut it down properly that time.

i did sudo poweroff but the server help lights on.

So i logged via kvm, and found it halted with this msg:

[ OK ] Unmounted /run/user/1000.
Unmounting /mnt...
[ FAILED ] Failed unmounting /mnt.
[ OK ] Reached target Shutdown.
[ 3281.455518 ] reboot: System Halted.

And after that as i said, the server continued powered up, them i have to keep power button off them it turns off.

Everything is default, the linux install, with users and apps, and BIOS. The only non default option at BIOS is "Wake on LAN" with i set to ON. I did tested it with that bios settings set to OFF and it hangs the same way on shutdown.

I"m not aware what i can paste here or not and i'm not here to cause spam or anything, so i'll just paste my fstab config. Maybe any of you guys can help me out fix that ?


# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=ad4ca0cf-cba7-468f-a34a-0de9f5361dd5 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=xxxxxx-xxxxxxxx-xxxxx-xxxxxxx none swap sw 0 0
UUID=xxxxxx-xxxx-xxxx-xxxx-xxxxxx /mnt ext4 defaults,nofail,discard 0 0
/mnt/ftp /jail/glftpd/site none bind 0 0


And here is a df -h cmd

user@debian:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 63M 1.5G 4% /run
/dev/sda1 442G 5.3G 415G 2% /
tmpfs 7.8G 8.0K 7.8G 1% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/md0 11T 9.9T 481G 96% /mnt
tmpfs 1.6G 4.0K 1.6G 1% /run/user/111
tmpfs 1.6G 0 1.6G 0% /run/user/1000


If i can post any other specifig info, or any logs to help troubleshoot it please let me know.

Thank you in advance already.
 


G'day @loqur from The Land Down Under (Australia) and welcome to linux.org :)

I am going to move this Thread to General Server, where you may get better attention.

Good Luck

Chris Turner
wizardfromoz
 
wizardfromoz,

thanks for the welcome and thank to move it to the correct place.
 
My first thought, someone is either logged into /mnt
or some process is running from there.

Have all logged in users type pwd
If it says /mnt/something... they will have to cd / or cd ~ or somewhere out of that directory.

If no one is logged into that directory, this this...

lsof | grep mnt
 
I agree with @dos2unix. It appears something is holding the mount in place. Likely process or person is in the directory structure preventing it from unmounting.

Display the output of lsof | grep '/mnt/'

It should show you both the offending file or directory that is open and who the offender is.
 
hi,

first of all thank you both dos2unix and dcbrown73 for answer.

Ok, i did lsof | grep '/mnt/' cmd

and that show A LOT of lines and files, basically like this:

rtorrent 689 1190 user 4109r REG 9,0 5795 341187278 /mnt/_seeding/file.name.mp4

So i understead that rtorrent user is causing the issue ?

ps: not sure if it helps or not, but i remember when i setup this box, i did that rtorrent setup following their oficial tutorial, and i remember i have created an user rtorrent without a pass

I believe that was the cmd

sudo adduser --system --home=/var/lib/rtorrent --group rtorrent
 
Last edited:
you might want to try..

ps -ef | grep 689
to see what processs 689 is
You might have to kill it.
sudo kill 689 unless it's a service you can stop.
 
you might want to try..

ps -ef | grep 689 to see what processs 689 is
You might have to kill it.
sudo kill 689 unless it's a service you can stop.

hey dos2unix,

user@debian:~$ ps -ef | grep 689
user 689 688 0 Sep19 pts/0 00:08:15 rtorrent
user 26286 25200 0 18:36 pts/2 00:00:00 grep 689
user@debian:~$

You see, i don't want kill it, well at least not now the server is up and running.

Is there a way i could set an "auto kill" for that when i shutdown or something like, so the shutdown process do not hang ?

thank you again
 
This gets a little involved.


It looks like you will need a init script.
Usually these have a way of looking for a PID (process ID)
so they know which process to shut down when the computer powers down.

It's been about 4 or 5 years since the time I used sysV init files.
Someone else might be more helpful here.
 
Wouldn't
Code:
pkill -KILL -u rtorrent && poweroff
be a lot easier?

Maybe just for permanent use:
Code:
// Use su for non-sudo systems
sudo -i

// Make an easy command
echo "pkill -KILL -u rtorrent && poweroff" > /usr/local/bin/shutdown
chmod a+x /usr/local/bin/shutdown

// Done
In which case you can just type "shutdown" in the future.



If you need some debugging as well, use this instead:
Code:
echo "if pkill -KILL -u rtorrent; then poweroff; else echo FAILED; lsof /mnt; fi;" > /usr/local/bin/shutdown
 
This gets a little involved.


It looks like you will need a init script.
Usually these have a way of looking for a PID (process ID)
so they know which process to shut down when the computer powers down.

It's been about 4 or 5 years since the time I used sysV init files.
Someone else might be more helpful here.
You can just borrow one from someone else.
Then just just replace the user with your user and install screen if you haven't already.
1. Install screen:
Code:
sudo apt-get install screen
2. Download the script in the previous link and place it in /etc/init.d/rtorrent and it should look like this.
Code:
#!/bin/bash
### BEGIN INIT INFO
# Provides:          rtorrent
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:     $local_fs $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop rtorrent daemon
### END INIT INFO

# ------------------------------------------------------------------------------
# /etc/init.d/rtorrent
#
# This script is an init script to run rtorrent in the background, using a
# screen. The script was designed and tested for Debian systems, but may work on
# other systems. On Debian, enable it by moving the script to
# "/etc/init.d/rtorrent" and issuing the command
# "update-rc.d rtorrent defaults 99"
#    ____                _ _
#   / ___|  ___  ___  __| | |__   _____  __
#   \___ \ / _ \/ _ \/ _` | '_ \ / _ \ \/ /
#    ___) |  __/  __/ (_| | |_) | (_) >  <
#   |____/ \___|\___|\__,_|_.__/ \___/_/\_\
#
# @see http://methvin.net/scripts/rtorrent
# @see http://tldp.org/LDP/abs/html/
# ------------------------------------------------------------------------------

## Username to run rtorrent under, make sure you have a .rtorrent.rc in the
## home directory of this user!
USER="rottorent"

## Absolute path to the rtorrent binary.
RTORRENT="/usr/bin/rtorrent"

## Absolute path to the screen binary.
SCREEN="/usr/bin/screen"

## Name of the screen session, you can then "screen -r rtorrent" to get it back
## to the forground and work with it on your shell.
SCREEN_NAME="rtorrent"

## Absolute path to rtorrent's PID file.
PIDFILE="/var/run/rtorrent.pid"

## Absolute path to rtorrent's XMLRPC socket.
SOCKET="/var/run/rtorrent/rpc.socket"

## Check if the socket exists and if it exists delete it.
delete_socket() {
    if [[ -e $SOCKET ]]; then
        rm -f $SOCKET
    fi
}

case "$1" in
    ## Start rtorrent in the background.
    start)
        echo "Starting rtorrent."
        delete_socket
        start-stop-daemon --start --background --oknodo \
            --pidfile "$PIDFILE" --make-pidfile \
            --chuid $USER \
            --exec $SCREEN -- -DmUS $SCREEN_NAME $RTORRENT
        if [[ $? -ne 0 ]]; then
            echo "Error: rtorrent failed to start."
            exit 1
        fi
        echo "rtorrent started successfully."
        ;;

    ## Stop rtorrent.
    stop)
        echo "Stopping rtorrent."
        start-stop-daemon --stop --oknodo --pidfile "$PIDFILE"
        if [[ $? -ne 0 ]]; then
            echo "Error: failed to stop rtorrent process."
            exit 1
        fi
        delete_socket
        echo "rtorrent stopped successfully."
        ;;

    ## Restart rtorrent.
    restart)
        "$0" stop
        sleep 1
        "$0" start || exit 1
        ;;

    ## Print usage information if the user gives an invalid option.
    *)
        echo "Usage: $0 [start|stop|restart]"
        exit 1
        ;;

esac
3. sudo systemctl enable rtorrent

That should do it, however it seems like Debian 9 was already using systemd so you could also just write a systemd startup file for that. Then you could just download this file and place it in /etc/systemd/system/rtorrent.service.
Code:
[Unit]
Description=rTorrent Service
After=network.target

[Service]
Type=forking
KillMode=none
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
WorkingDirectory=/var/lib/rtorrent
User=rtorrent
Group=rtorrent

[Install]
WantedBy=multi-user.target
And then enable it: sudo systemctl enable rtorrent
 
hello there,

first of all i apologize for the long, long (LONG) time to get back and answer.

We have rough past weeks over here where i live, but finally things are coming back to normal.

wizardfromoz, dos2unix, dcbrown73, Fanboi, f33dm3bits, thank you all for the solutions and help.

Fanboi solution worked 100%.

One more time thank you very much all of you.
 

Staff online

Members online


Top