Hi,
I have a quite strange circumstance and I have not found anything on the internet regarding it.
I did an
apt upgrade in a server.
It started installing what had to be installed but at some time when it was setting up php5-fpm upgrade process needed attention.
Setting up php5-fpm (5.5.9+dfsg-1ubuntu4.25) ...
Configuration file '/etc/php5/fpm/pool.d/www.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
I tried to reply the question, but when I tried, ssh connection had died.
*** www.conf (Y/I/N/O/D/Z) [default=N] ? packet_write_wait: Connection to XX.XX.XX.XXX port 22: Broken pipe
So I ssh the server again.
Now, estrangely enough, i cannot restart apt upgrade because the old process has not died. It is in SLEEP state (waiting for a keystroke I supose).
root@www:~# apt upgrade
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?
I could kill apt upgrade process, but you don't want to kill an upgrade process in the middle, do you? That could create a ton of problems. Murphy's law is around.
So I thought if I only could send a N keystroke to the process IO file, that should resume the process and easily overcome the problem. It is not common that
apt upgrade needs attention. It should finish ok if I am a little lucky.
Are you following yet?
I googled around and found that /proc/PID/fd/0 should be the file/stream i should echo to. But the problem is that this standard IO fd is dead.
root@www:/proc# ls -lah 25902/fd/
lrwx------ 1 root root 64 May 25 09:39 0 -> /dev/pts/2 (deleted)
lrwx------ 1 root root 64 May 25 09:39 1 -> /dev/pts/2 (deleted)
...
So I cannot echo anything to it.
root@www:/proc# echo n > /dev/pts/2
-bash: /dev/pts/2: Permission denied
root@www:~# echo n > /proc/25902/fd/0
-bash: /proc/25902/fd/0: Input/output error
So, the question is: Did anybody had this problem before? Did you manage to send a keystroke to apt upgrade process without having to kill it? Any clues?
if I list /proc/PID/fd/ it has a ton of /var/lib/apt files opened (normal) and some others I don't know what are they used for. Any clue?
lrwx------ 1 root root 64 May 25 09:39 71 -> /dev/ptmx
lrwx------ 1 root root 64 May 25 09:39 72 -> /dev/pts/3
lr-x------ 1 root root 64 May 25 09:39 73 -> pipe:[2695925055]
Thank you very much. Any help or clue will be appreciated.
PS: Maybe there is another way to solve it, such as sending the process a signal through kill (not -9 but another) so the process finishes correctly.