
`/etc/kernel/postinst.d/nova-kernel-permissions.sh` (introduced to fix Bug #1507915) is supposed to make newly installed kernels readable to the nova user, as kernels on an Ubuntu system are otherwise only readable to the root user [0]. This script didn't work for a few reasons: - It never ran, because scripts in `/etc/kernel/postinst.d` are called by `run-parts`, and run-parts skips any script with a period in the name [1]. - Its shebang was missing its bang - If installation of the same kernel is installed more than once (e.g. reinstallation), `dpkg-statoverride` (and the whole kernel installation) would exit with error, complaining about an override already existing [2]. Fixed with these changes respectively: - Renamed script to remove the period - Fixed typo in shebang - Added `--force` flag to `dpkg-statoverride` [0] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725 [1] https://bugs.launchpad.net/ubuntu/+source/debianutils/+bug/38022 [2] https://bugs.launchpad.net/openstack-manuals/+bug/1275080 Change-Id: I0e130e3c3ecf2171dbdc0e9a809f8066c30d4bc9 Closes-Bug: 1763479
40 lines
1.4 KiB
YAML
40 lines
1.4 KiB
YAML
---
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
- name: Find installed kernels
|
|
find:
|
|
paths: '/boot'
|
|
patterns: 'vmlinuz-*'
|
|
register: kernels
|
|
|
|
- name: Determine latest installed kernel
|
|
set_fact:
|
|
latest_kernel: "{{ kernels.files | map(attribute='path') | sort(reverse=True) | first }}"
|
|
|
|
- name: Latest kernel readable to nova group/user
|
|
command: 'dpkg-statoverride --update --add root nova 0640 {{ latest_kernel }}'
|
|
register: dpkg_statoverride_result
|
|
changed_when: >
|
|
'an override for \'{{ latest_kernel }}\' already exists; aborting'
|
|
not in dpkg_statoverride_result.stderr
|
|
failed_when: >
|
|
(dpkg_statoverride_result.rc != 0) and
|
|
('an override for \'{{ latest_kernel }}\' already exists; aborting'
|
|
not in dpkg_statoverride_result.stderr)
|
|
|
|
- name: Script installed to make future kernels readable to nova group/user
|
|
copy:
|
|
src: 'nova_kernel_permissions'
|
|
dest: '/etc/kernel/postinst.d/nova_kernel_permissions'
|
|
mode: '0755'
|