LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Deleted 'dmesg' by mistake.... (https://www.linuxquestions.org/questions/slackware-14/deleted-dmesg-by-mistake-883598/)

honeybadger 05-30-2011 05:27 PM

Deleted 'dmesg' by mistake....
 
Hi all, I had upgraded from slackware 13 to 13.1 and finally 13.37.
After this I noticed that 'dmesg' could only be executed as root. So inorder for a user to execute 'dmesg' I executed 'ln -s /bin/dmesg /usr/bin/dmesg'.
What happened next is the symlink was created but the dmesg executable was deleted.
I do not want to reinstall the OS (very time consuming on a P3 with 512MB RAM) so I want to know which package provides dmesg so that I can reinstall it.
The dmesg man page indicated that klogd will provide the package but then when I reinstalled it it was a no go.
Can someone tell me how to get the dmesg back?
Thanks for your help.

Didier Spaier 05-30-2011 05:33 PM

Hi, dmesg is provided by util-linux-ng (in the /a series).

TIP: 'grep <filename> /var/log/packages/*' will tell you which package(s) provide <filename>, if installed.

vulcan59 05-30-2011 05:44 PM

Not being able to run dmesg as an ordinary user is a security feature added to more recent kernels. You can enable it for users by running
Code:

sysctl -w kernel.dmesg_restrict=0
I have this in my rc.local.

TobiSGD 05-30-2011 05:52 PM

You can also get the information which package contains with slackpkg, like
Code:

slackpkg file-search dmesg

T3slider 05-30-2011 07:55 PM

Quote:

Originally Posted by vulcan59 (Post 4371393)
Not being able to run dmesg as an ordinary user is a security feature added to more recent kernels. You can enable it for users by running
Code:

sysctl -w kernel.dmesg_restrict=0
I have this in my rc.local.

It's probably better (well, not better, but more 'proper') to throw kernel parameters into /etc/sysctl.conf since
Code:

/sbin/sysctl -e -p /etc/sysctl.conf
is called from /etc/rc.d/rc.S anyway. See `man sysctl.conf`.

jamesf 05-30-2011 08:23 PM

Quote:

Originally Posted by TobiSGD (Post 4371397)
You can also get the information which package contains with slackpkg, like
Code:

slackpkg file-search dmesg

I always forget to use slackpkg that way, instead I do
Code:

grep somefilename /var/log/packages/*
and I use /var/log/removed_packages similarly.

chrisretusn 05-30-2011 09:32 PM

Quote:

Originally Posted by SilverBack (Post 4371378)
Hi all, I had upgraded from slackware 13 to 13.1 and finally 13.37.
After this I noticed that 'dmesg' could only be executed as root. So inorder for a user to execute 'dmesg' I executed 'ln -s /bin/dmesg /usr/bin/dmesg'.
What happened next is the symlink was created but the dmesg executable was deleted.

That should not have happened. This would be more of a concern to me...

At any rate
Files in /bin are executable by users.
Code:

-rwxr-xr-x 1 root root 9432 Feb 16 14:34 /bin/dmesg*
So creating a symlink in /usr/bin would have failed anyway since other factors are stopping dmesg from being run by users.

The solutions have already been posted, with T3slider's post here being the preferred method.

honeybadger 05-31-2011 02:18 AM

Thanks for all your answers guys - I also learnt some tricks here which would undoubtedly help me in the future.


All times are GMT -5. The time now is 04:24 PM.