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

Building deb package fails on ubuntu 24.04 #921

Open
borgmanJeremy opened this issue Apr 30, 2024 · 7 comments · May be fixed by #926
Open

Building deb package fails on ubuntu 24.04 #921

borgmanJeremy opened this issue Apr 30, 2024 · 7 comments · May be fixed by #926

Comments

@borgmanJeremy
Copy link

I spun up a clean 24.04 ubuntu VM and an ubuntu 22.04 VM to do back to back testing. I followed the directions to build the deb package from here: https://github.com/jimsalterjrs/sanoid/blob/master/INSTALL.md

When building on ubuntu 24.04 I get the following error when the deb is unpacked. I believe the issue is related to the "sanoid.timer.dpkg-new" line, not the warning below that. The permission denied warning is present on 22.04 and 24.04.

Unpacking sanoid (2.2.0) ...
dpkg: error processing archive /tmp/apt-dpkg-install-sXtixa/6-sanoid_2.2.0_all.deb (--unpack):
 unable to open '/usr/lib/systemd/system/sanoid.timer.dpkg-new': No such file or directory
No apport report written because the error message indicates an issue on the local system
                                                                                         Errors were encountered while processing:
 /tmp/apt-dpkg-install-sXtixa/6-sanoid_2.2.0_all.deb
needrestart is being skipped since dpkg has failed
N: Download is performed unsandboxed as root as file '/home/jeremy/sanoid_2.2.0_all.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
E: Sub-process /usr/bin/dpkg returned an error code (1)
@borgmanJeremy
Copy link
Author

borgmanJeremy commented May 1, 2024

Interestingly, if I build the exact same sanoid release (2.2.0) on ubuntu 22.04, and scp the .deb file to the ubuntu 24.04 machine, I can install it. So the issue is something specific to the .deb built on 24.04.

I diff'ed the two debs and the main difference seems to be the deb built on 24.04 is putting sanoid.service in /usr/lib/systemd/system/ and the deb built on 22.04 is putting sanoid.timer in /lib/systemd/system
image

Full Diff
diff -r -u 22/control 24/control
--- 22/control	2023-07-18 03:04:00.000000000 -0500
+++ 24/control	2023-07-18 03:04:00.000000000 -0500
@@ -2,7 +2,7 @@
 Version: 2.2.0
 Architecture: all
 Maintainer: Jim Salter <[email protected]>
-Installed-Size: 184
+Installed-Size: 185
 Depends: libcapture-tiny-perl, libconfig-inifiles-perl, zfsutils-linux | zfs, perl:any
 Recommends: gzip, lzop, mbuffer, openssh-client | ssh-client, pv
 Section: utils
Only in 22/lib/systemd/system: sanoid.service
diff -r -u 22/md5sums 24/md5sums
--- 22/md5sums	2023-07-18 03:04:00.000000000 -0500
+++ 24/md5sums	2023-07-18 03:04:00.000000000 -0500
@@ -1,6 +1,7 @@
 fa9c302de07fb7945a2ba051b89469ee  lib/systemd/system/sanoid-prune.service
-1322db103b1b7edf1003327ece81663f  lib/systemd/system/sanoid.service
 e0171025e5d7357f0bdd37d5407288a1  lib/systemd/system/sanoid.timer
+1322db103b1b7edf1003327ece81663f  usr/lib/systemd/system/sanoid.service
+e0171025e5d7357f0bdd37d5407288a1  usr/lib/systemd/system/sanoid.timer
 30006d6f9ced1f15025940a67769ef94  usr/sbin/findoid
 8d3d7dabff7750af84fa962798aa8d20  usr/sbin/sanoid
 5f537b83715b47697ce6b52840f82c5f  usr/sbin/sleepymutex
@@ -8,6 +9,6 @@
 10c1233f7011cb0ba82cdf7127a3dd54  usr/share/doc/sanoid/README.Debian
 6e7826123f731e0c49a8a70884052ce0  usr/share/doc/sanoid/README.md.gz
 a35fe2a414a7cfaf760ba0cb7af865b7  usr/share/doc/sanoid/TODO
-4f80a8aa9854dcf6bc1e4e13475a8996  usr/share/doc/sanoid/changelog.gz
+37c07479c9d71949bc19b27c48487d0b  usr/share/doc/sanoid/changelog.gz
 0351f3bf1fc4ddd2b1116df5651f385c  usr/share/doc/sanoid/copyright
 1f665d362540300616bfb99a3cb0fac4  usr/share/doc/sanoid/sanoid.conf.example
diff -r -u 22/postrm 24/postrm
--- 22/postrm	2023-07-18 03:04:00.000000000 -0500
+++ 24/postrm	2023-07-18 03:04:00.000000000 -0500
@@ -1,35 +1,21 @@
 #!/bin/sh
 set -e
