内核文件不小心删除了,电脑启动不起来了

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
wly343910751
帖子: 43
注册时间: 2009-05-08 20:55

Re: 内核文件不小心删除了,电脑启动不起来了

#16

帖子 wly343910751 » 2014-03-04 0:17

poloshiao 写了:
你底下有叫卸载/sys,之前也没挂载这个啊?
掛載
7. sudo mount --bind /sys /mnt/sys
卸載
16. sudo umount /sys
grep: /proc/cpuinfo: No such file or directory
在下面這個指令後面
6. sudo mount --bind /proc /mnt/proc
6-1. 先執行
sudo ls -al /proc/cpuinfo
看看有沒有這個檔案
6-2. 如果有 執行下面這個指令
sudo cp -af /proc/cpuinfo /mnt/proc
最好是3.2.0-23版本的
apt-get install --reinstall linux-image-3.11.0-17-generic
你爲何一下要從 3.2.0-23 跳到 3.11.0-17
目前 12.04 的核心 最大也是 3.2.0.59.70
要超過這個版本 必須另外安裝 LTSEnablementStack
https://wiki.ubuntu.com/Kernel/LTSEnablementStack
所以建議你 安裝 3.2.0-23 或 原來已經安裝的版本 讓問題 單純化
試試
/bin/df: ‘/sys/fs/cgroup’: No such file or directory
... 以下省略
這個問題 等上面的問題解決了 再看看會不會再出現
apt-get install --reinstall linux-generic
你既然已經直接安裝 linux-image 及 linux-headers 就不必再安裝這個

下面貼文 可以提供更多的建議 你可以參考看看 我上面提供的程序 還缺少什麼
http://askubuntu.com/questions/28099/ho ... ll-kernels
http://askubuntu.com/questions/337379/a ... old-kernel

如果問題還沒解決 建議你全新安裝 Ubuntu 12.04 或 Ubuntu 14.04 比較快
如果 /dev/sda8 有重要檔案 可以先從上面掛載的 /mnt 資料夾 複製出來 備存
版本是这样的,运行时他说不符合正则表达式,命令行里提示的一个版本,而且我虽然拿的是12.04的盘,但是我电脑装过12.04之后,后来自动升级到了13.10了。
我不太想重新装,毕竟系统装了部分软件,当时配置也花了不少时间
现在貌似出现我删除内核文件之前的一个尴尬问题,输出结果如下。我的/boot单独设置了一个200多M的空间,因为经常升级内核版本,所以占用了很多空间,之前没升级到13.10的时候,我是用tweak里的清除内核的功能,但是不知道为什么升级到13.10后,tweak不能正常清理,我就直接到这个文件夹下,手动删除,但是就出现文件已删,已用空间减少不多,现在的问题好像也是空间不够

apt-get install --reinstall linux-image-3.11.0-17-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
account-plugin-windows-live gnome-contacts gstreamer1.0-nice guile-2.0-libs
libfarstream-0.2-2 libgc1c2 libtelepathy-farstream3 linux-headers-3.11.0-12
linux-headers-3.11.0-12-generic linux-image-3.11.0-12-generic
linux-image-3.8.0-31-generic linux-image-extra-3.11.0-12-generic
linux-image-extra-3.8.0-31-generic signon-plugin-password
Use 'apt-get autoremove' to remove them.
Suggested packages:
fdutils linux-doc-3.11.0 linux-source-3.11.0 linux-tools
The following NEW packages will be installed:
linux-image-3.11.0-17-generic
0 upgraded, 1 newly installed, 0 to remove and 262 not upgraded.
6 not fully installed or removed.
Need to get 0 B/14.4 MB of archives.
After this operation, 39.8 MB of additional disk space will be used.
Can not write log, openpty() failed (/dev/pts not mounted?)
(Reading database ... 458744 files and directories currently installed.)
Unpacking linux-image-3.11.0-17-generic (from .../linux-image-3.11.0-17-generic_3.11.0-17.31_amd64.deb) ...
Done.
dpkg: error processing /var/cache/apt/archives/linux-image-3.11.0-17-generic_3.11.0-17.31_amd64.deb (--unpack):
cannot copy extracted data for './boot/vmlinuz-3.11.0-17-generic' to '/boot/vmlinuz-3.11.0-17-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.11.0-17-generic /boot/vmlinuz-3.11.0-17-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.11.0-17-generic /boot/vmlinuz-3.11.0-17-generic
Errors were encountered while processing:
/var/cache/apt/archives/linux-image-3.11.0-17-generic_3.11.0-17.31_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 内核文件不小心删除了,电脑启动不起来了

