Debian: Unable to copy branding tarball to /opt/branding even with sudo permissions

Bug #1996182 reported by Takamasa Takenaka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Low
Takamasa Takenaka

Bug Description

Brief Description
-----------------
The manual test indicates to copy a branding tarball to the /opt/branding location
The user can not copy to this location even with sudo permissions

Severity
--------
Minor

Steps to Reproduce
------------------
sysadmin@controller-1:~$ sudo cp test_branding.tgz /opt/branding/test_branding.tgz
Password:
cp: cannot create regular file '/opt/branding/test_branding.tgz': Read-only file system

Expected Behavior
------------------
User should be able to copy the tarball to that location as per horizon branding document

Actual Behavior
----------------
User cannot copy the tarball.
cp: cannot create regular file '/opt/branding/test_branding.tgz': Read-only file system

Reproducibility
---------------
Reproducible (100%)

System Configuration
--------------------
Controller in any system

Branch/Pull Time/Commit
-----------------------
master

Last Pass
---------
In Centos
New for Debian

Timestamp/Logs
--------------
N/A

Test Activity
-------------
Feature Testing, Regression Testing

Workaround
----------
sysadmin@controller-1:~$ sudo mount /usr -o remount,rw
sysadmin@controller-1:~$ sudo cp test_branding.tgz /opt/branding/test_branding.tgz
sysadmin@controller-1:~$ cd /opt/branding
sysadmin@controller-1:/opt/branding$ ls
test_branding.tgz

Changed in starlingx:
assignee: nobody → Takamasa Takenaka (ttakenak)
status: New → In Progress
Ghada Khalil (gkhalil)
tags: added: stx.gui
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ansible-playbooks (master)

Reviewed: https://review.opendev.org/c/starlingx/ansible-playbooks/+/864061
Committed: https://opendev.org/starlingx/ansible-playbooks/commit/edf85ae8f0f8ca5fce4e2b08d794b11752d813d5
Submitter: "Zuul (22348)"
Branch: master

commit edf85ae8f0f8ca5fce4e2b08d794b11752d813d5
Author: Takamasa Takenaka <email address hidden>
Date: Tue Nov 8 13:10:05 2022 -0300

    Add "/" at the end of path to recognize as directory

    Currently /opt/branding is checked with stat.
    The patch: https://review.opendev.org/c/starlingx/tools/+/863560
    will replace with the symbolic file to /var/branding
    This stat is evaluated in when condition later with isdir
    but it is not recognized as directory.

    The fix is added slash at the end of path, so that
    it is recognized as a directory.

    Test Plan:
    PASS: Place a branding tar in /opt/branding
          before running ansible in fresh install.
          Run ansible and confirm the branding tar file
          is copied to /opt/platform/config/22.12/branding

    Partial-bug: 1996182

    Signed-off-by: Takamasa Takenaka <email address hidden>
    Change-Id: I3cbc72b8cc3f129768991f5508c2651099641483

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tools (master)

Reviewed: https://review.opendev.org/c/starlingx/tools/+/863560
Committed: https://opendev.org/starlingx/tools/commit/cb140d1b8e4ee0c879b00c417a93ad701b51f9c5
Submitter: "Zuul (22348)"
Branch: master

commit cb140d1b8e4ee0c879b00c417a93ad701b51f9c5
Author: Takamasa Takenaka <email address hidden>
Date: Thu Nov 3 17:54:51 2022 -0300

    Make /opt/branding writable

    /opt/branding is used by end user to place their own
    theme for horizon. Branding files would be placed during
    installation or after installation but needs to be writable.

    Currently:
    /opt -> /var/rootdirs/opt
    /var/rootdirs/opt/branding -> /usr/rootdirs/opt/branding
    /dev/sda5 on /usr type ext4 (ro,noatime)
    So that, /opt/branding is read-only and user cannot place
    the branding file.

    This fix is creating new directory /var/branding and
    link to /opt/branding (by /usr/rootdirs/opt/branding)

    Closes-bug: 1996182

    Test Plan:
    PASS: Fresh install and confirm /opt/branding is writable.
    PASS: Copy branding tar file to /opt/branding before
          running ansible. Confirm branding tar file is extracted
          in /opt/branding when installation is finished.
    PASS: Copy branding tar file to /opt/branding after
          installation. Confirm branding tar file is extracted
          in /opt/branding after restarting horizon.
    PASS: Place branding file and upgrade. Confirm the branding
          file stays in /opt/branding and confirm the branding
          theme is applied in horizon.
    PASS: Run backup script and confirm branding tar file
          is included in the backup tar file.
    PASS: Run restore script and confirm branding tar file
          is restored in /opt/branding.

    Depends-On: https://review.opendev.org/c/starlingx/ansible-playbooks/+/864061

    Signed-off-by: Takamasa Takenaka <email address hidden>
    Change-Id: I292bace041ea9001d511647c5d04bc6bea99a0bd

Changed in starlingx:
status: In Progress → Fix Released
Ghada Khalil (gkhalil)
Changed in starlingx:
importance: Undecided → Low
tags: added: stx.8.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.