Bug 1703203 - home directory not created properly when rpm package creates a user
Summary: home directory not created properly when rpm package creates a user
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm-ostree
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jonathan Lebon
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: IoT
TreeView+ depends on / blocked
 
Reported: 2019-04-25 19:38 UTC by Troy Dawson
Modified: 2019-06-06 15:23 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-06-06 15:23:00 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Troy Dawson 2019-04-25 19:38:53 UTC
Description of problem:
Some rpm packages require a user to be added to run as.  rpm-ostree will create the user fine, except that it won't create the home directory correctly.
When you reboot into the new tree, the home directory is missing.

Version-Release number of selected component (if applicable):
rpm-ostree-2019.3-1.fc29.x86_64
rpm-ostree-2019.3-1.fc30.x86_64

How reproducible:
100%

Steps to Reproduce:
1. rpm-ostree install mozilla-iot-gateway
2. systemctl reboot
3. ls /home

Actual results:
<nornal user directory>

Expected results:
<nornal user directory> moz-iot-gateway


Additional info:
Using the exact same commands as root on the console, creates a user correctly.  It's only when the user is created as a script during an rpm install.

Comment 1 Jonathan Lebon 2019-04-25 19:54:53 UTC
Howdy Troy! :)

So the background info on this is https://bugzilla.redhat.com/show_bug.cgi?id=1352154. I.e. rpm-ostree doesn't want `/var` to be modified during package scriptlets for correct offline upgrades. For example, rpm-ostree synthesizes tmpfiles.d entries from directories created in /var in scriptlets. IOW, instead of scriptlets modifying /var at install time, /var should instead be modified at runtime. This also benefits image creation tools other than rpm-ostree.

Specifically for this case, looking at the spec file... why is moz-iot-gateway doing `useradd -r -m`? Does a system account really need a $HOME? Why not keep its data in /var/lib/ somewhere?

Comment 2 Troy Dawson 2019-04-25 20:56:59 UTC
At least in mozilla-iot-gateway version 0.7, yes the configuration and data need to be in the users $HOME directory.  That directory can be anywhere, but it must be the users $HOME area.

Comment 3 Troy Dawson 2019-04-25 21:27:28 UTC
Basically what you are saying, is that this is a feature and not a bug.
Can you give me an example of a package that does it right, so I can emulate it.

Comment 4 Jonathan Lebon 2019-04-25 21:36:59 UTC
Hmm, so I think it should work to instead create a sysusers entry with:

```
u moz-iot-gateway - "Mozilla IoT Gateway User" /var/lib/moz-iot-gateway /sbin/nologin
m moz-iot-gateway dialout
```

Then the user will be created on the next boot.

Comment 5 Troy Dawson 2019-06-06 15:23:00 UTC
I have fixed my package by creating a sysusers entry, with the home area in /var/lib/moz-iot-gateway.
I am closing this bug with NOT-A-BUG, since this is a feature.

Thanks for the information.


Note You need to log in before you can comment on or make changes to this bug.