[GH-ISSUE #566] dnf install fails and rpm partially fails because postinst.sh has syntax errors #429

Closed
opened 2026-05-07 00:24:03 +02:00 by BreizhHardware · 4 comments

Originally created by @danieldemus on GitHub (Dec 31, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/566

On the first install attempt user and group creation fail, because the syntax of chown is incorrect:
chown ntfy.ntfy /var/cache/ntfy /var/cache/ntfy/attachments /var/lib/ntfy
It should ntfy:ntfy.
On uninstall the group is not necessarily removed, if fx. the apache user is added to it to allow reading the socket. This means that on the next install attempt
id ntfy >/dev/null 2>&1 || useradd --system --no-create-home ntfy fails, when useradd tries to add the group again.
The fedora packaging guidelines at https://fedoraproject.org/wiki/Packaging:UsersAndGroups suggest:

getent group GROUPNAME >/dev/null || groupadd -r GROUPNAME
getent passwd USERNAME >/dev/null || \
    useradd -r -g GROUPNAME -d HOMEDIR -s /sbin/nologin \
    -c "Useful comment about the purpose of this account" USERNAME
exit 0

In this case https://github.com/binwiederhier/ntfy/pull/565 could also do the job.

Originally created by @danieldemus on GitHub (Dec 31, 2022). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/566 On the first install attempt user and group creation fail, because the syntax of chown is incorrect: `chown ntfy.ntfy /var/cache/ntfy /var/cache/ntfy/attachments /var/lib/ntfy` It should `ntfy:ntfy`. On uninstall the group is not necessarily removed, if fx. the apache user is added to it to allow reading the socket. This means that on the next install attempt `id ntfy >/dev/null 2>&1 || useradd --system --no-create-home ntfy` fails, when useradd tries to add the group again. The fedora packaging guidelines at https://fedoraproject.org/wiki/Packaging:UsersAndGroups suggest: ``` getent group GROUPNAME >/dev/null || groupadd -r GROUPNAME getent passwd USERNAME >/dev/null || \ useradd -r -g GROUPNAME -d HOMEDIR -s /sbin/nologin \ -c "Useful comment about the purpose of this account" USERNAME exit 0 ``` In this case https://github.com/binwiederhier/ntfy/pull/565 could also do the job.
Author
Owner

@binwiederhier commented on GitHub (Dec 31, 2022):

This is wild. I didn't know the dot syntax was Ubuntu/Debian specific. Thanks for reporting this and for the PR. You suggested something other than what you did in the PR. Can I close this issue since I just merged the PR?

I'm assuming yes, and am closing this issue. Happy to re-open though if it wasn't complete. Thanks for your contribution.

<!-- gh-comment-id:1368223975 --> @binwiederhier commented on GitHub (Dec 31, 2022): This is wild. I didn't know the dot syntax was Ubuntu/Debian specific. Thanks for reporting this and for the PR. You suggested something other than what you did in the PR. Can I close this issue since I just merged the PR? I'm assuming yes, and am closing this issue. Happy to re-open though if it wasn't complete. Thanks for your contribution.
Author
Owner

@danieldemus commented on GitHub (Dec 31, 2022):

The other solution is from the linked fedora document and can see the copr rpm does use it. I had already committed a fix before I found the link, so ...
Another thing is it's only tested on fedora 37, though I would expect groupadd to be compatible.

<!-- gh-comment-id:1368239463 --> @danieldemus commented on GitHub (Dec 31, 2022): The other solution is from the linked fedora document and can see the copr rpm does use it. I had already committed a fix before I found the link, so ... Another thing is it's only tested on fedora 37, though I would expect groupadd to be compatible.
Author
Owner

@binwiederhier commented on GitHub (Dec 31, 2022):

The groupadd works on Ubuntu too. I tested that. I'm ok with what you added. But I'm also ok with the other one if you want to change it.

<!-- gh-comment-id:1368240551 --> @binwiederhier commented on GitHub (Dec 31, 2022): The groupadd works on Ubuntu too. I tested that. I'm ok with what you added. But I'm also ok with the other one if you want to change it.
Author
Owner

@danieldemus commented on GitHub (Jan 1, 2023):

I can see here https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/, that adding a "proper" rpm spec file would be a better solution for the production rpm packaging. I assume the copr maintainer has one.
I was trying to test something else regarding letsencrypt certs and was build the rpm using the release-snapshot target in the makefile, that was causing the issues, so this is in reality a developer issue on fedora.

<!-- gh-comment-id:1368444884 --> @danieldemus commented on GitHub (Jan 1, 2023): I can see here https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/, that adding a "proper" rpm spec file would be a better solution for the production rpm packaging. I assume the copr maintainer has one. I was trying to test something else regarding letsencrypt certs and was build the rpm using the release-snapshot target in the makefile, that was causing the issues, so this is in reality a developer issue on fedora.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#429
No description provided.