[问题]能否查看是哪那个程序对“状态列表目录”加锁的嘛?

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

[问题]能否查看是哪那个程序对“状态列表目录”加锁的嘛?

#1

帖子 Nile » 2007-11-23 17:44

最近运行apt-get update时总莫明其妙出现

代码: 全选

E: 无法获得锁 /var/lib/apt/lists/lock - open (11 Resource temporarily unavailable)
E: 无法对状态列表目录加锁
一开机就这样,我的新立德、更新管理器都没开,开机自动更新早被关了,ps一下也没发现可疑加锁的进程,有时候过一段时间就可以更新了,有时过好长时间也不行。

能否查看是哪个进程对“状态列表目录”加锁的?

先谢谢各位了!

PS:目前的进程列表

代码: 全选

 PID TTY      STAT   TIME COMMAND
    1 ?        Ss     0:01 /sbin/init
    2 ?        S      0:00 [migration/0]
    3 ?        SN     0:00 [ksoftirqd/0]
    4 ?        S      0:00 [watchdog/0]
    5 ?        S<     0:00 [events/0]
    6 ?        S<     0:00 [khelper]
    7 ?        S<     0:00 [kthread]
   30 ?        S<     0:00 [kblockd/0]
   31 ?        S<     0:00 [kacpid]
   32 ?        S<     0:00 [kacpi_notify]
  180 ?        S<     0:00 [kseriod]
  201 ?        S      0:00 [pdflush]
  202 ?        S      0:00 [pdflush]
  203 ?        S<     0:00 [kswapd0]
  204 ?        S<     0:00 [aio/0]
 2189 ?        S<     0:00 [ksuspend_usbd]
 2190 ?        S<     0:00 [khubd]
 2228 ?        S<     0:00 [ata/0]
 2229 ?        S<     0:00 [ata_aux]
 2368 ?        S<     0:00 [scsi_eh_0]
 2369 ?        S<     0:00 [scsi_eh_1]
 2589 ?        S<     0:00 [kjournald]
 3049 ?        S<s    0:00 /sbin/udevd --daemon
 3980 ?        S<     0:00 [kpsmoused]
 4101 ?        S<     0:00 [pccardd]
 4110 ?        S<     0:00 [tifm/0]
 4124 ?        S<     0:00 [kmmcd]
 4201 ?        S<     0:00 [ipw2200/0]
 4234 ?        S<     0:00 [irda_sir_wq]
 4630 ?        S<     0:00 [kjournald]
 4644 ?        S<     0:00 [kjournald]
 4704 ?        S<     0:00 [kjournald]
 4706 ?        S<     0:00 [kjournald]
 4708 ?        S<     0:00 [kjournald]
 5696 tty4     Ss+    0:00 /sbin/getty 38400 tty4
 5697 tty5     Ss+    0:00 /sbin/getty 38400 tty5
 5701 tty2     Ss+    0:00 /sbin/getty 38400 tty2
 5702 tty3     Ss+    0:00 /sbin/getty 38400 tty3
 5703 tty1     Ss+    0:00 /sbin/getty 38400 tty1
 5704 tty6     Ss+    0:00 /sbin/getty 38400 tty6
 5869 ?        Ss     0:00 /sbin/syslogd
 6211 ?        Ss     0:00 /usr/sbin/acpid -c /etc/acpi/events -s /var/run/acpid.socket
 6249 ?        Ss     0:00 /bin/dd bs 1 if /proc/kmsg of /var/run/klogd/kmsg
 6263 ?        Ss     0:00 /sbin/klogd -P /var/run/klogd/kmsg
 6304 ?        Ss     0:00 /usr/bin/dbus-daemon --system
 6329 ?        Ss     0:00 /usr/sbin/hald
 6330 ?        S      0:00 hald-runner
 6360 ?        S      0:00 hald-addon-keyboard: listening on /dev/input/event1
 6361 ?        S      0:00 hald-addon-keyboard: listening on /dev/input/event5
 6362 ?        S      0:00 hald-addon-keyboard: listening on /dev/input/event6
 6364 ?        S      0:00 /usr/lib/hal/hald-addon-cpufreq
 6366 ?        S      0:00 hald-addon-keyboard: listening on /dev/input/event7
 6440 ?        Ss     0:00 /usr/sbin/dhcdbd --system
 6474 ?        Ss     0:00 /usr/sbin/NetworkManager --pid-file /var/run/NetworkManager/NetworkManager.pid
 6505 ?        Ss     0:00 /usr/sbin/NetworkManagerDispatcher --pid-file /var/run/NetworkManager/NetworkManagerDispatcher.pi
 6526 ?        Ss     0:00 /usr/bin/system-tools-backends
 6527 ?        S      0:00 dbus-daemon --session --print-address --nofork
 6603 ?        Ss     0:00 /usr/sbin/gdm
 6604 ?        S      0:00 /usr/sbin/gdm
 6609 tty7     Ss+    0:20 /usr/X11R6/bin/X :0 -br -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
 6744 ?        S<     0:00 [kondemand/0]
 6844 ?        S      0:00 /usr/sbin/hddtemp -d -l 127.0.0.1 -p 7634 -s | /dev/sda
 6939 ?        Ss     0:00 /usr/sbin/cron
 6942 ?        Ss     0:00 /usr/sbin/anacron -s
 6945 ?        Ss     0:00 /usr/sbin/atd
 7149 ?        Ssl    0:00 x-session-manager
 7189 ?        Ss     0:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session x-session-manager
 7192 ?        S      0:00 /usr/bin/dbus-launch --exit-with-session x-session-manager
 7193 ?        Ss     0:00 /usr/bin/dbus-daemon --fork --print-pid 4 --print-address 8 --session
 7195 ?        S      0:02 /usr/lib/libgconf2-4/gconfd-2 6
 7198 ?        S      0:00 /usr/bin/gnome-keyring-daemon
 7200 ?        Sl     0:01 /usr/lib/control-center/gnome-settings-daemon
 7209 ?        Ss     0:00 /bin/sh -c /usr/bin/esd -terminate -nobeeps -as 1 -spawnfd 24
 7210 ?        S      0:00 /usr/bin/esd -terminate -nobeeps -as 1 -spawnfd 24
 7214 ?        S      0:04 /usr/bin/metacity --sm-client-id=default0
 7219 ?        S      0:05 gnome-panel --sm-client-id default1
 7223 ?        S      0:05 nautilus --no-default-window --sm-client-id default2
 7226 ?        Ssl    0:00 /usr/lib/bonobo-activation/bonobo-activation-server --ac-activate --ior-output-fd=16
 7228 ?        Ss     0:00 gnome-volume-manager --sm-client-id default4
 7235 ?        S      0:00 /usr/lib/gnome-vfs-2.0/gnome-vfs-daemon
 7244 ?        Sl     0:00 /usr/lib/evolution/2.10/evolution-alarm-notify
 7246 ?        S      0:00 nm-applet --sm-disable
 7249 ?        Ss     0:00 /sbin/mount.ntfs-3g /dev/sda7 /media/sda7 -o rw
 7250 ?        Ss     0:00 gnome-power-manager
 7272 ?        Sl     0:00 /usr/lib/evolution/evolution-data-server-1.10 --oaf-activate-iid=OAFIID:GNOME_Evolution_DataServe
 7279 ?        S      0:00 /usr/lib/gnome-applets/trashapplet --oaf-activate-iid=OAFIID:GNOME_Panel_TrashApplet_Factory --oa
 7318 ?        S      0:00 /usr/lib/nautilus-cd-burner/mapping-daemon
 7332 ?        S      0:00 /usr/lib/byzanz/byzanz-applet --oaf-activate-iid=OAFIID:ByzanzApplet_Factory --oaf-ior-fd=25
 7353 ?        S      0:10 /usr/lib/gnome-panel/sensors-applet --oaf-activate-iid=OAFIID:SensorsApplet_Factory --oaf-ior-fd=
 7355 ?        S      0:00 /usr/lib/gnome-applets/cpufreq-applet --oaf-activate-iid=OAFIID:GNOME_CPUFreqApplet_Factory --oaf
 7357 ?        S      0:56 /usr/lib/gnome-applets/multiload-applet-2 --oaf-activate-iid=OAFIID:GNOME_MultiLoadApplet_Factory
 7377 ?        S      0:00 /usr/lib/gnome-applets/mixer_applet2 --oaf-activate-iid=OAFIID:GNOME_MixerApplet_Factory --oaf-io
 7386 ?        Ss     0:01 gnome-screensaver
 7388 ?        Rl     0:01 gnome-terminal
 7391 ?        S      0:00 gnome-pty-helper
 7392 pts/0    Ss     0:00 bash
 7410 pts/0    Sl+    0:00 xrgsu -a
 7417 pts/1    Ss     0:00 bash
 7433 pts/1    S      0:00 /bin/bash
 7765 ?        Sl     0:52 /usr/lib/firefox/firefox-bin
 7783 ?        S      0:00 /bin/sh -c nice run-parts --report /etc/cron.daily
 7784 ?        SN     0:00 run-parts --report /etc/cron.daily
 7795 ?        SNs    0:00 /bin/sh /etc/cron.daily/apt
 7807 ?        SN     0:00 apt-get -qq update
 7811 ?        SN     0:00 /usr/lib/apt/methods/http
 7812 ?        SN     0:00 /usr/lib/apt/methods/http
 7813 ?        SN     0:00 /usr/lib/apt/methods/cdrom
 7814 ?        SN     0:00 /usr/lib/apt/methods/ftp
 7815 ?        SN     0:00 /usr/lib/apt/methods/ftp
 7817 ?        SN     0:00 /usr/lib/apt/methods/gpgv
 7829 pts/2    Ss+    0:00 bash
 7847 ?        SN     0:00 /usr/lib/apt/methods/bzip2
 7851 pts/2    S      0:04 fcitx
 7907 ?        S<     0:00 [scsi_eh_2]
 7908 ?        S<     0:00 [usb-storage]
 8003 ?        Ss     0:00 /sbin/mount.ntfs-3g /dev/sdb6 /media/Software -o rw,nosuid,nodev,locale=zh_CN.UTF-8
 8012 ?        Ss     0:01 /sbin/mount.ntfs-3g /dev/sdb7 /media/Movie(1) -o rw,nosuid,nodev,locale=zh_CN.UTF-8
 8073 ?        Ss     0:00 /sbin/mount.ntfs-3g /dev/sdb9 /media/Badblock -o rw,nosuid,nodev,locale=zh_CN.UTF-8
 8153 pts/1    R+     0:00 ps ax
Thinkpad T400
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#2

帖子 eexpress » 2007-11-23 17:49

一般是后台的自动更新。新利得里面关闭就是。你locate lock。有一个lock文件的。lsof可以找到使用文件的软件。
● 鸣学
头像
Nile
帖子: 990
注册时间: 2006-07-15 11:20
来自: 枫叶刀市

#3

帖子 Nile » 2007-11-23 18:05

学习了。

严重感谢ee!以前一直不知道还有个lsof呢。
Thinkpad T400
回复