[Bug 808] New: Nonexistent $HOME breaks stuff

bugzilla-daemon at bugzilla.openmoko.org bugzilla-daemon at bugzilla.openmoko.org
Sun Sep 9 04:52:56 CEST 2007


           Summary: Nonexistent $HOME breaks stuff
           Product: OpenMoko
           Version: 2007.2
          Platform: Neo1973
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: sysinit
        AssignedTo: buglog at lists.openmoko.org
        ReportedBy: cwixon at usa.net
                CC: buglog at lists.openmoko.org

On my Neo1973 I have a MicroSD partition mounted at /home (which is analogous to
a pretty typical setup on a desktop Linux system), but the mmc device is brought
up AFTER some of the init scripts expect /home/root -- which is the default path
to the root user's HOME directory -- to already exist.  

As a result, anything spawned by init or the gui finds that HOME=/


(1) Don't hardcode HOME=/home/root

I'm actually not entirely clear on the sequence of events here.

It's currently hardcoded in /etc/X11/Xinit -- oddly, as that script currently
stands, HOME is first set to /home/root, and then if that directory doesn't
exist and /root does, then HOME is set instead to /root.  But if /home/root does
not exist and /root does not exist, the value of HOME is not changed.  (It's not
clear to me whether Xinit is even run, though -- other variables set there don't
show up later.)

Also see /etc/init.d/mountall.sh -- which does sort of a manual version of the
getent | cut and attempts to make the root user's home if it doesn't exist --
though it does not use the HOME variable.  It does this _after_ the mount -a but
for whatever reason, HOME still gets set to / on my device.

In the 2007.2 rootfs, /home/root does not exist at boot, and /root does not
exist at all by default, so HOME ends up as / and various configuration files
get stored there.  It works, but it's not standard to put files there.

It would be preferable to use something like:

export HOME=`getent passwd ${USER} | cut -f6 -d:`

 . . . but getent isn't available in the default rootfs and isn't in busybox. 
And I would submit that Xinit isn't the right place for it.  Perhaps something
in /etc/init.d that runs pretty early in the process would be a better candidate.

(2) As suggested by the Filesystem Hierarchy Standard, include a /root directory
in the rootfs images and use that as the default home directory for the root user.


This should go in the default rootfs /etc/passwd file so that it gets picked up
by the getent, above.

(3) Don't have the user run as root by default!

Yes, this is a known issue and I'm sure it will be rectified at some point, but
I include it here for completeness.  Running this way is the root (ahem) of all

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
You are on the CC list for the bug, or are watching someone who is.

More information about the buglog mailing list