Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
linxiaopi opened this issue Feb 12, 2022 · 8 comments
Labels
Outside of DietPi scripts eg: user installed/configured software Raspberry Pi Solution available 🥂 Definite solution has been done
Milestone

Comments

@linxiaopi
Copy link

linxiaopi commented Feb 12, 2022

Creating a bug report/issue

Required Information

  • DietPi version | cat /boot/dietpi/.version
    G_DIETPI_VERSION_CORE=7
    G_DIETPI_VERSION_SUB=9
    G_DIETPI_VERSION_RC=0
    G_GITBRANCH='master'
    G_GITOWNER='MichaIng'

  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
    buster 1

  • Kernel version | uname -a
    5.10.63-v7+ #1496 SMP Wed Dec 1 15:58:11 GMT 2021 armv7l GNU/Linux

  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)
    RPi 2 Model B (armv7l)

  • Power supply used | (EG: 5V 1A RAVpower)
    5V 1A

  • SD card used | (EG: SanDisk ultra)
    SanDisk Ultra 8GB

Additional Information (if applicable)

  • Software title | (EG: Nextcloud)
  • Was the software title installed freshly or updated/migrated?
  • Can this issue be replicated on a fresh installation of DietPi?
  • Bug report ID | echo $G_HW_UUID

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

  • ...update should run smoothly with no errors

Actual behaviour

  • ...get error: cannot remove microsoft.gpg: operation not permitted

Extra details

  • ...I had tried to remove the microsoft repository in the past, but I don't remember the commands nor if it was successful
@Joulinar
Copy link
Collaborator

Hi,

can you share following

ls -la /etc/apt/trusted.gpg.d/

@linxiaopi
Copy link
Author

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
Copy link
Author

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
Copy link
Collaborator

Joulinar commented Feb 12, 2022

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
Copy link
Owner

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 MichaIng added Outside of DietPi scripts eg: user installed/configured software Solution available 🥂 Definite solution has been done Raspberry Pi and removed Investigating 🤔 labels Feb 12, 2022
MichaIng added a commit that referenced this issue Feb 12, 2022
- DietPi-Pre-patches | Remove immutable flag from MS VSCode repo and key, when present, else the "raspberrypi-sys-mods" package and our own patch cannot remove them: #5267
@MichaIng
Copy link
Owner

Added a pre-patch: 9e39014

@MichaIng MichaIng added this to the v8.2 milestone Feb 12, 2022
@linxiaopi
Copy link
Author

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Outside of DietPi scripts eg: user installed/configured software Raspberry Pi Solution available 🥂 Definite solution has been done
Projects
None yet
Development

No branches or pull requests

3 participants