apt upgrade gives "Operation not permitted"

Tags:

Answer: 1

7 hours ago

While trying to upgrade Ubuntu 21.10 by running apt upgrade as root, I get the following error:

dpkg: error processing archive /var/cache/apt/archives/login_1%3a4.8.1-1ubuntu9_amd64.deb (--unpack):
 unable to create '/usr/share/man/zh_CN/man1/login.1.gz.dpkg-new' (while processing './usr/share/man/zh_CN/man1/login.1.gz'): Operation not permitted
Errors were encountered while processing:
 /var/cache/apt/archives/login_1%3a4.8.1-1ubuntu9_amd64.deb

Further inspection suggests it may have to do with the extended attributes of /usr/share/man/zh_CN/man1.

When running lsattr -ld /usr/share/man/zh_CN/man1/ it outputs:

/usr/share/man/zh_CN/man1/   Synchronous_Updates, Immutable, Append_Only, Compression_Requested, Extents

Can I safely remove these attributes (I expect them to be there for a reason)? Or is there some other upgrade command I need to perform?

Answer: 2

18 hours ago

As I can see, you're using an antivirus! Disable that antivirus and proceed.

Note: I'm pretty sure this is due to McAfee, so, please run every suggested command step by step until the problem is fixed.

  1. First, run the following commands to disable any instance of antivirus:

    sudo dpkg --purge mfedx 
    sudo dpkg --purge mcafeetp 
    sudo dpkg --purge mcafeeespaac 
    sudo dpkg --purge mcafeeespfileaccess 
    Sudo dpkg --purge mcafeeesp 
    sudo dpkg --purge mcafeert 
    sudo dpkg --purge mfecma 
    sudo dpkg --purge mfert
    
  2. Remove any antivirus/security/blocker program you're using.

  3. Run the following commands:

    sudo apt --fix-broken install
    sudo apt upgrade  
    

  1. If the upgrade still showed errors, then also run:

    sudo apt clean 
    sudo apt autoremove 
    sudo dpkg -i ./var/cache/apt/archives*.deb
    sudo dpkg -i --force-overwrite /var/cache/apt/archives/login_1%3a4.8.1-1ubuntu9_amd64.deb
    
  2. Now update and upgrade:

    sudo apt update
    sudo apt full-upgrade
    

Still not fixed?

  1. If it's still showing errors, I'd recommend reinstalling the packages.

    sudo rm -r /var/cache/apt/archives/*.deb
    sudo apt update
    sudo apt upgrade
    
  2. Check if you have all the dependencies installed.

    The package login depends on:

    • libaudit1 (>= 1:2.2.1)

      Dynamic library for security auditing

    • libc6 (>= 2.33)

      GNU C Library: Shared libraries

    • libcrypt1 (>= 1:4.1.0)

      libcrypt shared library

    • libpam-modules (>= 1.1.8-1)

      Pluggable Authentication Modules for PAM

    • libpam-runtime

      Runtime support for the PAM library

    • libpam0g (>= 0.99.7.1)

      Pluggable Authentication Modules library


If it isn't fixed till now then purge-reinstall the login package:

sudo dpkg -P login
sudo apt remove --purge login
sudo apt autoremove
sudo apt install login

Feel free to ask me anything in comments or chat.

Added by: Kayleigh Metz

Answer: 3

20 hours ago

apt commands require administrator privileges.

You need to preface the command with sudo.

You should also run sudo apt update before you do anything else in apt to make sure that you are working with the current list of software.

For example:

sudo apt update
sudo apt upgrade

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9