linuxmint / mintupdate

The Linux Mint Update Manager
309 stars 152 forks source link

"Restart to apply the updates" even when you update a kernel that is not active at the moment #728

Closed costagabbie closed 1 year ago

costagabbie commented 2 years ago

Describe the bug Once you update a kernel package this message will show up, even if the kernel package that got update is not the active kernel at the moment, for example if i have a 5.13.X and it is the active kernel at the moment but there is a update for 5.4.X, once the mintupdate finishes updating 5.4.X it will display the panel with a message about rebooting to apply the updates.

Screenshots If applicable, add screenshots to help explain your problem, you can just drag & drop them here.

To Reproduce Steps to reproduce the behavior:

  1. Have two kernel 'lines' installed
  2. Boot from one kernel
  3. Update the other kernel
  4. mintupdate will ask you to restart your computer to apply the update of a inactive kernel.

Expected behavior Mint update show this message only when the active kernel line is updated, if im booted on 5.13 and there is a 5.13 update it should show the message, if im on 5.13 and 5.4 updates it should not since it has the potential of confusing inexperienced users.

Distribution:

Software version: 5.8.1

Logs: Copy & paste the log output from Update Manager > View > Information here.

Crash report: Not Applicable

costagabbie commented 2 years ago

I think to fix it On line 430 of mintUpdate.py there is the IF statement that seems to trigger the "reboot warning" so i think that adding a check to see the active kernel (uname-r) match the kernel line updated with: subprocess.check_output(['uname','-r']).decode('utf-8').split('-')[0] would fix it. There might be some syntax errors(i'm really not experienced with python) on it but i think that changing the IF statement to this might work:

activeKernelLine = subprocess.check_output(['uname','-r']).decode('utf-8').split('-')[0]
if update.type == "kernel" and \
   [True for pkg in update.package_names if "-image-" in pkg] and \
   [True for pkg in update.package_names if activeKernelLine in pkg] :
   self.reboot_required = True
LinuxOnTheDesktop commented 1 year ago

This issue is a duplicate of #645.

I am glad to see that @costagabbie has created a fix for the problem!

LinuxOnTheDesktop commented 1 year ago

This problem persists in Mint Vera. I suppose I'll have to try implementing costagabbie's fix. (Also: @costagabbie: thank you for your work; how about submitting a pull request to Mint?) EDIT: any edit that a user makes to the MintUpdate python code is going to get overwritten when the next update to that program comes along . .

costagabbie commented 1 year ago

@LinuxOnTheDesktop done.

LinuxOnTheDesktop commented 1 year ago

@costagabbie : yes, but it's a fact of life around here that a fix is more liable to arise if there is a pull request for it. So, I'll make a PR (crediting you) once I get around to it. (I know that making that PR is trivial but it is not trivial for me, because my git skills are very rudimentary.)

costagabbie commented 1 year ago

@costagabbie : yes, but it's a fact of life around here that a fix is more liable to arise if there is a pull request for it. So, I'll make a PR (crediting you) once I get around to it. (I know that making that PR is trivial but it is not trivial for me, because my git skills are very rudimentary.)

don't worry i already made the pull request for it. now we wait for the developers to notice.

clefebvre commented 1 year ago

Duplicate of https://github.com/linuxmint/mintupdate/issues/645.