Debian

無法以 root 身份編輯 sources.list

  • February 4, 2017

sources.list儘管是 root,但我無法編輯/移動/刪除文件。當我這樣做時ls -la /etc/apt,它會報告:

root@nibelung:~# ls -la /etc/apt/
total 356
drwxr-xr-x   6 root root   4096 Feb 28 21:30 .
drwxrwxr-x 100 root root   4096 Feb 28 01:29 ..
-rw-r--r--   1 root root     98 Aug 24  2013 apt.conf
drwxr-xr-x   2 root root   4096 Feb 27 14:04 apt.conf.d
-rw-r--r--   1 root root    123 Feb 28 01:52 preferences
drwxr-xr-x   2 root root   4096 Feb 27 21:01 preferences.d
-rw-------   1 root root      0 Aug 24  2013 secring.gpg
-rw-r--r--   1 root root    878 Jan 24 19:30 sources.list
-rw-r--r--   1 root root      0 Sep 27 02:00 sources.list~
-rw-r--r--   1 root root    878 Feb 28 21:30 sources.list.bk
drwxr-xr-x   2 root root   4096 Feb 27 21:01 sources.list.d
-rw-------   1 root root   1200 Jan 24 15:03 trustdb.gpg
-rw-------   1 root root 158664 Jan 24 15:03 trusted.gpg
-rw-------   1 root root 158664 Jan 24 15:03 trusted.gpg~
drwxr-xr-x   2 root root   4096 Apr 15  2011 trusted.gpg.d

當您嘗試編輯它時,會發生什麼?你得到什麼錯誤?

首先要看的東西:

  • 文件系統是否以只讀方式安裝?(檢查mount
  • 文件是不可變的嗎?(檢查lsattr sources.list;如果已設置+i,則chattr -i sources.list

引用自:https://unix.stackexchange.com/questions/117535