Thursday, April 10, 2014

Nasty MacPorts bug (sudo not working right)

If you are regular reader of this blog, this post is on a different topic just skip it.

I'm posting this here because this was a hard to find MacPorts bug that comes with the latest version of dbus.  dbus is a KDE utility that's a dependency for lots of packages.

dbus creates a user called "Message Bus" whose shortname is "root".  Which of course trashes sudo, su and creates all sorts of other problems.  To tell if you have been hit by this you can either you will get password errors with sudo and su.

To see if you have this problem do a
dscl . -read /Users/root

If you just get an error you are fine.  If you got hit with the bug you should see something like this:

dsAttrTypeNative:_writers_passwd: root
AppleMetaNodeLocation: /Local/Default
AuthenticationAuthority: deleted

GeneratedUID: deleted
NFSHomeDirectory: /var/empty
Password: ********
PasswordPolicyOptions:




failedLoginCount
0
failedLoginTimestamp
2001-01-01T00:00:00Z
lastLoginTimestamp
2001-01-01T00:00:00Z
passwordLastSetTime
2014-04-10T17:54:50Z



PrimaryGroupID: 80
RealName:
 Message Bus
RecordName: root
RecordType: dsRecTypeStandard:Users
UniqueID: 507
UserShell: /usr/bin/false



Notice the 507, that needs to be 0.  OK now to fix this bug:


  1. Open Users & Groups preferences, click Login Options, then click the lock icon to unlock it. If necessary, type your password, then click Unlock.
  2. In the Network Account Server section, click Join or Edit.
  3. Click Open Directory Utility.
  4. Click the lock icon to unlock it, then enter your administrator name and password.
  5. Change Viewing to Users and look for "Message Bus"
  6. If you have more than one delete the one currently set to root
  7. If you have only one change the RecordName from "root" to "messagebus" 


And now open another shell sudo and su should be working fine.  I'm going to go report this bug into MacPorts but for I couldn't find anything when I Googled so I'm posting this because it was nasty.