samba-common-bin should call systemd-tmpfiles before testparm

Bug #1905387 reported by Eduardo Lengler
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
samba (Debian)
Fix Released
Unknown
samba (Ubuntu)
Fix Released
Medium
Unassigned
Focal
Fix Released
Undecided
Athos Ribeiro
Groovy
Fix Released
Undecided
Athos Ribeiro

Bug Description

[Impact]

The samba-common-bin postinst script relies on the presence of the /run/samba directory. This directory will not be available unless samba-common-bin is installed right after samba-common, whose postinst script creates /run/samba. Although samba-common-bin Depends on samba-common, reducing the risk of an user hitting the described bug, samba-common only Recommends samba-common-bin, making the following case possible:

The user installs samba-common. Then, the user removes samba-common-bin. Then the user reboots the system (which removes /run/samba created during samba-common installation). Finally, the user installs samba-common-bin, which results in a postinst script failure.

[Test Plan]

To reproduce the issue, run the following steps:

# apt install samba-common
# apt remove samba-common-bin

Reboot the system and verify that the /run/samba directory no longer exists

Run

# apt install samba-common-bin

This command should exit with a non-zero status, as described in the original bug report.

After applying the proposed changes, performing the steps above should result in a successful exit status for the last command.

[Where problems could occur]

There are 2 changes to be considered here. The one to d/rules and the one to d/samba-common-bin.postinst

The change to d/rules makes the #DEBHELPER# tag, moved in the change to d/samba-common-bin.postinst to actually generate code.

Still, if the systemd-tmpfiles command does not run (e.g., there is no systemd available in the system), the issue this SRU is fixing will still manifest itself under the described conditions (which is true for hirsute, impish, and Debian stable as well).

[Other Info]

This issue was already fixed in Debian unstable and, consequently, in Ubuntu hirsute and impish.

[Original message]

ProblemType: Package
DistroRelease: Ubuntu 20.04
Package: samba-common-bin 2:4.11.6+dfsg-0ubuntu1.6
ProcVersionSignature: Ubuntu 5.4.0-54.60-generic 5.4.65
Uname: Linux 5.4.0-54-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.12
Architecture: amd64
CasperMD5CheckResult: skip
Date: Tue Nov 24 07:17:34 2020
DistributionChannelDescriptor:
 # This is the distribution channel descriptor for the OEM CDs
 # For more information see http://wiki.ubuntu.com/DistributionChannelDescriptor
 canonical-oem-somerville-bionic-amd64-20180608-47+loki-n3-v3-whl+X32
ErrorMessage: o subprocesso instalado, do pacote samba-common-bin, o script post-installation retornou erro do status de saída 1
InstallationDate: Installed on 2020-11-12 (11 days ago)
InstallationMedia: Ubuntu 18.04 "Bionic" - Build amd64 LIVE Binary 20180608-09:38
Python3Details: /usr/bin/python3.8, Python 3.8.5, python3-minimal, 3.8.2-0ubuntu2
PythonDetails: /usr/bin/python2.7, Python 2.7.18, python-is-python2, 2.7.17-4
RelatedPackageVersions:
 dpkg 1.19.7ubuntu3
 apt 2.0.2ubuntu0.1
SambaClientRegression: Yes
SourcePackage: samba
Title: package samba-common-bin 2:4.11.6+dfsg-0ubuntu1.6 failed to install/upgrade: o subprocesso instalado, do pacote samba-common-bin, o script post-installation retornou erro do status de saída 1
UpgradeStatus: Upgraded to focal on 2020-11-21 (3 days ago)

Related branches

Revision history for this message
Eduardo Lengler (eduardolengler) wrote :
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the bug report.

Based on your logs, this is the error that's happening:

Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
ERROR: lock directory /run/samba does not exist

ERROR: pid directory /run/samba does not exist

Server role: ROLE_STANDALONE

dpkg: erro ao processar o pacote samba-common-bin (--configure):
 o subprocesso instalado, do pacote samba-common-bin, o script post-installation retornou erro do status de saída 1

This issue is known and has been reported to the Debian samba package as well:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=975422

Although I wasn't able to reproduce it, the rationale described in the link above makes sense to me, and I can confirm that, on Focal, samba-common-bin.postinst is calling systemd-tmpfiles *after* calling testparm, which is what causes this issue.

Debian's fix is here:

https://salsa.debian.org/samba-team/samba/-/commit/0c3b2056764cd1a566766c3e1764d7c312eab5d7

I'm adding this bug to our TODO list, and marking it as Triaged.

