How to run strace on ulimit command?
Environment
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
Issue
- Running
strace
onulimit
command fails with below error:
# strace ulimit
strace: Can't stat 'ulimit': No such file or directory
Resolution
Below is the workaround for Red Hat Enterprise Linux 6
and Red Hat Enterprise Linux 7
- Create file named as
ulimit
under/usr/bin/
directory and edit to call the builtin functionulimit
.
# vi /usr/bin/ulimit
#!/bin/sh
builtin ulimit "$@"
- Make
/usr/bin/ulimit
executable :
# chmod +x /usr/bin/ulimit
- After following above steps
strace
will run onulimit
successfully. - Red Hat Enterprise Linux 8 Beta has the
/usr/bin/ulimit
executable file by default provided bybash
rpm:
# rpm -ql bash-4.4.19-6.el8.x86_64 | grep -i ulimit
/usr/bin/ulimit
--
# cat /usr/bin/ulimit
#!/bin/sh
builtin ulimit "$@"
Root Cause
ulimit
is a builtin function ofbash
rpm. But whenstrace
runs, it looks forulimit
file and returns errorstrace: Can't stat 'ulimit': No such file or directory
as it could not find it.
Diagnostic Steps
ulimit
file does not exist by default under any path of the executables. Hencestrace
returns error when it runs onulimit
.- Verification of
ulimit
bywhich
command, shows file is not present inRed Hat Enterprise Linux 6
andRed Hat Enterprise Linux 7
:
# which ulimit
/usr/bin/which: no ulimit in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments