$ 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.
$ 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.
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 d/apache2; bad; vendor preset: enabled) system/ apache2. service. d
└─apache2- systemd. conf sysv-generator( 8) slice/apache2. service
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.
Drop-In: /lib/systemd/
Active: active (running) since Tue 2016-05-31 07:23:45 UTC; 40s ago
Docs: man:systemd-
Tasks: 55
Memory: 6.5M
CPU: 87ms
CGroup: /system.
├─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() { FRONTEND= noninteractive apt-get -q -y update invoke- rc.d FRONTEND= noninteractive apt-get install -q -y apache2
echo -n "Current runlevel is "
sudo /sbin/runlevel
}
output_runlevel
sudo DEBIAN_
#sudo sed -ie 's/set +e$/& -x/' /usr/sbin/
output_runlevel
sudo DEBIAN_
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 d/apache2; bad; vendor preset: enabled) system/ apache2. service. d
└─apache2- systemd. conf sysv-generator( 8) slice/apache2. service
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.
Drop-In: /lib/systemd/
Active: active (running) since Tue 2016-05-31 07:29:40 UTC; 1min 20s ago
Docs: man:systemd-
Tasks: 55
Memory: 6.6M
CPU: 119ms
CGroup: /system.
├─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