[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Removing (the file of) a running program [was: Trixie DHCP client migration ...]



On Wed, Jan 14, 2026 at 09:29:47AM +0700, Max Nikulin wrote:
> On 13/01/2026 8:31 pm, tomas@tuxteam.de wrote:
> >    cp /proc/30319/exe ./foo1
> [...]
> > I once heard that story of someone rm -rf-ing /, then stopping in panic, but /bin/sh
> > was gone, then rescueing it this way. Or was it /lib/libc-whatever?
> 
> A similar workaround is recommended even in release notes:
> 
> <https://www.debian.org/releases/trixie/release-notes/upgrading.en.html>
> 4. Upgrades from Debian 12 (bookworm):
> > In case tmux was upgraded to a new major version you may get an error on
> > attach: “open terminal failed: not a terminal”. You can still access the
> > old session with:
> > 
> > /proc/$(pgrep "tmux: server")/exe attach
> 
> As to ETXTBSY, I am less sure concerning .so plugins loaded using dlopen. At
> least I saw crashes when cp(1) was used instead of install(1) to replace old
> libraries during installing another version.

I don't know what you mean by ".so plugins", but if it is good ol' shared
libs, yes, they are mmapped:

  tomas@caliban:~$ lsof /lib/x86_64-linux-gnu/libc.so.6 
  COMMAND    PID  USER  FD   TYPE DEVICE SIZE/OFF    NODE NAME
  x-window- 2267 tomas mem    REG  254,1  1926232 1177239 /usr/lib/x86_64-linux-gnu/libc.so.6
  FvwmComma 2317 tomas mem    REG  254,1  1926232 1177239 /usr/lib/x86_64-linux-gnu/libc.so.6
  FvwmButto 2318 tomas mem    REG  254,1  1926232 1177239 /usr/lib/x86_64-linux-gnu/libc.so.6
  FvwmPager 2319 tomas mem    REG  254,1  1926232 1177239 /usr/lib/x86_64-linux-gnu/libc.so.6
  xterm     2320 tomas mem    REG  254,1  1926232 1177239 /usr/lib/x86_64-linux-gnu/libc.so.6
  xload     2322 tomas mem    REG  254,1  1926232 1177239 /usr/lib/x86_64-linux-gnu/libc.so.6
  [...]

...so they most probably are busy (anyone knows how to find out short of trying to
write to them?), since they are being used as backing store for the map.

Cheers
-- 
tomás

Attachment: signature.asc
Description: PGP signature


Reply to: