LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 01-18-2016, 08:37 PM   #1
kcirick
Member
 
Registered: Dec 2006
Distribution: Slackware 14.1; LFS 7.9-Systemd; Debian Jessie
Posts: 169

Rep: Reputation: 55
"who" and "users" not reporting anything


I was just playing around when I noticed that "who" and "users" command, which are supposed to show currently logged in accounts, return nothing. (No errors, just nothing). At the least, I should expect my current username

How do I fix this? I believe these are part of coreutils package.
 
Old 01-18-2016, 10:53 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
First I'd find out what gets invoked when you run those commands.
Code:
$ which who
$ which users
Are they launched from something like a Busybox binary? Are they symbolic links, and if so; what do those links point too? From each of those commands you should be able to get help by doing something like:
Code:
$ who --help
$ users --help
And see what gets reported there. Either the binaries are broken, some link is pointing to nothing, or some other thing.
 
1 members found this post helpful.
Old 01-19-2016, 05:46 AM   #3
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,154

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Works here
Code:
keithhedger@LFSHal:~-> who
keithhedger tty1         2016-01-19 11:32
keithhedger pts/0        2016-01-19 11:44 (:0)
keithhedger@LFSHal:~-> users
keithhedger keithhedger
Looks like somthing went wrong when building/installing core utils, try rebuilding/reinstalling.

Busybox is not part of a standard LFS/BLFS install.

Last edited by Keith Hedger; 01-19-2016 at 05:47 AM.
 
Old 01-19-2016, 06:46 PM   #4
kcirick
Member
 
Registered: Dec 2006
Distribution: Slackware 14.1; LFS 7.9-Systemd; Debian Jessie
Posts: 169

Original Poster
Rep: Reputation: 55
So it turns out I didn't have /var/run/utmp file. I had /var/log/{btmp,lastlog,wtmp}, as written at the bottom of Chapter 6.6 (I am using 7.8-Systemd: http://www.linuxfromscratch.org/lfs/...eatefiles.html). As soon as I created the file and rebooted, the who and users command worked as expected.

It says at the bottom of the chapter:
Code:
Note
The /run/utmp file records the users that are currently logged in. This file is created dynamically in the boot scripts.
But in Systemd versions, there are no "boot scripts", so it doesn't get created? or am I missing something?

Last edited by kcirick; 01-19-2016 at 06:49 PM.
 
Old 01-19-2016, 06:48 PM   #5
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,154

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
You do realize that the current LFS version is 7.8, you are using quite an old version.
 
Old 01-19-2016, 07:13 PM   #6
kcirick
Member
 
Registered: Dec 2006
Distribution: Slackware 14.1; LFS 7.9-Systemd; Debian Jessie
Posts: 169

Original Poster
Rep: Reputation: 55
Quote:
Originally Posted by Keith Hedger View Post
You do realize that the current LFS version is 7.8, you are using quite an old version.
... and I am using version 7.8-Systemd
 
Old 01-19-2016, 07:16 PM   #7
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,154

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Quote:
Originally Posted by kcirick View Post
... and I am using version 7.8-Systemd
You edited your post, previously it was pointing out a possible error in 7.1/7.2 hence my post.
 
Old 01-19-2016, 07:19 PM   #8
kcirick
Member
 
Registered: Dec 2006
Distribution: Slackware 14.1; LFS 7.9-Systemd; Debian Jessie
Posts: 169

Original Poster
Rep: Reputation: 55
Quote:
Originally Posted by Keith Hedger View Post
You edited your post, previously it was pointing out a possible error in 7.1/7.2 hence my post.
Yes, I realized I was wrong. I edited it as soon as I realized, but you were quicker at reading it :-)

Anyway, the root of the issue still stands: Does the systemd version need the /var/run/utmp file manually created in Chapter 6.6?
 
Old 01-19-2016, 07:22 PM   #9
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,154

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Yeah was a bit confusing, sorry don't know and don't want to know about systemd, but maybe systemd does need this file, not at my machine at the mo but I will check tomorrow to see if its on my machine, I'll be back.
 
