rm: cannot remove `/var/lib/dpkg/lock': Read-only file system 修复磁盘并成功启动

为了解药所一个rar文件,我按照unrar:

但是因为寝室网络不给力,所以造成以下的奇怪报错:


root@ubuntu:/home/zhangbin/sk_m# apt-get install unrar

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  unrar
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/107 kB of archives.
After this operation, 266 kB of additional disk space will be used.
Selecting previously unselected package unrar.
(Reading database ... 90%dpkg: unrecoverable fatal error, aborting:
 files list file for package 'texlive-base' is missing final newline

E: Sub-process /usr/bin/dpkg returned an error code (2)


网络的不给力,在更新的途中频繁反复的断网:导致

貌似还直接损坏了列表:

root@ubuntu:/home/zhangbin/sk_m# 
root@ubuntu:/home/zhangbin/sk_m# apt-get install unrar
Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/mirrors.163.com_ubuntu_dists_precise-


security_main_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.

root@ubuntu:/home/zhangbin/sk_m# 


更新一下列表:

root@ubuntu:/home/zhangbin/sk_m# apt-get update
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/

root@ubuntu:/home/zhangbin/sk_m# 



root@ubuntu:/home/zhangbin/sk_m# apt-get install unrar
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Unable to write to /var/cache/apt/

E: The package lists or status file could not be parsed or opened.


root@ubuntu:/home/zhangbin/sk_m# ls /var/lib/dpkg/lock
/var/lib/dpkg/lock
root@ubuntu:/home/zhangbin/sk_m# 
root@ubuntu:/home/zhangbin/sk_m# rm /var/lib/dpkg/lock
rm: cannot remove `/var/lib/dpkg/lock': Read-only file system
root@ubuntu:/home/zhangbin/sk_m# 
root@ubuntu:/home/zhangbin/sk_m# ls /var/lib/dpkg/lock

/var/lib/dpkg/lock



root@ubuntu:/home/zhangbin/sk_m# apt-get install unrar
W: Not using locking for read only lock file /var/lib/dpkg/lock
E: Unable to write to /var/cache/apt/
E: The package lists or status file could not be parsed or opened.
root@ubuntu:/home/zhangbin/sk_m# rm /var/lib/dpkg/lock

rm: cannot remove `/var/lib/dpkg/lock': Read-only file system


root@ubuntu:/home/zhangbin/sk_m# rm -f /var/lib/dpkg/lock
rm: cannot remove `/var/lib/dpkg/lock': Read-only file system
root@ubuntu:/home/zhangbin/sk_m# ls  /var/lib/dpkg/lock

/var/lib/dpkg/lock


root@ubuntu:/home/zhangbin/sk_m# file  /var/lib/dpkg/lock

/var/lib/dpkg/lock: empty


root@ubuntu:/home/zhangbin/sk_m# rm -rf   /var/lib/dpkg/lock

rm: cannot remove `/var/lib/dpkg/lock': Read-only file system


root@ubuntu:/home/zhangbin/sk_m# chmod +rwx   /var/lib/dpkg/lock

chmod: changing permissions of `/var/lib/dpkg/lock': Read-only file system


root@ubuntu:/home/zhangbin/sk_m# 


root@ubuntu:/home/zhangbin# mount
/dev/sda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
gvfs-fuse-daemon on /home/zhangbin/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=zhangbin)


mount: warning: /etc/mtab is not writable (e.g. read-only filesystem).

       It's possible that information reported by mount(8) is not
       up to date. For actual information about system mount points
       check the /proc/mounts file.


root@ubuntu:/home/zhangbin# 
root@ubuntu:/home/zhangbin# cat /proc/mounts
rootfs / rootfs rw 0 0

sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
udev /dev devtmpfs rw,relatime,size=505116k,nr_inodes=126279,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,relatime,size=204960k,mode=755 0 0
/dev/disk/by-uuid/83949f02-b628-4305-9594-52a50a82c8e4 / ext4 ro,relatime, errors=remount-


ro,user_xattr,barrier=1,data=ordered 0 0

