[Bug 1575572] Re: apache2 fails to start if installed via cloud config (on Xenial)
Dominique Poulain
dominique.poulain at canonical.com
Tue May 31 10:36:37 UTC 2016
The fix seems to work for me. Here's what I did to check:
I used a VM (xenial_test) booted from a pristine copy of the image at
<https://uec-images.ubuntu.com/xenial/20160528/xenial-server-cloudimg-
amd64-disk1.img> in a local OpenStack environment to verify the fix. I
modified the VM to enable -proposed, and upgraded init-system-helpers to
the -proposed package:
sudo apt-get install init-system-helpers=1.29ubuntu2
I then shut down the VM and generated a new image from it:
nova image-create xenial_test lp1575572-test-img
Finally, I tested with both Cloud Config data and User-Data script
syntax:
1) Cloud Config
cat cloud_conf.yaml
#cloud-config
packages:
- apache2
runcmd:
- "nc -k -l -d 443&"
nova boot --key-name $KEY --flavor m1.small --image lp1575572-test-img
--user-data cloud_conf.yaml lp1575572-test-vm
SSH-ing to the instance:
$ sudo systemctl status apache2
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: active (running) since Tue 2016-05-31 07:23:45 UTC; 40s ago
Docs: man:systemd-sysv-generator(8)
Tasks: 55
Memory: 6.5M
CPU: 87ms
CGroup: /system.slice/apache2.service
├─2321 /usr/sbin/apache2 -k start
├─2324 /usr/sbin/apache2 -k start
└─2325 /usr/sbin/apache2 -k start
May 31 07:23:44 lp1575572-test-vm systemd[1]: Starting LSB: Apache2 web server...
May 31 07:23:44 lp1575572-test-vm apache2[2297]: * Starting Apache httpd web server apache2
May 31 07:23:45 lp1575572-test-vm apache2[2297]: *
May 31 07:23:45 lp1575572-test-vm systemd[1]: Started LSB: Apache2 web server.
# ==> pass
2) User Data
$ cat user-data.sh
#!/bin/sh
output_runlevel() {
echo -n "Current runlevel is "
sudo /sbin/runlevel
}
output_runlevel
sudo DEBIAN_FRONTEND=noninteractive apt-get -q -y update
#sudo sed -ie 's/set +e$/& -x/' /usr/sbin/invoke-rc.d
output_runlevel
sudo DEBIAN_FRONTEND=noninteractive apt-get install -q -y apache2
output_runlevel
sudo nc -k -l -d 443&
nova boot --key-name $KEY --flavor m1.small --image lp1575572-test-img
--user-data user-data.sh lp1575572-test-vm
SSH-ing to the instance:
$ sudo systemctl status apache2
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: active (running) since Tue 2016-05-31 07:29:40 UTC; 1min 20s ago
Docs: man:systemd-sysv-generator(8)
Tasks: 55
Memory: 6.6M
CPU: 119ms
CGroup: /system.slice/apache2.service
├─2332 /usr/sbin/apache2 -k start
├─2335 /usr/sbin/apache2 -k start
└─2336 /usr/sbin/apache2 -k start
May 31 07:29:38 lp1575572-test-vm systemd[1]: Starting LSB: Apache2 web server...
May 31 07:29:38 lp1575572-test-vm apache2[2308]: * Starting Apache httpd web server apache2
May 31 07:29:40 lp1575572-test-vm apache2[2308]: *
May 31 07:29:40 lp1575572-test-vm systemd[1]: Started LSB: Apache2 web server.
# ==> pass
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1575572
Title:
apache2 fails to start if installed via cloud config (on Xenial)
Status in init-system-helpers package in Ubuntu:
Fix Released
Status in systemd package in Ubuntu:
Triaged
Status in init-system-helpers source package in Xenial:
Fix Committed
Status in systemd source package in Xenial:
Won't Fix
Status in systemd package in Debian:
Confirmed
Bug description:
SRU TEST CASE:
Using the following cloud config, apache2 will fail to start on
installation on Xenial:
#cloud-config
packages:
- apache2
See for example:
$ gcloud compute instances create xenial-$(date +%y%m%d-%H%M) --image ubuntu-1604-xenial-v20160420c --image-project ubuntu-os-cloud --metadata-from-file user-data=cloud-config
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
xenial-160427-1050 europe-west1-d n1-standard-1 10.240.0.7 104.155.86.94 RUNNING
$ ssh ubuntu at 104.155.86.94 systemctl status apache2.service
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: inactive (dead)
Docs: man:systemd-sysv-generator(8)
With the fixed init-system-helpers, apache2.service (or any other
service you install via "packages:") should start correctly.
Related Bugs:
* bug 1576692: [cloud-init] fully support package installation in systemd
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/init-system-helpers/+bug/1575572/+subscriptions
More information about the foundations-bugs
mailing list