Old 01-20-2016, 05:50 AM   #10
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,154

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Just had a look my system also has this file (utmp) but it is created on startup via the cleanfs script like so
Code:
:> /var/run/utmp

if grep -q '^utmp:' /etc/group ; then
	chmod 664 /var/run/utmp
	chgrp utmp /var/run/utmp
fi
I guess systemd isn't doing this, this is part of the sysv init scripts here:
http://www.linuxfromscratch.org/lfs/...otscripts.html

Guess you will have to fudge it.
 
Old 01-20-2016, 02:36 PM   #11
Krejzi
Member
 
Registered: Jan 2015
Posts: 215

Rep: Reputation: Disabled
Quote:
Originally Posted by kcirick View Post
Yes, I realized I was wrong. I edited it as soon as I realized, but you were quicker at reading it :-)

Anyway, the root of the issue still stands: Does the systemd version need the /var/run/utmp file manually created in Chapter 6.6?
/run/utmp is there on my system. It's created at boot by systemd-tmpfiles service.

Code:
/usr/lib/tmpfiles.d$ grep utmp *
systemd.conf:F! /run/utmp 0664 root utmp -

$ ls -l /run/utmp
-rw-rw-r-- 1 root utmp 1152 Jan 20 13:50 /run/utmp
 
1 members found this post helpful.
Old 01-20-2016, 03:09 PM   #12
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,154

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Maybe the OP just accidently erased it then ran who and users, if as you say systemd creates it, or maybe somthing happend to the permissions?
 
Old 01-20-2016, 10:02 PM   #13
kcirick
Member
 
Registered: Dec 2006
Distribution: Slackware 14.1; LFS 7.9-Systemd; Debian Jessie
Posts: 169

Original Poster
Rep: Reputation: 55
Quote:
Originally Posted by Krejzi View Post
/run/utmp is there on my system. It's created at boot by systemd-tmpfiles service.

Code:
/usr/lib/tmpfiles.d$ grep utmp *
systemd.conf:F! /run/utmp 0664 root utmp -

$ ls -l /run/utmp
-rw-rw-r-- 1 root utmp 1152 Jan 20 13:50 /run/utmp
So I have the same thing. Then I checked whether /var/run was symlinked to /run. It turns out it is not. Should /var/run not be a symlink to /run ? I must have messed up somewhere but can't pinpoint which chapter this corresponds to.
 
Old 01-21-2016, 05:25 AM   #14
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,154

Rep: Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857Reputation: 857
Code:
keithhedger@LFSHal:~-> file /var/run
/var/run: symbolic link to /run
 
Old 01-21-2016, 08:31 AM   #15
kcirick
Member
 
Registered: Dec 2006
Distribution: Slackware 14.1; LFS 7.9-Systemd; Debian Jessie
Posts: 169

Original Poster
Rep: Reputation: 55
I think I know what went wrong.

I install BLFS stuff using a script that makes a pseudo-package using tar. The script then installs (untar) into the system. If the install script tries to create a directory in /var/run, then it might destroy the symlink to /run (something like this happens with /usr/lib64, which should be a symlink to /usr/lib). I see in my /var/run directory cups-related stuff, so I'll have to check if that is the problem.


So would it be safe to copy the stuff that is currently in /var/run to /run, then relink /var/run to /run & reboot?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] X: "loading extension glx" "no screens found" "fatal server error" (w/ nvidia driver) Geremia Slackware 7 12-29-2014 11:00 AM
[SOLVED] "net rpc" "failed to connect to ipc$ share on" or "unable to find a suitable server" larieu Linux - General 0 11-09-2014 12:45 AM
Samba on Fedora 10.10. Originator of docs "owns" it. Other users to share "save as" worded Linux - Newbie 1 03-10-2011 11:23 AM
How do I disable "shutdown" and "restart" options in KDE logout screen for all users? maxgsp Linux - Distributions 1 12-12-2008 03:18 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 04:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration