SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a problem with xconsole in Slackware 14.1. It won't display any logs.
I've tried:
Uncommented kern.* /dev/console in /etc/syslog.conf and restarted syslog (kill -SIGHUP <pid>; /etc/rc.d/rc.syslog restart)
chmod 0666 /dev/console (xconsole will just display an error message if /dev/console has perms 0600)
xconsole -file /dev/console
xconsole doesn't display any logs, even if i write *.* /dev/console in /etc/syslog.conf. It doesn't even display logger -p kern.0 'test'.
As I understand it, this is how it works: /etc/syslog.conf tells syslog to log to /dev/console. xconsole -f /dev/console tells xconsole to read from /dev/console. Seems straightforward, but no luck.
[EDIT]
lsof -p `pidof /usr/sbin/syslogd` does not list /dev/console. Does this mean that syslog isn't really writing to /dev/console and that's why xconsole doesn't show any logs?
echo 'test' > /dev/console doesn't work either, by the way.
Didier, what display manager do you use? I never got it working on Slackware64, when X11 was started via XDM, or in a session started via startx.
Linux doesn't appear to treat /dev/console the same as some other UNIX (*BSDs included), instead it seems to be the same as /dev/tty0 and writes to the currently active vt. Anyway, by tracing xconsole, I discovered that xconsole uses /dev/xconsole instead.
To get xconsole to work, what I did was this:
Create a named pipe in /dev
Code:
#mknod -m 644 /dev/xconsole p
#mknod -m 644 /lib/udev/devices/xconsole p
...the udev one is so that the xconsole named pipe gets recreated on reboot.
Edit /etc/syslog.conf and add the following rule to enable writing to the named pipe:
Code:
# Uncomment this to see kernel messages via the xconsole command.
kern.* |/dev/xconsole
... adjusting the message specifiers to get whatever messages you're interested in seeing in xconsole.
Then, just pkill -HUP syslogd and you should be able to start xconsole and see messages.
The above is pretty permissive and anyone will be able to start xconsole and see its messages, so depending on how much you want to tie it down, you may want to either use 640 permissions and chown it to a specific user group, or maybe even do something with ACLs. I'll leave that as an exercise for the reader
No idea why Didier didn't have to go through this rigmarole.
P.S. I did report this to Pat way back when, so its possible he's fixed it in current (I noticed that you already have the xconsole pipe - mine was definately missing on 14.1 -edit, ahh nevermind I see we cross posted and you created it manually.)
P.P.S "xterm -C" still doesn't work even with this: I think that it is still trying to use /dev/console.
I just tried on Slackware64-current and that works exactly as stated in post #2. I even removed the only not genuine package I had installed (brltty-5.2) and that still works. This is also from fluxbox, also started at runlevel 3. the kernel is vmlinuz-huge-3.18.11.
I think there's a number of complications going on here.
If you run xconsole as root, it opens /dev/console, but if you run xconsole as a non-root user it uses /dev/xconsole instead.
I suspect there also some weird instanciation of /dev/console going on when its opened for reading. While I can su root -c "xconsole&" and then su root -c "echo wibble >/dev/console" and see the output, I don't start seeing kernel messages until after I've restarted syslogd by sending it a SIGHUP, which is a bit of a problem given that you'll certainly be starting xconsole after syslogd has initialised. Having said that, sometimes it seems to work without, but not other times. Something a little odd going on still.
Looking at the way it seems to be working, it seems like the xconsole named pipe is the best way to go to allow end users to use it reliably.
I was bothered by running xconsole as non-root and getting the error
"Cannot open console". Saw your thread here. Then looked at the code a
little (xconsole.c, OpenConsole()). If /dev/xconsole does not exist or
cannot be opened it will create a pseudoterminal. It then tries to
redirect output from /dev/console to that pty using ioctl(pty slave fd,
TIOCCONS, 1). Unfortunately, Linux for some time now restricts that
ioctl request to only threads having the CAP_SYS_ADMIN capability. See
tty_ioctl(4). After running the following command I can echo a message
to /dev/console as root and see it in xconsole run as non-root. I have
no idea if this is wise. The CAP_SYS_ADMIN capability is quite broad as
you can see from capabilities(7). But perhaps this is better than setuid
which was my first thought.
Yes, I still care and that clears the missing pieces up. I'm still using the fifo and syslog approach I mentioned above which allows non-root users to view the kernel messages via xconsole. Though I must admit, I rarely start xconsole these days, and there are other ways to take a peek when you need to.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.