解压命令:参考http://www.cnblogs.com/eoiioe/archive/2008/09/20/1294681.html
获取进程id和线程id:http://blog.chinaunix.net/uid-24567872-id-100482.html
ubuntu常见错误--could not get lock /var/lib/dpkg/lock -open
最近研究ubuntu,用apt-get命令安装一些软件包时,总报错:E:could not get lock /var/lib/dpkg/lock -open等
出现这个问题的原因可能是有另外一个程序正在运行,导致资源被锁不可用。而导致资源被锁的原因,可能是上次安装时没正常完成,而导致出现此状况。
解决方法:输入以下命令
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
14.10 openjdk :
pc:~$ sudo apt-get install openjdk-7-jdk
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
pc:~$ sudo rm /var/cache/apt/archives/lock
pc:~$ sudo rm /var/lib/dpkg/lock
rm: cannot remove ‘/var/cache/apt/archives/lock’: No such file or directory
pc:~$ sudo apt-get install openjdk-7-jdk
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
pc:~$ sudo dpkg --configure -a
Setting up xserver-common (2:1.16.0-1ubuntu1.2) ...
Setting up linux-image-extra-3.16.0-29-generic (3.16.0-29.39) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.16.0-29-generic /boot/vmlinuz-3.16.0-29-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.16.0-29-generic /boot/vmlinuz-3.16.0-29-generic
update-initramfs: Generating /boot/initrd.img-3.16.0-29-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 3.16.0-29-generic /boot/vmlinuz-3.16.0-29-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.16.0-29-generic /boot/vmlinuz-3.16.0-29-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.16.0-29-generic /boot/vmlinuz-3.16.0-29-generic
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.16.0-29-generic
Found initrd image: /boot/initrd.img-3.16.0-29-generic
Found linux image: /boot/vmlinuz-3.16.0-23-generic
Found initrd image: /boot/initrd.img-3.16.0-23-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
dpkg: unrecoverable fatal error, aborting:
unable to install updated status of `linux-image-extra-3.16.0-29-generic': No such file or directory
pc:~$ sudo apt-get install linux-image-extra-3.16.0-29-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-image-extra-3.16.0-29-generic is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
pc:~$ sudo dpkg --configure -a
pc:~$ sudo apt-get install linux-image-extra-3.16.0-29-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-image-extra-3.16.0-29-generic is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
pc:~$ sudo apt-get install openjdk-7-jdk