-# Automatically added by dh_systemd_start/13.6ubuntu1
+# Automatically added by dh_systemd_start/13.14.1ubuntu5
 if [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
 	systemctl --system daemon-reload >/dev/null || true
 fi
 # End automatically added section
-# Automatically added by dh_systemd_enable/13.6ubuntu1
-if [ "$1" = "remove" ]; then
-	if [ -x "/usr/bin/deb-systemd-helper" ]; then
-		deb-systemd-helper mask 'sanoid-prune.service' >/dev/null || true
-	fi
-fi
-
+# Automatically added by dh_systemd_enable/13.14.1ubuntu5
 if [ "$1" = "purge" ]; then
 	if [ -x "/usr/bin/deb-systemd-helper" ]; then
 		deb-systemd-helper purge 'sanoid-prune.service' >/dev/null || true
-		deb-systemd-helper unmask 'sanoid-prune.service' >/dev/null || true
 	fi
 fi
 # End automatically added section
-# Automatically added by dh_systemd_enable/13.6ubuntu1
-if [ "$1" = "remove" ]; then
-	if [ -x "/usr/bin/deb-systemd-helper" ]; then
-		deb-systemd-helper mask 'sanoid.timer' >/dev/null || true
-	fi
-fi
-
+# Automatically added by dh_systemd_enable/13.14.1ubuntu5
 if [ "$1" = "purge" ]; then
 	if [ -x "/usr/bin/deb-systemd-helper" ]; then
 		deb-systemd-helper purge 'sanoid.timer' >/dev/null || true
-		deb-systemd-helper unmask 'sanoid.timer' >/dev/null || true
 	fi
 fi
 # End automatically added section
diff -r -u 22/prerm 24/prerm
--- 22/prerm	2023-07-18 03:04:00.000000000 -0500
+++ 24/prerm	2023-07-18 03:04:00.000000000 -0500
@@ -1,6 +1,6 @@
 #!/bin/sh
 set -e
-# Automatically added by dh_systemd_start/13.6ubuntu1
+# Automatically added by dh_systemd_start/13.14.1ubuntu5
 if [ -z "${DPKG_ROOT:-}" ] && [ "$1" = remove ] && [ -d /run/systemd/system ] ; then
 	deb-systemd-invoke stop 'sanoid.timer' >/dev/null || true
 fi
Only in 22: sanoid_2204.deb
Only in 24: sanoid_2404.deb
Only in 24/usr: lib
Binary files 22/usr/share/doc/sanoid/changelog.gz and 24/usr/share/doc/sanoid/changelog.gz differ

Edit:
I poked around debian source code and think this might be related but I'm well outside my expertise at this point:

https://salsa.debian.org/debian/sanoid/-/commit/8284d3d0e822bfd7797c6f252bb8c80fb64ea242
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1054088

@jimsalterjrs
Copy link
Owner

A note: any Debian packaging you find here is welcome, but not properly "supported." As far as I know, whoever maintains the Debian package itself does their own private packaging; either way, I'm not a Debian packaging expert and I can't help much.

If you want to install the latest version from master, you don't necessarily need to build a package at all; you can literally just copy sanoid and syncoid into /usr/local/bin, copy sanoid.defaults.conf into /etc/sanoid, and craft yourself an /etc/sanoid/sanoid.conf file to define what you want it to do with your stuff.

There are a couple of Perl (CPAN) dependencies which can be satisfied either directly from Perl's CPAN repos, or from your distribution's repositories (which is the way I generally do it, as well as the way any distro repository packaging will be doing it).

Off the top of my head, on Debian or Ubuntu those dependencies should be satisfied with apt install pv mbuffer lzop libconfig-ini-perl libcapture-tiny-perl; you can also find them documented directly in code comments at the head of sanoid and syncoid themselves.

@n0099
Copy link

n0099 commented May 6, 2024

#379

@borgmanJeremy
Copy link
Author

Thanks @n0099 but you can see from my logs I had already tried to build in /temp and the issue still occurred.

I need to diff the build files here with the Debian official package but haven't found time yet.

@hcw70
Copy link

hcw70 commented Jun 3, 2024

Affects me too. I get the same error on my Ubuntu 24.04.

@n0099
Copy link

n0099 commented Jun 3, 2024

#921 (comment)

Interestingly, if I build the exact same sanoid release (2.2.0) on ubuntu 22.04, and scp the .deb file to the ubuntu 24.04 machine, I can install it.

# syntax=docker/dockerfile:latest
# https://github.com/jimsalterjrs/sanoid/issues/921
FROM ubuntu:22.04
WORKDIR /

RUN <<BASH
# https://mywiki.wooledge.org/BashFAQ/105
# https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425
set -euxo pipefail

sed -i 's/archive\.ubuntu\.com/azure.\0/' /etc/apt/sources.list
apt update
# https://github.com/jimsalterjrs/sanoid/blob/master/INSTALL.md
apt install -y debhelper libcapture-tiny-perl libconfig-inifiles-perl pv lzop mbuffer build-essential git
BASH

RUN <<BASH
# https://mywiki.wooledge.org/BashFAQ/105
# https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425
set -euxo pipefail

git clone https://github.com/jimsalterjrs/sanoid.git
cd sanoid
# checkout latest stable release or stay on master for bleeding edge stuff (but expect bugs!)
git checkout $(git tag | grep "^v" | tail -n 1)
git cherry-pick --no-commit 07b6d6344c2ba6d230f34a3e4216d4f8e4b73e0e # for openzfs-*.deb
ln -s packages/debian .
dpkg-buildpackage -uc -us
mkdir /artifacts
cp ../sanoid*.deb /artifacts
BASH

FROM scratch
COPY --from=0 /artifacts /

@phreaker0 phreaker0 linked a pull request Jun 3, 2024 that will close this issue
@hcw70
Copy link

hcw70 commented Jun 10, 2024

The fix from #926 works for me. Cherry-picked onto v2.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants