Saturday, February 2, 2013

Failed to initialize dtrace message

Recently, I wanted to learn DTrace programming, so I installed OpenSolaris 10 virtual machine on my laptop. After installation, I tried to execute a simple dtrace command but got the following message:

"dtrace: failed to initialize dtrace: DTrace require additional previleges"


Solution:
By default, when you install OpenSolaris 10, your primary profile is set as 'Primary Administrator' and role as 'root' but you are logged in as a normal user without root privileges. Therefore, to solve my issue I had to 'su' as 'root' and run DTrace commands.


You can check what role and profile you are assigned after installation by running following command:    cat /etc/user_attr


NOTE: If you don't want to log in as a root each time you want to run the DTrace command, you can read the following article on how to give DTrace privilege to a normal user.