sudo apt-get update couldn't create temporary file

22,583

Solution 1

You probably changed the file permissions on your /tmp folder, check with

ls -lad /tmp

The normal settings for /tmp are 1777, which ls shows as drwxrwxrwt. That is: wide open, except that only the owner of a file can remove it (that's what this extra t bit means for a directory).

If the settings are wrong, you can restore them with:

chmod 1777 /tmp

I would recommend rebooting the machine after making this change.

If you cannot reboot, check the answers here: https://unix.stackexchange.com/a/71625/20661

NOTE: also check /var/tmp the same way, maybe you have the same error there

Solution 2

For me, I was using a Docker container and had mounted a directory to /tmp in the container, which was causing the conflict. I removed the mounted directory to /tmp and that allowed apt update to work.

Share:
22,583

Related videos on Youtube

Coloradohusky
Author by

Coloradohusky

Doing programming and stuff

Updated on September 18, 2022

Comments

  • Coloradohusky
    Coloradohusky almost 2 years

    Tried to do sudo apt-get update, get this response every time I run it:

    Get:1 http://repo.radeon.com/rocm/apt/debian xenial InRelease [1814 B]
    Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
    Err:1 http://repo.radeon.com/rocm/apt/debian xenial InRelease
      Couldn't create temporary file /tmp/apt.conf.RpjjUo for passing config to apt-key
    Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
      Couldn't create temporary file /tmp/apt.conf.IvhgJr for passing config to apt-key
    Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
    Err:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
      Couldn't create temporary file /tmp/apt.conf.F98B6M for passing config to apt-key
    Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
    Err:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
      Couldn't create temporary file /tmp/apt.conf.WWtE1d for passing config to apt-key
    Get:3 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
    Err:3 http://archive.ubuntu.com/ubuntu bionic InRelease
      Couldn't create temporary file /tmp/apt.conf.TP8dgO for passing config to apt-key
    Reading package lists... Done
    W: GPG error: http://repo.radeon.com/rocm/apt/debian xenial InRelease: Couldn't create temporary file /tmp/apt.conf.RpjjUo for passing config to apt-key
    E: The repository 'http://repo.radeon.com/rocm/apt/debian xenial InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: GPG error: http://security.ubuntu.com/ubuntu bionic-security InRelease: Couldn't create temporary file /tmp/apt.conf.IvhgJr for passing config to apt-key
    E: The repository 'http://security.ubuntu.com/ubuntu bionic-security InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: GPG error: http://archive.ubuntu.com/ubuntu bionic-updates InRelease: Couldn't create temporary file /tmp/apt.conf.F98B6M for passing config to apt-key
    E: The repository 'http://archive.ubuntu.com/ubuntu bionic-updates InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: GPG error: http://archive.ubuntu.com/ubuntu bionic-backports InRelease: Couldn't create temporary file /tmp/apt.conf.WWtE1d for passing config to apt-key
    E: The repository 'http://archive.ubuntu.com/ubuntu bionic-backports InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: GPG error: http://archive.ubuntu.com/ubuntu bionic InRelease: Couldn't create temporary file /tmp/apt.conf.TP8dgO for passing config to apt-key
    E: The repository 'http://archive.ubuntu.com/ubuntu bionic InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    

    Tried sudo apt-get clean, nothing happened. sudo apt-get upgrade states that there is nothing that needs to be upgraded. sudo apt-get check doesn't find anything either.

    Using Ubuntu on Windows 10.