I'm experiencing the weirdest problem right now. Nautilus is essentially not working right now. My desktop is frozen, clicking and right clicking doesn't work, I can't open anything in nautilus, etc. It simply is broken. The problem is that I can't exactly kill it with anything.
while true; sudo killall -9 nautilus ; done
doesn't kill it.
I can't log out because I'm right in the middle of a long upload and I'm not going to kill it if I can help it. Is there something I can do to reload nautilus without logging out?
FYI, I was having the same issue. In my case, it appears to be caused by a faulty mount point somewhere in my FS tree.
Specifically, the culprit was a samba mount (cifs) that failed due to me losing VPN. As nautilus mentions these under 'Network' in the left sidebar, I'm guessing this caused it to hang. As a work-around I remounted all my volumes (sudo mount -a) and now nautilus is responsive again.
When Nautilus stopped responding and couldn't be killed, it turned out I had
sshfs
hanged. So this helped to kill it:When
sshfs
hangs, it sometimes causes a file browser to hang in such a way that it cannot itself be killed, butsshfs
can still be killed. Killingsshfs
in this situation makes it possible to kill (and restart) the file browser. Sometimes the file browser will quit whensshfs
is killed; occasionally it might even start responding immediately and not have to be killed.This does not always work, of course, because when a file browser such as Nautilus hangs, even in the specific scenario described here where
kill -9
was ineffective, it is not always due to a problem withsshfs
. However, this does seem to be a fairly common cause of the problem.Killing
sshfs
also stops other filesystem activity throughsshfs
mounts. Whensshfs
is malfunctioning, you probably want that. When it's not, and some other problem is hanging your file browser, you may not.When a process can't be killed, even with
SIGKILL
, even by root--which is what the question here describes happening tonautilus
--it's usually because the process is stuck in uninterruptible sleep (see also 3dGrabber's comment).1It's normal for a process to enter uninterruptible sleep for very short periods of time. Processes communicate with the kernel through system calls. Some system calls, while executing, cannot be interrupted by signals, so any signals sent to the process must wait until the system call has completed. Normally, that happens, and then the signal is received. But when a system call that can't be interrupted hangs, the process can never receive a signal, unless the hang can be stopped through some other means.
Killing a process is achieved by sending it a signal. By default, the
kill
command sendsSIGTERM
, which processes are free to handle however they want and is thus sometimes ineffective. The harsher way to kill a process isSIGKILL
(whichkill -9
orkill -KILL
sends). Processes cannot choose to ignoreSIGKILL
, but they still do not receive it while in uninterruptible sleep.A common cause of prolonged uninterruptible sleep is malfunctioning drivers, including filesystem drivers. Drivers are often implemented as kernel modules, and while most kernel modules can be loaded and unloaded, once one is malfunctioning and unable to complete an operation, there is often no reasonable and safe way to force it to stop while continuing to use the system. To end a process that's stuck in uninterruptible sleep, it's usually necessary to reboot.
FUSE drivers are a major exception to this. When they malfunction, you often needn't reboot. With FUSE, the details of how a filesystem is accessed are implemented outside the kernel, in an ordinary program. To access data on a FUSE filesystem, a program will still make system calls, but the kernel delegates them through the FUSE module into a handler program.
sshfs
is a FUSE filesystem driver. When data are accessed on ansshfs
mount, a system call is performed that delegates work to ansshfs
process. (Behind the scenes, to mount ansshfs
filesystem,/usr/bin/sshfs
was run. Or you may have run thesshfs
command manually.) If this malfunctions, it can cause the program attempting to access thesshfs
filesystem to remain in uninterruptible sleep, yet thesshfs
process itself may remain killable. When that process is killed, the system call becomes unstuck, returning an error code to indicate failure, and the program that made the system call can terminate or continue running.Malfunctions causing prolonged uninterruptible sleep are not unique to
sshfs
. They can happen with any filesystem, FUSE or not, though if it's not a FUSE filesystem then you likely must reboot. And there are other commonly used FUSE filesystems where this could occur, such asntfs-3g
. It doesn't happen often with any filesystem, but in practice it seems to occur more often withsshfs
than most other FUSE filesystems.Any program making a system call that uses a malfunctioning filesystem driver could run into this. But you would usually at least be trying to access a file on an
sshfs
mount, and thus have some idea of what might be wrong. In contrast, file browsers frequently access data outside of where you are currently working, in order to avoid giving outdated information about things like what filesystems are currently mounted and how much space is available on them, and sometimes to fetch information in the background to build thumbnails.1 Another scenario where this could happen is when it's a zombie process. However, unlike a process stuck in uninterruptible sleep, a zombie processes rarely causes problems, since the only resource it takes up is a row in the kernel's process table. A zombie
nautilus
processes would typically go unnoticed. In particular, that shouldn't keep a subsequently executednautilus
process from managing the desktop.Running the command
fixed this for me - it may help a future visitor.
I had the same problem.
Remounting one of the external USB drives didn't work due to "device is busy".
lsof
showed up that a file was held open by an already closed application.ps
showed that the application was still running, despite the already closed window.kill -9
didn't work on that application either.As
umount -f
also just complaineddevice is busy
, I finally decided to disconnect the external drive's USB cable.At that very moment, all pending
kill -9
s seemed to take place – both nautilus and the still running application closed and disappeared from myps
output.Have you tried
nautilus -q
already?It exits (and restarts) nautilus. I use it when it hangs or when i need to "refresh" it after installing new nautilus context actions