What are tr and fold? Can I kill them?

vitaprimo

Dabbler
Joined
Jun 28, 2018
Messages
27
I can only find it performs some kind of translation in UNIX systems--it's really vague.

I moved my tiny 2diskmirror+2slogmirror system from a workstation-class system into a proper server system so I can install more RAM and be able to use a couple of plugins without worrying. In the workstation it has available 4cores, no hyperthreading and it barely ever registered CPU activity. Now it's got double the core number, with hyperthreaded CPUs this time yet it's busier than before, much busier. I had installed some test plugins but stopping them made no difference.

Then I ran htop and noticed this tr process maxing out a core, and another that's constantly using half of a core too, looking at its arguments it reminds me to this number/password generator I used before. The last anomaly (I think) is cat, also high (for cat) CPU I assumed attempting and failing to read that thingy where randomness is stored.

tr.PNG

What is tr? Is it safe to kill? What about fold?

Thanks!
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
tr -dc a-zA-Z0-9 is a text filter that deletes ASCII characters from a stream that aren't letters or numbers.
fold -w 16 is a text filter that splits a stream into 16-character lines.
cat /dev/urandom pulls random ASCII characters and outputs them to STDOUT.

Judging from the PIDs, they're likely concatenated together as a pipe: cat /dev/urandom | tr -dc a-zA-Z0-9 | fold -w 16.

I've only seen something like this that was trying to generate some kind of random key. It's probably safe to kill all 3.
 

vitaprimo

Dabbler
Joined
Jun 28, 2018
Messages
27
Entropy! I couldn't remember the word until now. I think this is about the systems used for encrypting data on disk, very wild guesses of course...
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
The entropy-harvesting routines for generating encryption keys for GELI and for the system's SSH keys don't run away like this. This sounds like a poorly-written script inside a plugin.
 

vitaprimo

Dabbler
Joined
Jun 28, 2018
Messages
27
tr -dc a-zA-Z0-9 is a text filter that deletes ASCII characters from a stream that aren't letters or numbers.
fold -w 16 is a text filter that splits a stream into 16-character lines.
cat /dev/urandom pulls random ASCII characters and outputs them to STDOUT.

Judging from the PIDs, they're likely concatenated together as a pipe: cat /dev/urandom | tr -dc a-zA-Z0-9 | fold -w 16.

I've only seen something like this that was trying to generate some kind of random key. It's probably safe to kill all 3.
I didn't know piped commands could appear as that, thanks for the lesson. :)

I'll have to try it because the alternative is restarting for which I'd have to stop hypervisors. Thanks again!
 

vitaprimo

Dabbler
Joined
Jun 28, 2018
Messages
27
I didn't know piped commands could appear as that, thanks for the lesson. :)

I'll have to try it because the alternative is restarting for which I'd have to stop hypervisors. Thanks again!
...and just now I realized I got it mixed up with ps. o_O
 

vitaprimo

Dabbler
Joined
Jun 28, 2018
Messages
27
You were
The entropy-harvesting routines for generating encryption keys for GELI and for the system's SSH keys don't run away like this. This sounds like a poorly-written script inside a plugin.
That was beyond accurate, I deleted the plugins, on I don't remember its name I think it was Bazarr, the other Nextcloud, both unconfigured, Bazarr because I just needed to get acquainted with the process, and Nextcloud kept taking too long to finished, and therefore it the GUI would time out and I wouldn't see the last details to finish setting it up. I assumed they would be doing nothing, I'll be more careful next time. I also think I never stopped them before when I think I did, I don't remember seeing the confirmation to stop them. Probably an some issue from keep opening sessions after timeouts., IDK.

Thanks again, you saved the day! :grin:
 
Top