#17

帖子 poloshiao » 2014-03-04 6:11

后来自动升级到了13.10了。
所以你需要使用 Ubuntu 13.10 Live CD/DVD/USB
不能使用 Ubuntu 12.04.x Live CD/DVD/USB
才可避免版本不相容的問題
不知道为什么升级到13.10后,tweak不能正常清理
網路上 有許多 gnome tweak 在 Ubuntu 13.10 會引起 crash 的 bug report
https://bugs.launchpad.net/ubuntu-tweak
所以暫時不要使用它
我就直接到这个文件夹下,手动删除,但是就出现文件已删
從你在
viewtopic.php?p=3064905#p3064905
的錯誤訊息
有可能你還刪除了一些 /boot 分割區以外的文件
现在的问题好像也是空间不够
cannot copy extracted data for './boot/vmlinuz-3.11.0-17-generic' to '/boot/vmlinuz-3.11.0-17-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
可能是 /boot 空間不夠
也有可能是 / 空間不夠
也有可能是 其它暫時目錄 空間不夠
從終端機
1. sudo df /dev/sda6 # /boot
2. sudo df /dev/sda8 # /
把結果直接複製 貼上來
看看 /dev/sda8 空間還有多少
能否直接把 /boot 暫時 併入 /dev/sda8
這是比較簡單的暫時解決方法
wly343910751
帖子: 43
注册时间: 2009-05-08 20:55

Re: 内核文件不小心删除了,电脑启动不起来了

#18

帖子 wly343910751 » 2014-03-04 22:47

首先非常感谢您的耐心专业的回答,这是我第一次感受ubuntu的开源精神,对学习ubuntu也感觉分外有劲。下面我在把我电脑里的一些问题再跟您反馈一下
所以你需要使用 Ubuntu 13.10 Live CD/DVD/USB
不能使用 Ubuntu 12.04.x Live CD/DVD/USB
才可避免版本不相容的問題
因为当时我也是直接升级的,所以现在暂时也没有Ubuntu 13.10 Live CD/DVD/USB.直接安装3.2.0-23也好像不行。
apt-get install --reinstall linux-image-3.2.0-23-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reinstallation of linux-image-3.2.0-23-generic is not possible, it cannot be downloaded.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
linux-image-extra-3.11.0-17-generic : Depends: linux-image-3.11.0-17-generic but it is not going to be installed
linux-image-generic : Depends: linux-image-3.11.0-17-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
從你在
viewtopic.php?p=3064905#p3064905
的錯誤訊息
有可能你還刪除了一些 /boot 分割區以外的文件
这个我就不太清楚,如果单从我的操作来看,因为我当时是直接在图形界面上用鼠标把所有的内核文件删掉的,没删其他东西,当时就出现文件删除空间没减小的现象。
可能是 /boot 空間不夠
也有可能是 / 空間不夠
也有可能是 其它暫時目錄 空間不夠
從終端機
1. sudo df /dev/sda6 # /boot
2. sudo df /dev/sda8 # /
把結果直接複製 貼上來
看看 /dev/sda8 空間還有多少
能否直接把 /boot 暫時 併入 /dev/sda8
這是比較簡單的暫時解決方法
/boot空间不足,里面基本上没有什么文件,不知道为什么,运行结果如下:
ubuntu@ubuntu:/$ sudo df /dev/sda6 # /boot
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda6 318769 318768 0 100% /mnt/boot
ubuntu@ubuntu:/$ cd /boot
ubuntu@ubuntu:/boot$ ls
abi-3.2.0-23-generic grub memtest86+_multiboot.bin
config-3.2.0-23-generic memtest86+.bin System.map-3.2.0-23-generic