Changed in samba (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
summary: - package samba-common-bin 2:4.11.6+dfsg-0ubuntu1.6 failed to
- install/upgrade: o subprocesso instalado, do pacote samba-common-bin, o
- script post-installation retornou erro do status de saída 1
+ samba-common-bin should call systemd-tmpfiles before testparm
Changed in samba (Ubuntu Focal):
status: New → Triaged
Changed in samba (Ubuntu Groovy):
status: New → Triaged
Changed in samba (Ubuntu Focal):
assignee: nobody → Athos Ribeiro (athos-ribeiro)
description: updated
Changed in samba (Ubuntu Groovy):
assignee: nobody → Athos Ribeiro (athos-ribeiro)
description: updated
description: updated
Changed in samba (Ubuntu Focal):
status: Triaged → In Progress
Changed in samba (Ubuntu Groovy):
status: Triaged → In Progress
Changed in samba (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote :

Looking at the SRU for Groovy it doesn't seem that everything included in the changes is actually a part of the version of samba that we have in Impish. Is there a reason the test reinstall-samba-common-bin and the changes to debian/rules aren't included in Impish?

Changed in samba (Ubuntu):
assignee: nobody → Brian Murray (brian-murray)
status: Fix Released → Incomplete
Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Eduardo, or anyone else affected,

Accepted samba into groovy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/samba/2:4.12.5+dfsg-3ubuntu4.4 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-groovy to verification-done-groovy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-groovy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in samba (Ubuntu Groovy):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-groovy
Revision history for this message
Timo Aaltonen (tjaalton) wrote :

hmm, I accepted the groovy upload but didn't notice comment #3 until too late.. I didn't process focal

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Hi Brian,

The changes in debian/rules are not required in impish (nor hirsute) because they are using debhelper compat 13, where the #DEBHELPER# tag in the relevant postinst script will be properly expanded to make the necessary "systemd-tmpfiles" call (see [1] for further reference). Note that the change moving the #DEBHELPER# tag to the beginning of the postinst script is already present in impish and hirsute and this is why these series are not affected.

Finally, regarding the new reinstall-samba-common-bin test case, this is the actual reproducer for the bug here reported. Since it was submitted and accepted in Debian, and given that hirsute and impish are not affected by this bug, I thought that adding the test case to the impish/hirsute deltas would not be needed/wanted. Would this be considered as an SRU policy break since it is a test case only? If so, I'd be happy to propose changes to include these tests in impish and hirsute as well.

[1] https://launchpad.net/debian/+source/debhelper/12.10

Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Eduardo, or anyone else affected,

Accepted samba into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/samba/2:4.11.6+dfsg-0ubuntu1.9 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in samba (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed-focal
Revision history for this message
Brian Murray (brian-murray) wrote :

Thanks for the clarification, I've gone ahead and accepted the package. It might be nice to add the test case to the version of the samba in Debian to ensure we don't encounter a regression but its not a blocker.

Changed in samba (Ubuntu):
assignee: Brian Murray (brian-murray) → nobody
status: Incomplete → Fix Released
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (samba/2:4.11.6+dfsg-0ubuntu1.9)

All autopkgtests for the newly accepted samba (2:4.11.6+dfsg-0ubuntu1.9) for focal have finished running.
The following regressions have been reported in tests triggered by the package:

libsoup2.4/2.70.0-1 (amd64)
gvfs/1.44.1-1ubuntu1 (amd64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/focal/update_excuses.html#samba

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Test results for groovy with samba 2:4.12.5+dfsg-3ubuntu4.4 available in -proposed:

# apt update && apt install -y samba-common && apt remove -y samba-common-bin
# reboot
# if test ! -d /run/samba; then echo 'OK: Proceed with testing'; else echo 'FAIL: do not proceed with testing'; fi
> OK: Proceed with testing
# apt install -y samba-common-bin
# if [ $? -eq 0 ]; then echo SUCCESS; else echo FAIL; fi
> SUCCESS

Test results for focal with samba 2:4.11.6+dfsg-0ubuntu1.9 available in -proposed:

# apt update && apt install -y samba-common && apt remove -y samba-common-bin
# reboot
# if test ! -d /run/samba; then echo 'OK: Proceed with testing'; else echo 'FAIL: do not proceed with testing'; fi
> OK: Proceed with testing
# apt install -y samba-common-bin
# if [ $? -eq 0 ]; then echo SUCCESS; else echo FAIL; fi
> SUCCESS

Which confirms the fix for both focal and groovy.

tags: added: verification-done verification-done-focal verification-done-groovy
removed: verification-needed verification-needed-focal verification-needed-groovy
Changed in samba (Debian):
status: Unknown → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for samba has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package samba - 2:4.12.5+dfsg-3ubuntu4.4

---------------
samba (2:4.12.5+dfsg-3ubuntu4.4) groovy; urgency=medium

  * Fix samba-common-bin postinst errors (LP: #1905387)
    - d/rules: ensure systemd-tmpfiles runs for samba-common-bin postinst
      through dh_installsystemd
    - d/samba-common-bin.postinst: ensure systemd-tmpfiles is called before
      testparm
    - d/t/reinstall-samba-common-bin: make sure /run/samba is created by the
      samba-common-bin installation process (postinst script)
    - d/t/control: run new reinstall-samba-common-bin test case

 -- Athos Ribeiro <email address hidden> Thu, 27 May 2021 09:22:22 -0300

Changed in samba (Ubuntu Groovy):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package samba - 2:4.11.6+dfsg-0ubuntu1.9

---------------
samba (2:4.11.6+dfsg-0ubuntu1.9) focal; urgency=medium

  * Fix samba-common-bin postinst errors (LP: #1905387)
    - d/rules: ensure systemd-tmpfiles runs for samba-common-bin postinst
      through dh_installsystemd
    - d/samba-common-bin.postinst: ensure systemd-tmpfiles is called before
      testparm
    - d/t/reinstall-samba-common-bin: make sure /run/samba is created by the
      samba-common-bin installation process (postinst script)
    - d/t/control: run new reinstall-samba-common-bin test case

 -- Athos Ribeiro <email address hidden> Mon, 24 May 2021 16:45:27 -0300

Changed in samba (Ubuntu Focal):
status: Fix Committed → Fix Released
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.