1

I have this integrated in a bash-script on an outdated Debian 10.

ps -axo "%p ;;; %a"

Works well, output is like

10161 ;;; [kworker/0:1-cgroup_destroy]
12173 ;;; [kworker/2:0-events]
12379 ;;; [kworker/u8:0-events_unbound]
12464 ;;; [kworker/u8:1-flush-254:2]

The custom separator ;;; between proc-id and proc-name is what I want!

Now I update to current Debian 13.

It is not working anymore.

Without my custom separator its still ok.

ps -axo "%p %a"

4180 [kworker/0:1-ata_sff]      
4181 [kworker/3:1-ata_sff]      
4292 [kworker/2:2-ata_sff] 

ps -axo "%p ;;; %a"

Error: must set personality to get -x option

Do not know when it broke on the way from Debian 10 to 13. Any idea how to get my custom separator back??

Version is

ps -V

ps from procps-ng 4.0.4
3
  • 1
    Didn't you ask exactly this question when you were migrating to Debian 12? unix.stackexchange.com/q/758665/116858 Commented 17 hours ago
  • Please add the output of ps -V to your question. I can't reproduce this on ps from procps-ng 4.0.5-dirty. Commented 17 hours ago
  • ps from procps-ng 4.0.4 Commented 17 hours ago

2 Answers 2

3

The documentation suggests that this feature isn’t supposed to work, and that belief is shared, so its loss in version 4.0.3 didn’t cause much reaction (the behaviour change was due to an obscure, and I think incomplete, fix for %cpu handling). However it seems that “AIX free-format” really is supposed to work, and it’s been restored recently; unfortunately the fix is only available in version 4.0.5 of procps, which isn’t available in Debian at all yet, let alone in Debian 13.

I’m not aware of a workaround in your situation, using the version of ps currently in Debian 13; you could build a newer version of ps, and perhaps file an issue in Debian (reportbug procps) pointing to the upstream fix. This is unlikely to qualify for a stable fix though; I think the best you can hope for in Debian itself is for a backport of 4.0.5 once it lands in testing.

You can of course keep the Debian 10, or better, 11, version of ps somewhere and use that; if you don’t have it handy, you can download it and extract it (on amd64) as follows:

$ wget http://deb.debian.org/debian/pool/main/p/procps/libprocps8_3.3.17-5_amd64.deb http://deb.debian.org/debian/pool/main/p/procps/procps_3.3.17-5_amd64.deb
$ sudo apt install ./libprocps8_3.3.17-5_amd64.deb
$ dpkg-deb -x procps_3.3.17-5_amd64.deb myps

Copy myps/bin/ps somewhere else on your PATH, renaming it to myps, and then you’ll be able to run

$ myps -axo "%p ;;; %a"

and get the result you expect. Vulnerabilities are occasionally found in ps, so it’s probably not a great idea to rely on a very old version for general usage.

2

A complete working workaround using a container to serve a specific version of procps, here 4.0.5 (latest version according to @Stephen Kit answer), without messing with apt and your system (isolation by design):

$ ldd /usr/bin/ps
    linux-vdso.so.1 (0x00007ffe0a48a000)
    libproc2.so.0 => /lib/x86_64-linux-gnu/libproc2.so.0 (0x00007f49f90a0000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f49f8e8e000)
    libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007f49f8dae000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f49f913b000)
    libcap.so.2 => /lib/x86_64-linux-gnu/libcap.so.2 (0x00007f49f8da1000)
    libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f49f8c59000)
    liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f49f8c35000)
    liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f49f8c03000)
    libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007f49f8b49000)
    libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f49f8b24000)

Solution to copy/paste in a terminal:

Cat>Dockerfile<<EOF
FROM opensuse/leap:16.0
RUN zypper -n refresh && zypper -n install procps
ENTRYPOINT ["ps"]
EOF
docker build -t myps:latest .
docker run \
    --rm \
    --pid=host \
    -v /etc:/host-etc:ro \
    -v /proc:/host-proc:ro \
     ps -axo "%p ;;; %a"

Et voilà...

You can even change the base Docker image if you need another version of procps.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.