ubuntu@ubuntu:/boot$ sudo df /dev/sda8 # /boot
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda8 233766280 28765860 193298252 13% /mnt

我是想最好不要把/boot并入/,因为对于ubuntu我是初学者,这些操作我都不太熟悉,我怕出的问题更多。
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 内核文件不小心删除了,电脑启动不起来了

#19

帖子 poloshiao » 2014-03-04 23:30

Reinstallation of linux-image-3.2.0-23-generic is not possible, it cannot be downloaded.
因爲你已升級 13.10
Ubuntu 13.10 的套件庫 已經沒有 3.2.0-23-generic 版本
The following packages have unmet dependencies:
linux-image-extra-3.11.0-17-generic : Depends: linux-image-3.11.0-17-generic but it is not going to be installed
linux-image-generic : Depends: linux-image-3.11.0-17-generic but it is not going to be installed
因爲前面 linux-image-3.11.0-17-generic 沒有安裝成功
linux-image-extra-3.11.0-17-generic 及 linux-image-generic 都相依於 linux-image-3.11.0-17-generic
所以也無法安裝
我当时是直接在图形界面上用鼠标把所有的内核文件删掉的,没删其他东西
Ubuntu 的套件 彼此之間 常常 有相依關係
當你安裝某一個套件的時候 會檢查其所有遞廻相依套件是否已安裝 如果有還沒安裝的 會一起安裝 如果無法安裝某些遞廻相依套件 該套件就放棄安裝
當你移除某一個套件的時候 會檢查所有遞廻相依於該套件的套件是否有其他替代套件可以相依 如果沒有 會一起移除
所以避免在圖形界面移除系統套件 不小心 會移除一些其他套件 儘量使用文字指令移除套件 它會出現警告訊息 提醒你注意
sudo df /dev/sda6
/dev/sda6 318769 318768 0 100% /mnt/boot
sudo df /dev/sda8
/dev/sda8 233766280 28765860 193298252 13% /mnt
你的 /boot 確實已經滿了
cd /boot
ls
abi-3.2.0-23-generic grub memtest86+_multiboot.bin
config-3.2.0-23-generic memtest86+.bin System.map-3.2.0-23-generic
所有的開機檔案 都已經被你移除了
如果能夠把 /boot 併入 / 也沒有開機檔案

還是建議你重新規劃分割方案
全新安裝
解決問題比較容易

如果你還是希望救救看
我再找找看
有沒有其它方案
明天給你意見
wly343910751
帖子: 43
注册时间: 2009-05-08 20:55

Re: 内核文件不小心删除了,电脑启动不起来了

#20

帖子 wly343910751 » 2014-03-05 18:58

如果你還是希望救救看
我再找找看
有沒有其它方案
明天給你意見
好的,我还是比较偏向于保留原来的不重新安装。
还有这个/boot文件夹非常奇怪,这个容量曾经同时安装有十几个版本的内核文件,现在一个也不够,而且未删除的文件加总起来也不超过几M.
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 内核文件不小心删除了,电脑启动不起来了

#21

帖子 poloshiao » 2014-03-05 19:23

还有这个/boot文件夹非常奇怪,这个容量曾经同时安装有十几个版本的内核文件,现在一个也不够,而且未删除的文件加总起来也不超过几M.
看看有沒有 隱藏性檔案 及 回收桶 檔案
sudo ls -alR /boot

說明
-a : 連同隱藏性檔案一起顯示出來
-l : 顯示出明細
-R : 遞廻顯示所有的子目錄及文件
wly343910751
帖子: 43
注册时间: 2009-05-08 20:55

Re: 内核文件不小心删除了,电脑启动不起来了

#22

帖子 wly343910751 » 2014-03-05 21:57

sudo ls -alR /boot

說明
-a : 連同隱藏性檔案一起顯示出來
-l : 顯示出明細
-R : 遞廻顯示所有的子目錄及文件
我查了一下出来了好多东西,摘抄了一部分输出结果
/mnt/.Trash-0/info:
total 67
drwx------ 2 root root 5120 Mar 4 14:08 .
drwx------ 4 root root 1024 May 25 2013 ..
-rw-r--r-- 1 root root 73 Jan 5 08:58 abi-3.11.0-12-generic.trashinfo
-rw-r--r-- 1 root root 73 Jan 5 08:58 abi-3.11.0-13-generic.trashinfo
-rw-r--r-- 1 root root 73 Jan 5 09:25 abi-3.11.0-14-generic.trashinfo
-rw-r--r-- 1 root root 72 Jan 5 08:49 abi-3.2.0-23-generic.trashinfo
-rw-r--r-- 1 root root 72 Dec 14 07:01 abi-3.2.0-51-generic.trashinfo
-rw-r--r-- 1 root root 72 Dec 14 07:01 abi-3.2.0-52-generic.trashinfo
-rw-r--r-- 1 root root 72 Dec 14 07:01 abi-3.2.0-53-generic.trashinfo
-rw-r--r-- 1 root root 72 Jan 5 08:49 abi-3.2.0-54-generic.trashinfo
-rw-r--r-- 1 root root 79 Mar 1 17:01 abi-3.2 (copy).0-23-generic.trashinfo
-rw-r--r-- 1 root root 72 Dec 14 07:13 abi-3.5.0-41-generic.trashinfo
-rw-r--r-- 1 root root 72 Dec 14 07:13 abi-3.8.0-31-generic.trashinfo
-rw-r--r-- 1 root root 76 Jan 5 08:58 config-3.11.0-12-generic.trashinfo
-rw-r--r-- 1 root root 76 Jan 5 08:58 config-3.11.0-13-generic.trashinfo
-rw-r--r-- 1 root root 76 Jan 5 09:25 config-3.11.0-14-generic.trashinfo
-rw-r--r-- 1 root root 75 Jan 5 08:49 config-3.2.0-23-generic.trashinfo
-rw-r--r-- 1 root root 75 Dec 14 07:02 config-3.2.0-51-generic.trashinfo
-rw-r--r-- 1 root root 75 Dec 14 07:02 config-3.2.0-52-generic.trashinfo
-rw-r--r-- 1 root root 75 Dec 14 07:02 config-3.2.0-53-generic.trashinfo
-rw-r--r-- 1 root root 75 Jan 5 08:49 config-3.2.0-54-generic.trashinfo
-rw-r--r-- 1 root root 82 Mar 1 17:01 config-3.2 (copy).0-23-generic.trashinfo
-rw-r--r-- 1 root root 75 Jan 5 08:52 config-3.5.0-41-generic.trashinfo
-rw-r--r-- 1 root root 75 Jan 5 08:52 config-3.8.0-31-generic.trashinfo
-rw-r--r-- 1 root root 64 May 25 2013 grub backup.trashinfo
-rw-r--r-- 1 root root 65 Jan 5 08:48 grub backup.trashinfo
-rw-r--r-- 1 root root 75 Jan 5 09:13 grub .cfg.backup.trashinfo
-rw-r--r-- 1 root root 80 Dec 14 07:14 initrd.img-3.11.0-12-generic.trashinfo
-rw-r--r-- 1 root root 80 Jan 5 08:58 initrd.img-3.11.0-13-generic.trashinfo
-rw-r--r-- 1 root root 80 Jan 5 09:25 initrd.img-3.11.0-14-generic.trashinfo
-rw-r--r-- 1 root root 79 Jan 5 08:49 initrd.img-3.2.0-23-generic.trashinfo
-rw-r--r-- 1 root root 79 Dec 14 07:02 initrd.img-3.2.0-51-generic.trashinfo
-rw-r--r-- 1 root root 79 Dec 14 07:02 initrd.img-3.2.0-52-generic.trashinfo
-rw-r--r-- 1 root root 79 Dec 14 07:02 initrd.img-3.2.0-53-generic.trashinfo
-rw-r--r-- 1 root root 79 Dec 14 07:13 initrd.img-3.2.0-54-generic.trashinfo
-rw-r--r-- 1 root root 79 Dec 14 07:13 initrd.img-3.5.0-41-generic.trashinfo
-rw-r--r-- 1 root root 79 Dec 14 07:14 initrd.img-3.8.0-31-generic.trashinfo
-rw-r--r-- 1 root root 120 Mar 4 14:04 linux-image-3.2.0-23-generic-pae_3.2.0-23.36_i386 (another copy).deb.trashinfo
-rw-r--r-- 1 root root 0 Mar 4 14:04 linux-image-3.2.0-23-generic-pae_3.2.0-23.36_i386 (copy).deb.trashinfo
-rw-r--r-- 1 root root 105 Mar 4 14:08 linux-image-3.2.0-23-generic-pae_3.2.0-23.36_i386.deb.trashinfo
-rw-r--r-- 1 root root 105 Mar 4 14:08 linux-image-3.2.0-23-generic-pae_3.2.0-23.36_i516.deb.trashinfo
-rw-r--r-- 1 root root 73 Mar 1 17:01 memtest86+ (copy).bin.trashinfo
-rw-r--r-- 1 root root 83 Mar 1 17:01 memtest86+_multiboot (copy).bin.trashinfo
-rw-r--r-- 1 root root 80 Dec 14 07:31 System.map-3.11.0-12-generic.trashinfo
-rw-r--r-- 1 root root 80 Dec 14 07:31 System.map-3.11.0-13-generic.trashinfo
-rw-r--r-- 1 root root 80 Jan 5 09:24 System.map-3.11.0-14-generic.trashinfo
-rw-r--r-- 1 root root 79 Jan 5 08:50 System.map-3.2.0-23-generic.trashinfo
-rw-r--r-- 1 root root 79 Jan 5 08:50 System.map-3.2.0-51-generic.trashinfo
-rw-r--r-- 1 root root 79 Dec 14 07:31 System.map-3.2.0-52-generic.trashinfo
-rw-r--r-- 1 root root 79 Dec 14 07:31 System.map-3.2.0-53-generic.trashinfo
-rw-r--r-- 1 root root 79 Dec 14 07:31 System.map-3.2.0-54-generic.trashinfo
-rw-r--r-- 1 root root 86 Mar 1 17:01 System.map-3.2 (copy).0-23-generic.trashinfo
-rw-r--r-- 1 root root 79 Dec 14 07:31 System.map-3.5.0-41-generic.trashinfo
-rw-r--r-- 1 root root 79 Dec 14 07:31 System.map-3.8.0-31-generic.trashinfo
-rw-r--r-- 1 root root 77 Jan 5 08:59 vmlinuz-3.11.0-12-generic.trashinfo
-rw-r--r-- 1 root root 77 Jan 5 08:59 vmlinuz-3.11.0-13-generic.trashinfo
-rw-r--r-- 1 root root 77 Jan 5 09:24 vmlinuz-3.11.0-14-generic.trashinfo
-rw-r--r-- 1 root root 76 Jan 5 08:50 vmlinuz-3.2.0-23-generic.trashinfo
-rw-r--r-- 1 root root 76 Jan 5 08:50 vmlinuz-3.2.0-51-generic.trashinfo
-rw-r--r-- 1 root root 76 Jan 5 08:50 vmlinuz-3.2.0-52-generic.trashinfo
-rw-r--r-- 1 root root 76 Jan 5 08:50 vmlinuz-3.2.0-53-generic.trashinfo
-rw-r--r-- 1 root root 76 Jan 5 08:50 vmlinuz-3.2.0-54-generic.trashinfo
-rw-r--r-- 1 root root 76 Jan 5 08:52 vmlinuz-3.5.0-41-generic.trashinfo
-rw-r--r-- 1 root root 76 Jan 5 08:52 vmlinuz-3.8.0-31-generic.trashinfo
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 内核文件不小心删除了,电脑启动不起来了

#23

帖子 poloshiao » 2014-03-05 22:15

cd /boot
ls
abi-3.2.0-23-generic grub memtest86+_multiboot.bin
config-3.2.0-23-generic memtest86+.bin System.map-3.2.0-23-generic
下面那2行可以執行 也可以不執行
sudo ls -alR /boot
我查了一下出来了好多东西,摘抄了一部分输出结果
-rw-r--r-- 1 root root 73 Jan 5 08:58 abi-3.11.0-12-generic.trashinfo
...以下略[/quote]
這些都是 root:root 權限
ls 不會列出來
sudo ls 才會列出來
.Trash-0
root 使用者的回收桶 (使用 sudo rm 移除)
.Trash-1000
普通使用者的回收桶 (使用 rm 移除)

所以經常要清空回收桶 以便回收磁盤空間再使用
wly343910751
帖子: 43
注册时间: 2009-05-08 20:55

Re: 内核文件不小心删除了,电脑启动不起来了

#24

帖子 wly343910751 » 2014-03-05 22:33

所以經常要清空回收桶 以便回收磁盤空間再使用
这些文件可以恢复吗,这些文件不就是我删除的内核文件?
如果删除,直接在终端输sudo rm就行了吗?
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 内核文件不小心删除了,电脑启动不起来了

