USB上的Linux Mint-mtab是文件夾,而不是文件


0

我剛剛使用uNetbootin(http://sourceforge.net/projects/unetbootin/)將Linux Mint Maya(13.2)安裝到USB記憶棒上。安裝似乎可以正常進行,並且具有"持久性"分區,該分區允許更改在會話之間持久化。

很奇怪的一件事是我無法執行df來查看可用空間:

$ df -h
df: cannot read table of mounted file systems: Is a directory 

我認為它正在談論/etc/mtab,確實,當我查看mtab時,我看到它不是文件,而是目錄:

$ ls -l /etc
....
-rw-r--r-- 1 root root      63 Jul 29 13:16 fstab
drwxr-xr-x 2 root root       3 Mar 30  2012 fstab.d
....
drwxr-xr-x 2 root root    4096 Jul 29 12:03 mtab
-rw------- 1 root mint       0 Jul 29 11:43 mtab.fuselock
....

(我剛剛列出了我認為相關的條目)。當我查看/etc/ls -l mtab時,有很多鏈接:

$ ls -l /etc/mtab
total 0
lrwxrwxrwx 1 root root 18 Jul 29 11:29 ex -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 28 Jul 29 11:29 ex.1.gz -> /usr/share/man/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 ex.fr.1.gz -> /usr/share/man/fr/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 ex.it.1.gz -> /usr/share/man/it/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 ex.pl.1.gz -> /usr/share/man/pl/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 ex.ru.1.gz -> /usr/share/man/ru/man1/vim.1.gz
lrwxrwxrwx 1 root root 14 Jul 29 12:03 gnome-text-editor -> /usr/bin/gedit
lrwxrwxrwx 1 root root 30 Jul 29 12:03 gnome-text-editor.1.gz -> /usr/share/man/man1/gedit.1.gz
lrwxrwxrwx 1 root root 29 Jul 29 11:42 gnome-www-browser -> /usr/bin/google-chrome-stable
lrwxrwxrwx 1 root root 29 Jul 29 11:42 google-chrome -> /usr/bin/google-chrome-stable
lrwxrwxrwx 1 root root 18 Jul 29 11:28 rview -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 18 Jul 29 11:28 rvim -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 18 Jul 29 11:28 vi -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 28 Jul 29 11:28 vi.1.gz -> /usr/share/man/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:28 vi.fr.1.gz -> /usr/share/man/fr/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:28 vi.it.1.gz -> /usr/share/man/it/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:28 vi.pl.1.gz -> /usr/share/man/pl/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:28 vi.ru.1.gz -> /usr/share/man/ru/man1/vim.1.gz
lrwxrwxrwx 1 root root 18 Jul 29 11:29 view -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 28 Jul 29 11:29 view.1.gz -> /usr/share/man/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 view.fr.1.gz -> /usr/share/man/fr/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 view.it.1.gz -> /usr/share/man/it/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 view.pl.1.gz -> /usr/share/man/pl/man1/vim.1.gz
lrwxrwxrwx 1 root root 31 Jul 29 11:29 view.ru.1.gz -> /usr/share/man/ru/man1/vim.1.gz
lrwxrwxrwx 1 root root 18 Jul 29 11:28 vim -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 18 Jul 29 11:28 vimdiff -> /usr/bin/vim.basic
lrwxrwxrwx 1 root root 29 Jul 29 11:42 x-www-browser -> /usr/bin/google-chrome-stable

fstab似乎很正常,FWIW。

$ cat /etc/fstab
overlayfs / overlayfs rw 0 0
tmpfs /tmp tmpfs nosuid,nodev 0 0

有人知道

1)這裡的mtab怎麼了?

2)如何在不中斷USB安裝的情況下進行修復(這花了我很長時間才能完成工作)

謝謝!最大

編輯:(太無聊了,不能發表評論)這是對@Celada的回答的回應,指出/etc/mtab看起來好像持有/etc/alternatives的內容:是的,確實如此!

/etc/alternatives也在那裡,並且具有/etc/mtab中的所有內容,以及更多內容。(我已經通過將內容複製到數組中並從另一個中減去一個進行了檢查)。

查看/etc/mtab的內容,其中的所有行均表示自首次啟動USB棒安裝以來我安裝的軟件:vim(完整版本,而不是安裝隨附的"迷你"版本)和/etc/mtab1(文本編輯器)。正如我所說的,這些行也都在/etc/alternatives中。

我已完成以下操作:

$ sudo mv /etc/mtab /etc/mtab_BACK
$ sudo ln -s /proc/mounts /etc/mtab

現在我可以再次進行DF:

$ df -h
df: `/cow': No such file or directory
df: `/home/max/.gvfs': Transport endpoint is not connected
Filesystem      Size  Used Avail Use% Mounted on
rootfs          4.0G  872M  2.9G  23% /
udev            1.2G  4.0K  1.2G   1% /dev
tmpfs           465M  984K  464M   1% /run
/dev/sdb1        15G  5.0G  9.8G  34% /cdrom
/dev/loop0      869M  869M     0 100% /rofs
/cow            4.0G  872M  2.9G  23% /
tmpfs           1.2G   16K  1.2G   1% /tmp
none            5.0M     0  5.0M   0% /run/lock
none            1.2G  144K  1.2G   1% /run/shm

頂部的錯誤消息令人困惑:列出了/etc/mtab3(這是我認為的持久性分區),但錯誤顯示為/etc/mtab4。您認為這是一個問題嗎?

1

The file listing of /etc/mtab appears to belong to /etc/alternatives! Is there any way you could have accidentally renamed /etc/alternatives to /etc/mtab?

Is /etc/alternatives missing? If so, then the fix is just to rename /etc/mtab back to /etc/alternatives. If not, then you are stuck with the problem of merging the contents of the real /etc/alternatives with the /etc/mtab which is supposed to be /etc/alternatives.

Once /etc/mtab is moved out of the way, the easiest thing to do would be to just recreate it as a symlink to /proc/mounts:

ln -s /proc/mounts /etc/mtab