cloud-init useradd/groupadd fails on ubuntu-core-16 with readonly /etc/passwd
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
High
|
Ryan Harper | ||
cloud-init (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Unassigned | ||
Yakkety |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
=== Begin SRU Template ===
[Impact]
When running under ubuntu-core 16 images, /etc/passwd is read-only.
If my user-data includes any non-default username, creation fails due to
the read-only nature of the image.
This is addressed by useradd/groupadd including a command line flag, --extrausers
which instructs the command to look for a different user/group database in
/var/lib/extrausers , which is writable in the ubuntu-core 16 image.
[Test Case]
In a snappy image that has cloud-init enabled, launch image with the
following user-data:
#cloud-config
users:
- name: bob
snapuser: <email address hidden>
And also:
#cloud-config
snappy:
email: <email address hidden>
where '<email address hidden>' is your launchpad registered email address.
Assume you can log in.
[Regression Potential]
The code is intended to be backwards compatible and inert unless
cloud-config provided turns it on. It is also gated by a 'system_is_snappy'
method that checks if the system is snappy (ubuntu core).
Unit tests are provided, so regression should be somewhat reduced.
Some code was moved around to implement this, and a new config module was added.
[Other Info]
The upstream change made here is at [1]
[1] https:/
=== End SRU Template ===
When running under ubuntu-core 16 images, /etc/passwd is read-only.
If my user-data includes any non-default username, creation fails due to
the read-only nature of the image.
This is addressed by useradd/groupadd including a command line flag, --extrausers
which instructs the command to look for a different user/group database in
/var/lib/extrausers , which is writable in the ubuntu-core 16 image.
The cc_user_groups module though is not aware of this.
The Distro base-class could check if the system it's running on is snappy (see cc_snappy.py)
and if so, append the --extrausers parameter to the useradd/groupadd commands.
1) release is Xenial (ubuntu-core 16)
2) cloud-init present is: 0.7.7~bzr1256-
3) useradd bob -m should create the user bob
4) useradd fails due to readonly /etc/{passwd,
Related branches
- cloud-init Commiters: Pending requested
-
Diff: 753 lines (+600/-15)8 files modifiedcloudinit/config/cc_snap_config.py (+183/-0)
cloudinit/config/cc_snappy.py (+4/-14)
cloudinit/distros/__init__.py (+35/-0)
cloudinit/util.py (+12/-0)
config/cloud.cfg (+1/-0)
doc/examples/cloud-config-user-groups.txt (+8/-0)
tests/unittests/test_distros/test_user_data_normalize.py (+65/-0)
tests/unittests/test_handler/test_handler_snappy.py (+292/-1)
Changed in cloud-init (Ubuntu): | |
status: | New → Confirmed |
importance: | Undecided → High |
Changed in cloud-init: | |
status: | New → Confirmed |
importance: | Undecided → High |
assignee: | nobody → Ryan Harper (raharper) |
Changed in cloud-init: | |
status: | Confirmed → In Progress |
description: | updated |
Changed in cloud-init (Ubuntu Xenial): | |
importance: | Undecided → Medium |
status: | New → Confirmed |
fixed in trunk at d8534561ba76db2 5b6fc0044eb1bfd a63686e859