#25

帖子 poloshiao » 2014-03-05 23:02

这些文件可以恢复吗,这些文件不就是我删除的内核文件?
看看還在不在
1. 普通使用者刪除的回收桶
/mnt/home/username/.local/share/Trash/files
2. root 權限刪除的回收桶
/mnt/root/.local/share/Trash/files
3. 參考
http://askubuntu.com/questions/54692/ho ... ng-as-root
/mnt/.Trash-0/info
扣除 /mnt
相當於回收桶在根目錄 ? 有點少見
如果你確定這個沒錯
找找 /mnt/.Trash-0/files
sudo ls -alR /mnt/.Trash-0/files
看看有沒有 被刪除了檔案

補充
Ubuntu 每個版本 存放回收桶的 位置路徑 不一定相同
sudo ls -alR /mnt | grep Trash 可以幫你 統統找出來
記得 /dev/sda6 /dev/sda8 要先掛載起來
如果删除,直接在终端输sudo rm就行了吗?
暫時不要刪除回收桶裏的東東
等你的問題解決了 再來討論如何刪除回收桶的東東
wly343910751
帖子: 43
注册时间: 2009-05-08 20:55

Re: 内核文件不小心删除了,电脑启动不起来了

#26

帖子 wly343910751 » 2014-03-06 22:59

Ubuntu 每個版本 存放回收桶的 位置路徑 不一定相同
sudo ls -alR /mnt | grep Trash 可以幫你 統統找出來
記得 /dev/sda6 /dev/sda8 要先掛載起來
暫時不要刪除回收桶裏的東東
等你的問題解決了 再來討論如何刪除回收桶的東東
非常感谢,已经解决。之前之所以在那个目录下是因为我直接把/dev/sda6直接挂载在/mnt下的,我是在/boot/.trash-0/files里找到之前删除的内核文件,把这些文件复制出来就搞定了。
pyromania
帖子: 31
注册时间: 2005-08-07 0:27

Re: 内核文件不小心删除了,电脑启动不起来了

#27

帖子 pyromania » 2014-10-18 23:16

chroot 后 如何上网。内核删的比较彻底,直接reinstall不行
回复