Bug 28424

Summary: 'remove-unused-packages' crashes if run as a normal user (should be root)
Product: Mageia Reporter: Rachid Nedjar <r.nedjar>
Component: RPM PackagesAssignee: Mageia tools maintainers <mageiatools>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: Normal CC: fri, ouaurelien, r.nedjar
Version: 8   
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: drakxtools-18.45-1.mga8.src.rpm CVE:
Status comment:
Attachments: Screenshot showing that the application does not crash on M8

Description Rachid Nedjar 2021-02-23 21:58:45 CET
The "remove-unused-packages" program crashed. Drakbug-18.45 caught it.

Essai d'exécuter ce programme en mode Konsole

you must be root to run this program at /usr/lib/libDrakX/common.pm line 596.
Perl's trace:
drakbug::bug_handler() called from /usr/lib/libDrakX/common.pm:596
common::require_root_capability() called from /usr/lib/libDrakX/interactive.pm:103
interactive::vnew() called from /usr/sbin/remove-unused-packages:9

Theme name: Breeze
Kernel version = 5.10.16-desktop-1.mga8
Distribution=Mageia release 8 (Official) for x86_64
CPU=AMD Ryzen 7 3700U with Radeon Vega Mobile Gfx
Rachid Nedjar 2021-02-23 22:00:01 CET

CC: (none) => r.nedjar

Comment 1 Aurelien Oudelet 2021-02-24 17:38:36 CET
Hi, thanks reporting this.

But, when did you try to use this program?

Normally, it is used once by Draklive-installer when installing a Live-media to a hard-drive. It also must be run as root.

This is in not intended to be run on an already installed system.

Source RPM: drakxtools-curses-18.45-1.mga8 => drakxtools-18.45-1.mga8.src.rpm
Keywords: (none) => NEEDINFO
CC: (none) => ouaurelien

Comment 2 Rachid Nedjar 2021-02-24 18:15:25 CET
(In reply to Aurelien Oudelet from comment #1)
> Hi, thanks reporting this.
> 
> But, when did you try to use this program?
> 
> Normally, it is used once by Draklive-installer when installing a Live-media
> to a hard-drive. It also must be run as root.
> 
> This is in not intended to be run on an already installed system.

Hi Aurelien,

In fact, I was trying to figure out how I could easily delete some old linux kernels and I found a link to the "remove-unused-packages" program in a bug tracking post.

If this program is not intended to be run after installation, I think that it should not be executable after installation. I don't know if it's easy to fix or not.

Thank you

Rachid
Comment 3 Lewis Smith 2021-02-28 21:53:55 CET
This discrete program is apparently legitimate post install. I will try it on M8 (running M7 here, where it does work): drakxtools-curses-18.21-1.mga7

CC: (none) => lewyssmith

Comment 4 Aurelien Oudelet 2021-02-28 22:01:02 CET
No, sorry this script is not intended to remove old kernels.

Closing this.
Comment 5 Aurelien Oudelet 2021-02-28 22:04:54 CET
Mid-collision.

Resolution: (none) => INVALID
Status: NEW => RESOLVED
Keywords: NEEDINFO => (none)

Comment 6 Lewis Smith 2021-03-01 20:49:42 CET
Created attachment 12418 [details]
Screenshot showing that the application does not crash on M8

drakxtools-curses-18.44-1.mga8
The unusual language should not matter; the important thing is the program works - launched as root. However, it does crash as described if launched as a normal user: this is not right.
Comment 7 Lewis Smith 2021-03-01 21:14:26 CET
It seems there is already a later version of drakxtools-curses than I have, yet to get updated - and try.
-------------------------
(In reply to Rachid Nedjar from comment #2)
> In fact, I was trying to figure out how I could easily delete some old linux
> kernels
If they are Mageia RPMs, you should use Add/Remove Software, or
 # urpme ...
but to know the package names (different for each kernel), do first:
 $ rpm -qa | grep kernel
Both methods remove all the kernel components.

The harder way is:
 $ ls /boot
and then for each *old* kernel,
 # rm initrd... symvers... System.map... vmlinuz-5.10.16...
X select/paste saves your day!

Resolution: INVALID => (none)
Assignee: bugsquad => mageiatools
Summary: remove-unused-packages crashed => 'remove-unused-packages' crashes if run as a normal user (should be root)
CC: lewyssmith => (none)
Status: RESOLVED => REOPENED

Comment 8 Morgan Leijström 2021-03-02 00:40:56 CET
Examples when this is run separately

1) on persistent Lives media before updating it, to minimise superflous download and storage usage.  (I just did precisely that)

2) some time after Live install if you opted to not do it at install.

CC: (none) => fri

Comment 9 Rachid Nedjar 2021-03-02 19:01:19 CET
Well, I thank you all for your replies and advice.
I do not intend anymore to remove old kernels as I am a Linux noob.
Comment 10 Morgan Leijström 2023-02-10 11:22:25 CET
In mga9 we now have by default a mechanism to remove old kernels
Bug 24403 - Feature request : tool to remove old kernels
Bug 31143 - Add 'remove-old-kernels' to live, classic and net installers.


No reply here for soon two years, so I am closing this bug.

If there is some problem with remove-unused-packages, please open a fresh bug.


Sidenote:
Kernel version naming have changed between mga8 and mga9, some issues may come from that when trying old tools and methods.

Status: REOPENED => RESOLVED
Resolution: (none) => WORKSFORME