MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.9k stars 499 forks source link

When updating, get error: cannot remove microsoft.gpg; operation not permitted #5267

Closed linxiaopi closed 2 years ago

linxiaopi commented 2 years ago

Creating a bug report/issue

Required Information

Additional Information (if applicable)

Steps to reproduce

  1. ...run command: dietpi-update and allow the update to run
  2. ...update runs then exits back to update window with the error: cannot remove microsoft.gpg: operation not permitted
  3. try to manually rm microsoft.gpg by logging in as root, but get same error

Expected behaviour

Actual behaviour

Extra details

Joulinar commented 2 years ago

Hi,

can you share following

ls -la /etc/apt/trusted.gpg.d/
linxiaopi commented 2 years ago

Sure. Here it is: drwxr-xr-x 2 root root 4096 Mar 5 2021 . drwxr-xr-x 7 root root 4096 Feb 9 17:00 .. -rw-r--r-- 1 root root 0 Mar 5 2021 microsoft.gpg

linxiaopi commented 2 years ago

Sorry, that didn't format correctly. Here it is again:

drwxr-xr-x 2 root root 4096 Mar  5  2021 .
drwxr-xr-x 7 root root 4096 Feb  9 17:00 ..
-rw-r--r-- 1 root root    0 Mar  5  2021 microsoft.gpg
Joulinar commented 2 years ago

no need to post the information twice. You could simply use the edit function on GitHub. I will go to remove the first post šŸ˜ƒ

microsoft.gpg seems to be an empty file. Could you try following

rm /etc/apt/trusted.gpg.d/microsoft.gpg
MichaIng commented 2 years ago

Looks like you followed an overly sensitive guide stating to make that microsoft.gpg immutable to prevent RPi packages from re-adding the MS VSCode repository šŸ˜„. It was always the best and easiest to simply remove it and have a little trust in the RPi Foundation that they didn't meant this sneaky or harmfully but simply wanted to make it easier for their users to install VSCode. Us as well as the related raspberrypi-sys-mods package both attempt to remove the repo and key, and the immutable flag prevents that.

chattr -i /etc/apt/trusted.gpg.d/microsoft.gpg
dietpi-update 1

Probably I should update our pre-patch to remove the flag automatically, when present.

MichaIng commented 2 years ago

Added a pre-patch: https://github.com/MichaIng/DietPi/commit/9e39014

linxiaopi commented 2 years ago

Looks like you followed an overly sensitive guide stating to make that microsoft.gpg immutable to prevent RPi packages from re-adding the MS VSCode repository šŸ˜„. It was always the best and easiest to simply remove it and have a little trust in the RPi Foundation that they didn't meant this sneaky or harmfully but simply wanted to make it easier for their users to install VSCode. Us as well as the related raspberrypi-sys-mods package both attempt to remove the repo and key, and the immutable flag prevents that.

chattr -i /etc/apt/trusted.gpg.d/microsoft.gpg
dietpi-update 1

Probably I should update our pre-patch to remove the flag automatically, when present.

That did the job. Thanks!

MichaIng commented 2 years ago

I'll mark this as closed then. Feel free to reopen if required.