3

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?

2
  • I reinstalled the system, since it started crashing consistently and at some point would no longer start. Commented Jan 22, 2022 at 21:47
  • I had this problem running apt upgrade. All packages except linux-firmware upgraded fine, but upgrading that package gave me an "Operation not permitted" error opening the .deb, with an "unable to open" message for a file in /lib/firmware. What was odd was that on each attempt it flagged a different file. Two I captured were /lib/firmware/intel/irci_irci_ecr-master_20161208_0213_20170112_1500.bin.dpkg-new and /lib/firmware/iwlwifi-9260-th-b0-jf-b0-38.ucode.dpkg-new. Since the problem didn't seem isolated to one file, I ran apt upgrade again and it worked. Not a fix, but a lucky workaround. Commented Jan 10, 2023 at 16:52

2 Answers 2

0

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.

7
  • Unfortunately, I do not have a virusscanner running. I tried apt --fix-broken install but got the same error Commented Jan 9, 2022 at 10:44
  • dpkg -P login errors out with this is an essential package; it should not be removed Commented Jan 9, 2022 at 10:46
  • @SergeFonville Have you ran other commands?
    – Error404
    Commented Jan 9, 2022 at 10:47
  • @SergeFonville Let's continue this discussion in chat,
    – Error404
    Commented Jan 9, 2022 at 10:51
  • I executed all commands and that gave the same error message. Commented Jan 9, 2022 at 22:44
-2

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
1
  • 4
    The OP says they are "running apt upgrade as root" already - in any case, the error from not being root would be "permission denied" (EACCES) rather than "operation not permitted" (EPERM) I think? Commented Jan 6, 2022 at 22:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .