40

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.

6
  • To me this looks like a problem with tmp. Can you touch /tmp/test?
    – LAROmega
    Commented Oct 28, 2019 at 0:00
  • @LAROmega I got touch: cannot touch '/tmp/test': Permission denied Commented Oct 29, 2019 at 23:51
  • Make sure /tmp exists. Not sure why it wouldn't but the Ubuntu Linux Subsystem should have it has part of root's file system.
    – LAROmega
    Commented Oct 30, 2019 at 0:18
  • 5
    i had faced same issue in docker , a quick solution would be to do sudo chmod 777 /tmp and it worked for me
    – niths4u
    Commented Feb 3, 2020 at 4:29
  • 1
    Better quick solution: sudo chmod 1777 /tmp. see my answer below
    – rubo77
    Commented Apr 26, 2020 at 12:23

7 Answers 7

81

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

Another possibility would be that something is mounted to /tmp. Check with

mount | grep /tmp

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

0
7

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.

1

I saw this problem with docker. I had to remove a number of docker images and rebuild them. This happened after I changed docker's root dir.

1

I had this issue when building Docker images starting from Ubuntu images on an IBM Power9 machine.

When I started from the image ubuntu:focal with image ID 0a648e725100 I didn't have this problem. ls -ld /tmp (when run in the image) indeed shows permissions drwxrwxrwt, and the Dockerfile build instruction RUN apt-get update works (as does the rest, not shown).

However, there is another image called ppc64le/ubuntu:22.04, image ID 5c1fccf2a735 in which the permissions of /tmp, for whatever reason, were set to drwxr-xr-t and RUN apt-get update failed with the error message shown in the OP.

Adding RUN chmod 1777 /tmp to the Dockerfile solved the problem.

UPDATE : I encountered the same problem with the jupyter/datascience-notebook:hub-3.1.1 image, architecture X86_64, ID=f4ae5f5cf82a as well. This image is derived from an Ubuntu image. There must have been a /tmp permission problem in Ubuntu 22.04 itself which is not architecture- or image-dependent.

0

I got this error in VS Code dev container because I had a trailing \ in my Dockerfile. This can cause other issues like in here: https://github.com/microsoft/vscode-remote-release/issues/7319

0

In my case the problem was my disk had errors.

ls -lad /tmp was fine, showing drwxrwxrwt, as explained in this answer.

So, it turns out I had to run fsck on the root dir.

Run df -h first to see what disks you have. Find the one mounted as your root disk at mount point /. Mine is /dev/mapper/sda4_crypt. So, I had to run this:

fsck /dev/mapper/sda4_crypt -y

...as explained by this answer.

I figured it out because I rebooted to see if that would help my sudo apt update error problem, and my system was unable to boot. It booted into the initramfs menu instead, as explained by the Q&A I linked to just above.

Then, after following those instructions and rebooting from the initramfs menu like this:

fsck /dev/mapper/sda4_crypt -y
reboot
exit

...then once logged back in, sudo apt update worked again!

Previously, it was showing various Couldn't create temporary file /tmp/apt.conf.RpjjUo for passing config to apt-key type errors as shown in this question.

Once sudo apt update worked again, I had to do this, as quoted from my answer here:

sudo apt update

sudo apt full-upgrade
# ...which told me to run `sudo apt --fix-broken install`, so I did that:
sudo apt --fix-broken install

Then, re-run the Software Updater GUI tool.

See also

  1. My comment here, where I refer back to this answer: https://askubuntu.com/questions/137655/boot-drops-to-a-initramfs-prompts-busybox/817660#comment2520181_817660
-1

I had the same error updating APT sources.

If you don't have anything to lose. Just empty the /tmp directory. I had thousands of directories from tomcat and although I had free space in /tmp partition a problem ocurred with that temporary file (/tmp/apt.conf.IqQJWO).

cd /tmp

rm -rf *

After this the update process worked correctly.

You must log in to answer this question.

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