none /sys/fs/fuse/connections fusectl rw,relatime 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
none /sys/kernel/security securityfs rw,relatime 0 0
none /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
none /run/shm tmpfs rw,nosuid,nodev,relatime 0 0
rpc_pipefs /run/rpc_pipefs rpc_pipefs rw,relatime 0 0
nfsd /proc/fs/nfsd nfsd rw,relatime 0 0
gvfs-fuse-daemon /home/zhangbin/.gvfs fuse.gvfs-fuse-daemon 


rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0
root@ubuntu:/home/zhangbin# 






root@ubuntu:/home/zhangbin# cat /proc/mounts
rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
udev /dev devtmpfs rw,relatime,size=505116k,nr_inodes=126279,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,relatime,size=204960k,mode=755 0 0
/dev/disk/by-uuid/83949f02-b628-4305-9594-52a50a82c8e4 / ext4 ro,relatime,errors=remount-


ro,user_xattr,barrier=1,data=ordered 0 0
none /sys/fs/fuse/connections fusectl rw,relatime 0 0
none /sys/kernel/debug debugfs rw,relatime 0 0
none /sys/kernel/security securityfs rw,relatime 0 0
none /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
none /run/shm tmpfs rw,nosuid,nodev,relatime 0 0
rpc_pipefs /run/rpc_pipefs rpc_pipefs rw,relatime 0 0
nfsd /proc/fs/nfsd nfsd rw,relatime 0 0
gvfs-fuse-daemon /home/zhangbin/.gvfs fuse.gvfs-fuse-daemon 


rw,nosuid,nodev,relatime,user_id=1000,group_id=1000 0 0

root@ubuntu:/home/zhangbin# 


文件系统只读。。。。各种文件都带着一个加锁的图标,无法访问:

=====================================================

重启

rm: cannot remove `/var/lib/dpkg/lock': Read-only file system 修复磁盘并成功启动_第1张图片


F 修复

然后M手动修复:



没有找到磁盘驱动? /tmp无法挂载?

mrm: cannot remove `/var/lib/dpkg/lock': Read-only file system 修复磁盘并成功启动_第2张图片




修复吧:


rm: cannot remove `/var/lib/dpkg/lock': Read-only file system 修复磁盘并成功启动_第3张图片

貌似是用fsck修复的。


然后startx,可以么?


rm: cannot remove `/var/lib/dpkg/lock': Read-only file system 修复磁盘并成功启动_第4张图片




在运行一次fsck:

rm: cannot remove `/var/lib/dpkg/lock': Read-only file system 修复磁盘并成功启动_第5张图片

======================================================================================


好吧,貌似不管用,再次重启:


ubuntu自己进入这个界面了:


用recovery mode :

rm: cannot remove `/var/lib/dpkg/lock': Read-only file system 修复磁盘并成功启动_第6张图片


修复:

选fsck :

rm: cannot remove `/var/lib/dpkg/lock': Read-only file system 修复磁盘并成功启动_第7张图片



fsck 会以 读/写 模式  重新mount /  ,然后mount 定义在/etc/fstab 中的其他文件系统:

rm: cannot remove `/var/lib/dpkg/lock': Read-only file system 修复磁盘并成功启动_第8张图片




fsck的过程:

rm: cannot remove `/var/lib/dpkg/lock': Read-only file system 修复磁盘并成功启动_第9张图片




然后选 dpkg 来修复一些软件包:

rm: cannot remove `/var/lib/dpkg/lock': Read-only file system 修复磁盘并成功启动_第10张图片



感觉这几个包,没必要安装。。遂退出,但是RETURN按键,我没找到,只好power reset :

rm: cannot remove `/var/lib/dpkg/lock': Read-only file system 修复磁盘并成功启动_第11张图片




重启只好,就好了。

可以进入图形界面,说明一切完好。




======感觉自己比较幸运啊-=====具体原因我也不太清楚。。。。







http://askubuntu.com/questions/105857/ubuntu-11-10-not-booting-could-not-write-bytes-broken-pipes

http://www.ubuntugeek.com/how-to-fix-lock-varlibdpkglock-open-11-resource-temporarily-unavailable-error.html

http://www.techsupportforum.com/forums/f64/linux-error-cant-use-my-computer-581292.html

http://openubuntu.com/index.php?topic=1296.0


你可能感兴趣的:(linux菜鸟手记)