How to get back to the process after the ssh connection is broken? Screen is not worth it.

$ sudo apt update Чтение списков пакетов… Готово E: Не удалось получить доступ к файлу блокировки /var/lib/apt/lists/lock - open (11: Ресурс временно недоступен) E: Невозможно заблокировать каталог /var/lib/apt/lists/ 
  • five
    >>Как вернутся к процессу после обрыва ssh соединения?<< : generally speaking, no, there are some hacking tools (like rediscovering file descriptors to another terminal via gdb), but they are not for everyday use ... install screen or tmux and use them much more adequate option ... Judging by the conclusion, problem X can be solved simply by killing the hanging shell and / or apt; or wait until it is done by sshd (depending on the settings). - Fat-Zer
  • one
    The apt process is most likely dead (SIGHUP). If alive, try SIGINT, SIGTERM to kill. To get the package database back online: sudo dpkg --configure -a . After that, restart apt update (inside the screen, so as not to repeat the procedure) - jfs
  • one

1 answer 1

in this case, one should not “return to the process” (which is very difficult in practice), but “kill” it.


E: Unable to access lock file / var / lib / apt / lists / lock - open (11: Resource temporarily unavailable)

The identifier of the process that established the lock on the file can be recognized by various means. Napimer:

 $ sudo fuser /var/lib/apt/lists/lock /var/lib/apt/lists/lock: 5153 

or:

 $ sudo lsof -w /var/lib/apt/lists/lock COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME apt 5153 root 4uW REG 8,1 0 131230 /var/lib/apt/lists/lock 

in the example, this is process with ID 5153 . it can be "killed":

 $ sudo kill -9 5153 

after that, all locks set by this process will be removed.