Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the /var wrong permission issue #7571

Merged
merged 4 commits into from
May 11, 2021

Conversation

xumia
Copy link
Collaborator

@xumia xumia commented May 10, 2021

Why I did it

Build broken when reproducible build enabled, relative to backport package systemd.
The root cause is the bad permission of /var.

See https://dev.azure.com/mssonic/build/_build/results?buildId=14292&view=logs&j=88ce9a53-729c-5fa9-7b6e-3d98f2488e3f&t=8d99be27-49d0-54d0-99b1-cfc0d47f0318

Issue Analysis:
The owner of the folder /var is not correct, should be root:root, not 1001:redis.
See similar issue: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=950684

xumia@f1b0c55f162c:/sonic$ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot ./fsroot ls -ld /var /var/log
drwxr-xr-x 11 1001 redis 4096 May 10 06:40 /var
drwxr-xr-x  4 root root  4096 May 10 06:45 /var/log

The package rasdaemon has dependency on systemd, the systemd is installed twice in build_debian.sh.
The first one is the package from main, the second one is the package from backport.
When reproducible build enabled, it will only install the backport one. The backport systemd was installed in the PR: #7322

Logs:

The error is "Detected unsafe path transition /var -> /var/log during canonicalization of /var/log/journal.", see more logs as below:

Created symlink /etc/systemd/system/getty.target.wants/[email protected] -> /lib/systemd/system/[email protected].
Created symlink /etc/systemd/system/multi-user.target.wants/remote-fs.target -> /lib/systemd/system/remote-fs.target.
Created symlink /etc/systemd/system/sysinit.target.wants/systemd-pstore.service -> /lib/systemd/system/systemd-pstore.service.
Initializing machine ID from D-Bus machine ID.
Detected unsafe path transition /var -> /var/log during canonicalization of /var/log/journal.
Detected unsafe path transition /var -> /var/log during canonicalization of /var/log/journal.
Detected unsafe path transition /var -> /var/log during canonicalization of /var/log/journal.
dpkg: error processing package systemd (--configure):
 installed systemd package post-installation script subprocess returned error exit status 73
dpkg: dependency problems prevent configuration of systemd-timesyncd:
 systemd-timesyncd depends on systemd (= 247.3-3~bpo10+1); however:
  Package systemd is not configured yet.

dpkg: error processing package systemd-timesyncd (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of rasdaemon:
 rasdaemon depends on systemd; however:
  Package systemd is not configured yet.

dpkg: error processing package rasdaemon (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.28-10) ...
Processing triggers for dbus (1.12.20-0+deb10u1) ...
Errors were encountered while processing:
 systemd
 systemd-timesyncd
 rasdaemon

How I did it

Change the right ownership to root:root for /var.

How to verify it

The issue can be reproduced by following command, no issue after fixed.

make SONIC_CONFIG_BUILD_JOBS=1 SONIC_VERSION_CONTROL_COMPONENTS=all target/sonic-broadcom.bin

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012

Description for the changelog

A picture of a cute animal (not mandatory but encouraged)

build_debian.sh Outdated Show resolved Hide resolved
@qiluo-msft
Copy link
Collaborator

@xumia, you mentioned

The package rasdaemon has dependency on systemd, the systemd is installed twice in build_debian.sh.
The first one is the package from main, the second one is the package from backport.
When reproducible build enabled, it will only install the backport one

Is it possible to make normal build process same as reproducible build process? You may change either one.

@xumia
Copy link
Collaborator Author

xumia commented May 11, 2021

@xumia, you mentioned

The package rasdaemon has dependency on systemd, the systemd is installed twice in build_debian.sh.
The first one is the package from main, the second one is the package from backport.
When reproducible build enabled, it will only install the backport one

Is it possible to make normal build process same as reproducible build process? You may change either one.

@qiluo-msft , yes, we can install the depended packages, then normal build is the same as the reproducible build.
In this case, we can install systemd backports, then install rasdaemon. But the change is not required.

build_debian.sh Outdated Show resolved Hide resolved
@xumia xumia merged commit 79dd3b1 into sonic-net:202012 May 11, 2021
@xumia xumia deleted the fix-package-dependency-2 branch May 11, 2021 10:04
xumia added a commit to xumia/sonic-buildimage-1 that referenced this pull request May 12, 2021
Why I did it
Build broken when reproducible build enabled, relative to backport package systemd.
The root cause is the bad permission of /var.
lguohan pushed a commit that referenced this pull request May 12, 2021
Why I did it
Build broken when reproducible build enabled, relative to backport package systemd.
The root cause is the bad permission of /var.
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
Why I did it
Build broken when reproducible build enabled, relative to backport package systemd.
The root cause is the bad permission of /var.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants