Score:0

Finding a specific text phrase in all system files

cn flag

Trying to find a specific text phrase in all system files. A terrible way to debug but I have no clue where the mistake is and at this point I do not care whether it takes a day to debug.

I ran

grep -rnw /* -e _renderd 

And the error I got was

root@geocode:~# grep -rnw /* -e _renderd 
/etc/passwd:38:_renderd:x:115:124:renderd daemon,,,:/nonexistent:/usr/sbin/nologin
/etc/shadow:38:_renderd:*:18784:0:99999:7:::
/etc/passwd-:38:_renderd:x:115:124::/nonexistent:/usr/sbin/nologin
/etc/shadow-:38:_renderd:*:18784:0:99999:7:::
/etc/group:66:_renderd:x:124:
/etc/gshadow:66:_renderd:!::
/lib/systemd/system/renderd.service:8:User=_renderd
grep: /proc/sys/abi/vsyscall32: Cannot allocate memory
grep: /proc/sys/debug/exception-trace: Cannot allocate memory
grep: /proc/sys/debug/kprobes-optimization: Cannot allocate memory
grep: /proc/sys/dev/cdrom/autoclose: Cannot allocate memory
grep: /proc/sys/dev/cdrom/autoeject: Cannot allocate memory
grep: /proc/sys/dev/cdrom/check_media: Cannot allocate memory
grep: /proc/sys/dev/cdrom/debug: Cannot allocate memory
grep: /proc/sys/dev/cdrom/info: Cannot allocate memory
grep: /proc/sys/dev/cdrom/lock: Cannot allocate memory
grep: /proc/sys/dev/hpet/max-user-freq: Cannot allocate memory
grep: /proc/sys/dev/raid/speed_limit_max: Cannot allocate memory
grep: /proc/sys/dev/raid/speed_limit_min: Cannot allocate memory
grep: /proc/sys/dev/scsi/logging_level: Cannot allocate memory
grep: /proc/sys/dev/tty/ldisc_autoload: Cannot allocate memory
grep: /proc/sys/fs/aio-max-nr: Cannot allocate memory
grep: /proc/sys/fs/aio-nr: Cannot allocate memory
grep: /proc/sys/fs/binfmt_misc/register: Invalid argument
grep: /proc/sys/fs/dentry-state: Cannot allocate memory
grep: /proc/sys/fs/dir-notify-enable: Cannot allocate memory
grep: /proc/sys/fs/epoll/max_user_watches: Cannot allocate memory
grep: /proc/sys/fs/file-max: Cannot allocate memory
grep: /proc/sys/fs/file-nr: Cannot allocate memory
grep: /proc/sys/fs/inode-nr: Cannot allocate memory
grep: /proc/sys/fs/inode-state: Cannot allocate memory
grep: /proc/sys/fs/inotify/max_queued_events: Cannot allocate memory
grep: /proc/sys/fs/inotify/max_user_instances: Cannot allocate memory
grep: /proc/sys/fs/inotify/max_user_watches: Cannot allocate memory
grep: /proc/sys/fs/lease-break-time: Cannot allocate memory
grep: /proc/sys/fs/leases-enable: Cannot allocate memory
grep: /proc/sys/fs/mount-max: Cannot allocate memory
grep: /proc/sys/fs/mqueue/msg_default: Cannot allocate memory
grep: /proc/sys/fs/mqueue/msg_max: Cannot allocate memory
grep: /proc/sys/fs/mqueue/msgsize_default: Cannot allocate memory
grep: /proc/sys/fs/mqueue/msgsize_max: Cannot allocate memory
grep: /proc/sys/fs/mqueue/queues_max: Cannot allocate memory
grep: /proc/sys/fs/nr_open: Cannot allocate memory
grep: /proc/sys/fs/overflowgid: Cannot allocate memory
grep: /proc/sys/fs/overflowuid: Cannot allocate memory
grep: /proc/sys/fs/pipe-max-size: Cannot allocate memory
grep: /proc/sys/fs/pipe-user-pages-hard: Cannot allocate memory
grep: /proc/sys/fs/pipe-user-pages-soft: Cannot allocate memory
grep: /proc/sys/fs/protected_fifos: Cannot allocate memory
grep: /proc/sys/fs/protected_hardlinks: Cannot allocate memory
grep: /proc/sys/fs/protected_regular: Cannot allocate memory
grep: /proc/sys/fs/protected_symlinks: Cannot allocate memory
grep: /proc/sys/fs/quota/allocated_dquots: Cannot allocate memory

How do I limit the memory. Is it that I am running into files that are larger than 16 GB ram that I have or something else?

Score:1
hr flag

Unless you specifically want to search ephemeral filesystem like /proc, /sys I'd suggest using find for the recursion + non-recursive grep so that you can prune them (and the block device tree /dev) from the search. You might want to add -I to the grep options to skip binary files:

find / \( -path /dev -o -path /proc -o -path /sys \) -prune -o -type f \
    -exec grep -Inw -e _renderd {} +

You may want to add -path /run to the list of pruned paths.

Avyansh Katiyar avatar
cn flag
I am sorry I do not understand the command you have sent can you guide me to a resource so that I can understand it?
hr flag
@AvyanshKatiyar which particular part? [Understanding the -exec option of `find`](https://unix.stackexchange.com/a/389706/65304) or [How to exclude the folders proc and sys from search with find command ?](https://unix.stackexchange.com/a/193277/65304)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.