Nautilus 最初无法打开,但经过很长时间后它开始正常工作

Nautilus 最初无法打开,但经过很长时间后它开始正常工作

我最近从 16.04 升级到了 18.04。当我登录系统时,桌面上没有显示任何文件,并且“文件”图标也没有打开。当我运行命令时,time nautilus它给出了以下响应:

Failed to register: Timeout was reached

real    0m25.074s
user    0m0.042s
sys 0m0.025s

但 5 分钟后,所有窗口突然打开,桌面上的文件夹也开始显示。相同命令的响应如下:

real    0m0.060s
user    0m0.038s
sys 0m0.008s

虽然我可以使用终端访问所有文件和文件夹。此外,即使在我发出命令后它也能正常工作,nautilus -q并且不会花费太多时间。似乎问题只发生在我登录系统时。虽然 ubuntu 16.04 不是这种情况,一切都立即启动。

编辑:我删除并再次安装了 nautilus,但没有帮助。

输出free -h

              total        used        free      shared  buff/cache   available
Mem:           7.6G        2.7G        1.4G        268M        3.5G        4.3G
Swap:            0B          0B          0B

输出sysctl vm.swappiness

vm.swappiness = 60

输出ls -al ~/.local/share/gnome-shell/extensions

ls: cannot access '/home/bhavy/.local/share/gnome-shell/extensions': No such file or directory

输出ls -al /usr/share/gnome-shell/extensions

total 16
drwxr-xr-x 4 root root 4096 Jun  7 01:52 .
drwxr-xr-x 6 root root 4096 Jun  7 01:17 ..
drwxr-xr-x 3 root root 4096 Jun  7 01:52 [email protected]
drwxr-xr-x 3 root root 4096 Jun  7 01:52 [email protected]

输出cat /var/log/syslog|grep nautilus

Jun  7 18:22:41 bhavy-HP whoopsie[1956]: [18:22:41] Parsing /var/crash/_usr_bin_nautilus.1000.crash.
Jun  7 18:22:41 bhavy-HP whoopsie[1956]: [18:22:41] Uploading /var/crash/_usr_bin_nautilus.1000.crash.
Jun  7 18:30:30 bhavy-HP nautilus-deskto[4472]: can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied
Jun  7 18:30:30 bhavy-HP nautilus-deskto[4472]: message repeated 2 times: [ can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied]
Jun  7 18:30:30 bhavy-HP nautilus[4565]: can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied
Jun  7 18:30:30 bhavy-HP nautilus-deskto[4472]: can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied
Jun  7 18:30:31 bhavy-HP nautilus-deskto[4472]: message repeated 44 times: [ can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied]
Jun  7 18:30:31 bhavy-HP dbus-daemon[1403]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.269' (uid=1000 pid=4565 comm="/usr/bin/nautilus --gapplication-service " label="unconfined")
Jun  7 18:30:31 bhavy-HP nautilus[4565]: can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied
Jun  7 18:30:31 bhavy-HP nautilus[4565]: can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied
Jun  7 18:30:31 bhavy-HP nautilus[4565]: can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied
Jun  7 18:30:31 bhavy-HP nautilus-deskto[4472]: can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied
Jun  7 18:30:31 bhavy-HP nautilus-deskto[4472]: message repeated 191 times: [ can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied]
Jun  7 18:30:32 bhavy-HP nautilus[4565]: can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied
Jun  7 18:30:33 bhavy-HP nautilus[4565]: message repeated 129 times: [ can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied]
Jun  7 18:30:37 bhavy-HP nautilus-deskto[4472]: can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied
Jun  7 18:30:38 bhavy-HP nautilus-deskto[4472]: message repeated 143 times: [ can't init metadata tree /home/bhavy/.local/share/gvfs-metadata/home: open: Permission denied]

还有一个系统程序错误检测窗口。当我/var/crash用 查看文件夹时ls。它给出了以下输出

_usr_bin_nautilus.1000.crash  _usr_bin_nautilus.1000.upload  _usr_bin_nautilus.1000.uploaded

编辑2:以下两个命令不sudo grep -i swap /etc/fstab打印sudo blkid | grep -i swap任何内容。

对于ls -al /home/bhavy/.local/share/gvfs-metadata/输出是

drwx------  2 bhavy bhavy  4096 Apr  1 13:47  .
drwx------ 37 bhavy bhavy  4096 Jun  7 19:32  ..
-rw-------  1 root  root  90096 Apr 14  2018  home
-rw-r--r--  1 root  root  32768 Apr 14  2018  home-520671b4.log
-rw-------  1 bhavy bhavy  1068 May 10  2018 'mtp:host=%5Busb%3A001%2C004%5D'
-rw-rw-r--  1 bhavy bhavy 32768 May 10  2018 'mtp:host=%5Busb%3A001%2C004%5D-ea794164.log'
-rw-------  1 bhavy bhavy   892 Apr  1 13:47 'mtp:host=%5Busb%3A001%2C006%5D'
-rw-rw-r--  1 bhavy bhavy 32768 Apr  1 13:50 'mtp:host=%5Busb%3A001%2C006%5D-96429231.log'
-rw-------  1 bhavy bhavy  1904 Mar 17 14:49 'mtp:host=%5Busb%3A001%2C008%5D'
-rw-rw-r--  1 bhavy bhavy 32768 Mar 17 14:49 'mtp:host=%5Busb%3A001%2C008%5D-1ef4e927.log'
-rw-------  1 bhavy bhavy   988 Jan  3  2018 'mtp:host=%5Busb%3A001%2C019%5D'
-rw-rw-r--  1 bhavy bhavy 32768 Jan  3  2018 'mtp:host=%5Busb%3A001%2C019%5D-295b34d0.log'
-rw-------  1 root  root  23428 Apr 20  2018  root
-rw-r--r--  1 root  root  32768 Apr 20  2018  root-a7cd5a51.log
-rw-------  1 bhavy bhavy   528 Oct 16  2019 'sftp:host=172.27.28.229,user=jatindev'
-rw-rw-r--  1 bhavy bhavy 32768 Oct 16  2019 'sftp:host=172.27.28.229,user=jatindev-50511b70.log'
-rw-------  1 bhavy bhavy   360 Jun 28  2018  uuid-13F2-1B57
-rw-rw-r--  1 bhavy bhavy 32768 Jun 28  2018  uuid-13F2-1B57-ef6bea9f.log
-rw-------  1 bhavy bhavy   152 Dec 15  2017  uuid-15F6-1853
-rw-rw-r--  1 bhavy bhavy 32768 Dec 15  2017  uuid-15F6-1853-dd280f53.log
-rw-------  1 bhavy bhavy   168 Feb  5  2019  uuid-1CB5-2250
-rw-rw-r--  1 bhavy bhavy 32768 Feb  5  2019  uuid-1CB5-2250-57328334.log
-rw-------  1 bhavy bhavy  3652 Oct 14  2019  uuid-2E18-2B51
-rw-rw-r--  1 bhavy bhavy 32768 Oct 14  2019  uuid-2E18-2B51-148fcb14.log
-rw-------  1 bhavy bhavy  7444 Jan  1  2019  uuid-70F1-3FAB
-rw-rw-r--  1 bhavy bhavy 32768 Jan  1  2019  uuid-70F1-3FAB-80580a55.log
-rw-------  1 bhavy bhavy  3036 Mar  4  2018  uuid-858A-D414
-rw-rw-r--  1 bhavy bhavy 32768 Mar  4  2018  uuid-858A-D414-6d31293d.log
-rw-------  1 bhavy bhavy   716 Aug  6  2018  uuid-CC63-C4D1
-rw-rw-r--  1 bhavy bhavy 32768 Aug  6  2018  uuid-CC63-C4D1-86f630c5.log

编辑 3:分配交换内存并更改 gvfs-metadata 所有权后输出free -h

              total        used        free      shared  buff/cache   available
Mem:           7.6G        2.1G        3.0G        221M        2.5G        5.1G
Swap:          4.0G          0B        4.0G

输出ls -al /home/bhavy/.local/share/gvfs-metadata/

total 716
drwx------  2 bhavy bhavy  4096 Jun  7 20:12  .
drwx------ 37 bhavy bhavy  4096 Jun  7 20:12  ..
-rw-------  1 bhavy bhavy 90096 Apr 14  2018  home
-rw-r--r--  1 bhavy bhavy 32768 Jun  7 20:12  home-520671b4.log
-rw-------  1 bhavy bhavy 95220 Jun  7 20:12  home.AQPML0
-rw-------  1 bhavy bhavy  1068 May 10  2018 'mtp:host=%5Busb%3A001%2C004%5D'
-rw-rw-r--  1 bhavy bhavy 32768 May 10  2018 'mtp:host=%5Busb%3A001%2C004%5D-ea794164.log'
-rw-------  1 bhavy bhavy   892 Apr  1 13:47 'mtp:host=%5Busb%3A001%2C006%5D'
-rw-rw-r--  1 bhavy bhavy 32768 Apr  1 13:50 'mtp:host=%5Busb%3A001%2C006%5D-96429231.log'
-rw-------  1 bhavy bhavy  1904 Mar 17 14:49 'mtp:host=%5Busb%3A001%2C008%5D'
-rw-rw-r--  1 bhavy bhavy 32768 Mar 17 14:49 'mtp:host=%5Busb%3A001%2C008%5D-1ef4e927.log'
-rw-------  1 bhavy bhavy   988 Jan  3  2018 'mtp:host=%5Busb%3A001%2C019%5D'
-rw-rw-r--  1 bhavy bhavy 32768 Jan  3  2018 'mtp:host=%5Busb%3A001%2C019%5D-295b34d0.log'
-rw-------  1 root  root  23428 Apr 20  2018  root
-rw-r--r--  1 root  root  32768 Apr 20  2018  root-a7cd5a51.log
-rw-------  1 bhavy bhavy   528 Oct 16  2019 'sftp:host=172.27.28.229,user=jatindev'
-rw-rw-r--  1 bhavy bhavy 32768 Oct 16  2019 'sftp:host=172.27.28.229,user=jatindev-50511b70.log'
-rw-------  1 bhavy bhavy   360 Jun 28  2018  uuid-13F2-1B57
-rw-rw-r--  1 bhavy bhavy 32768 Jun 28  2018  uuid-13F2-1B57-ef6bea9f.log
-rw-------  1 bhavy bhavy   152 Dec 15  2017  uuid-15F6-1853
-rw-rw-r--  1 bhavy bhavy 32768 Dec 15  2017  uuid-15F6-1853-dd280f53.log
-rw-------  1 bhavy bhavy   168 Feb  5  2019  uuid-1CB5-2250
-rw-rw-r--  1 bhavy bhavy 32768 Feb  5  2019  uuid-1CB5-2250-57328334.log
-rw-------  1 bhavy bhavy  3652 Oct 14  2019  uuid-2E18-2B51
-rw-rw-r--  1 bhavy bhavy 32768 Oct 14  2019  uuid-2E18-2B51-148fcb14.log
-rw-------  1 bhavy bhavy  7444 Jan  1  2019  uuid-70F1-3FAB
-rw-rw-r--  1 bhavy bhavy 32768 Jan  1  2019  uuid-70F1-3FAB-80580a55.log
-rw-------  1 bhavy bhavy  3036 Mar  4  2018  uuid-858A-D414
-rw-rw-r--  1 bhavy bhavy 32768 Mar  4  2018  uuid-858A-D414-6d31293d.log
-rw-------  1 bhavy bhavy   716 Aug  6  2018  uuid-CC63-C4D1
-rw-rw-r--  1 bhavy bhavy 32768 Aug  6  2018  uuid-CC63-C4D1-86f630c5.log

答案1

交换

您没有交换,如 所示free -h

              total        used        free      shared  buff/cache   available
Mem:           7.6G        2.7G        1.4G        268M        3.5G        4.3G
Swap:            0B          0B          0B

我们将创建一个 4 GB 的/swapfile

笔记:命令使用不当dd可能会导致数据丢失。我建议复制/粘贴。

sudo swapoff -a           # turn off swap
sudo rm -i /swapfile      # remove old /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

sudo chmod 600 /swapfile  # set proper file protections
sudo mkswap /swapfile     # init /swapfile
sudo swapon /swapfile     # turn on swap
free -h                   # confirm 8G RAM and 4G swap

将此行添加到/etc/fstab

/swapfile    none    swap    sw      0   0

然后重新启动并验证交换操作是否正确。

gvfs 元数据

您已开始nautilus使用。从终端以 root 身份启动 GUI 应用程序时,sudo您应该使用。sudo -H

sudo chown $USER:$USER /home/$USER/.local/share/gvfs-metadata/home*

sudo chmod 664 /home/$USER/.local/share/gvfs-metadata/home*.log

sudo rm -i /home/$USER/.local/share/gvfs-metadata/root*

桌面图标

重新安装缺失的 gnome-shell 扩展:

sudo apt update

sudo apt install gnome-shell-extension-desktop-icons

https://extensions.gnome.org/local/启用/配置桌面图标

〜/.缓存

我们发现文件夹损坏~/.cache。重新创建了一个新文件夹,Files现在可以正常工作。

相关内容