Bug 30520

Summary: mgaapplet crashed
Product: Mageia Reporter: Eric Petit <surfzoid>
Component: RPM PackagesAssignee: Mageia Bug Squad <bugsquad>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: Normal    
Version: 8   
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: mgaonline-3.31-1.1.mga8 CVE:
Status comment:

Description Eric Petit 2022-06-07 15:48:45 CEST
The "mgaapplet" program crashed. Drakbug-18.45 caught it.


i did an su - rm -fr /var/cache/*
After reboot , mgaaplet didn't recreate /var/cache/urpmi with enough right

The "mgaapplet" program crashed. Drakbug-18.45 caught it.



mkdir /var/cache/urpmi: Permission denied at /usr/share/perl5/vendor_perl/urpm.pm line 307.
Perl's trace:
drakbug::bug_handler() called from /usr/share/perl5/Carp.pm:291
Carp::croak() called from /usr/share/perl5/File/Path.pm:239
File::Path::_mkpath() called from /usr/share/perl5/File/Path.pm:195
File::Path::_mkpath() called from /usr/share/perl5/File/Path.pm:173
File::Path::mkpath() called from /usr/share/perl5/vendor_perl/urpm.pm:307
urpm::create_var_lib_rpm() called from /usr/share/perl5/vendor_perl/urpm.pm:294
urpm::set_files() called from /usr/share/perl5/vendor_perl/urpm.pm:152
urpm::new() called from /usr/share/perl5/vendor_perl/Rpmdrake/open_db.pm:80
Rpmdrake::open_db::fast_open_urpmi_db() called from /usr/bin/mgaapplet:63

Theme name: Adwaita
Kernel version = 5.15.43-desktop-1.mga8
Distribution=Mageia release 8 (Official) for x86_64
CPU=Intel(R) Pentium(R) Gold G6400 CPU @ 4.00GHz
Comment 1 sturmvogel 2022-06-07 16:37:23 CEST
Dup 30518

*** This bug has been marked as a duplicate of bug 30518 ***

Resolution: (none) => DUPLICATE
Status: NEW => RESOLVED

Comment 2 sturmvogel 2022-06-07 16:42:56 CEST
Why in particular did you remove this directory? This makes no sense...
To clear the urpmi download cache you have to issue
urpmi --clean
Comment 3 Eric Petit 2022-06-07 16:58:27 CEST
(In reply to sturmvogel from comment #2)
> Why in particular did you remove this directory? This makes no sense...
> To clear the urpmi download cache you have to issue
> urpmi --clean

yes i took a hammer xd, because i forgot an subdir, also an cache should be empty safety, no ?

but if the perl urpmi do an mkdir /var/cache/urpmi withoot privileges This makes no sense...
Comment 4 sturmvogel 2022-06-07 18:08:49 CEST
This directory is not created through execution of the command. This directory is created whilst installation of the package urpmi. Replace/reinstall the package or/and check the permissions.
http://sophie.zarb.org/rpms/391f92c88688a5bfb8d92f7197b52857/files
Comment 5 Eric Petit 2022-06-07 18:45:39 CEST
mkdir /var/cache/urpmi: Permission denied at /usr/share/perl5/vendor_perl/urpm.pm line 307

was executed by mgaaplet
Comment 6 sturmvogel 2022-06-07 19:25:18 CEST
drwxr-xr-x	0	root	root	/var/cache/urpmi
drwxr-xr-x	0	root	root	/var/cache/urpmi/headers
drwxr-xr-x	0	root	root	/var/cache/urpmi/partial
drwxr-xr-x	0	root	root	/var/cache/urpmi/rpms
Comment 7 Eric Petit 2022-06-07 19:48:28 CEST
yes when installing urpm directory are created, And also, when running/calling the perl script /usr/share/perl5/vendor_perl/urpm.pm , let's say, by mgaaplet, if directory aren't here, it creat them with the mkdir comande.

at line 307

sub create_var_lib_rpm {
    my ($urpm, %h) = @_;
    require File::Path;
    File::Path::mkpath([ $h{statedir}, 
			 (map { "$h{cachedir}/$_" } qw(partial rpms)),
			 dirname($h{config}),
			 "$urpm->{root}/var/lib/rpm",
			 "$urpm->{root}/var/tmp",
		     ]);
}

BUT rather other programme who use /var/cache/ like mock for example, the script and/or mgaaplet dom't have the write permission, or right level.
Comment 8 Eric Petit 2022-06-07 19:52:02 CEST
the function is called from an loop at line 292

    $urpm->{$_} = $h{$_} foreach keys %h;

    create_var_lib_rpm($urpm, %h);
Comment 9 Eric Petit 2022-06-07 20:03:53 CEST
if you prefer, do su - rather sudo

sudo rm -fr /var/cache/urpmi/partial
ls -lha /var/cache/urpmi/
sudo mgaapplet
CTRL+C
ls -lha /var/cache/urpmi/

but if you start mgaaplet as normal user you will have a permission denied.

I guess, the perl script is called by other tools, running with root privileges.

a workaround could be to call the su/sudo gui of the DE