Skip to content

[RPM] Build fails with "Permission denied" due to update-mime-database in %install #308

@eximius313

Description

@eximius313

Bug Description
When building an RPM package as a non-root user (which is standard practice), the build fails during the %install phase with I/O error : Permission denied.

Logs

Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.ts4X56
...
+ /usr/lib/rpm/brp-compress /usr
+ update-mime-database /usr/share/mime
I/O error : Permission denied
I/O error : Permission denied
Failed to write XML file; For permission problems, try rerunning as root

Analysis
The issue is located in packages/flutter_app_packager/lib/src/makers/rpm/make_rpm_config.dart.
The command update-mime-database %{_datadir}/mime is wrongly placed inside the %install list.
The %install section is meant for copying files into the %{buildroot}. Running update-mime-database against the system path %{_datadir}/mime (which resolves to /usr/share/mime on the host) attempts to modify the developer's operating system, leading to permission errors.

Solution
Remove the following line from the %install section in MakeRPMConfig.dart:

'update-mime-database %{_datadir}/mime &> /dev/null || :',

This command should only be run in %post and %postun scripts (after the package is installed on the target machine), not during the build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions