Error running apt update E: Unable to determine file size for fd 7 - fstat

I have set up Ubuntu 21.04 Base image in Termux. When I run apt update, I get the following error. As I was not able to run apt update, I cannot install any packages.

root@localhost:~# apt update
Get:1 hirsute InRelease [269 kB]
Get:2 hirsute-updates InRelease [109 kB]
Get:3 hirsute-backports InRelease [90.7 kB]
Get:4 hirsute-security InRelease [101 kB]
Reading package lists... Done
E: Unable to determine file size for fd 7 - fstat (1: Operation not permitted)
E: The repository ' hirsute InRelease' provides only weak security information.
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.
E: Unable to determine file size for fd 7 - fstat (1: Operation not permitted)
E: The repository ' hirsute-updates InRelease' provides only weak security information.
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.
E: Unable to determine file size for fd 7 - fstat (1: Operation not permitted)
E: The repository ' hirsute-backports InRelease' provides only weak security information.
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.
E: Unable to determine file size for fd 7 - fstat (1: Operation not permitted)
E: The repository ' hirsute-security InRelease' provides only weak security information.
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.

How to fix this? This error is absent in the 20.04.2 base image.

Here is the output for permissions of /tmp.

root@localhost:~# ls -ld /tmp
drwx------ 2 root root 3488 Jul 1 10:54 /tmp

Here is the sources.list (I have not modified it).

root@localhost:~# cat /etc/apt/sources.list
# See for how to upgrade to
# newer versions of the distribution.
deb hirsute main restricted
# deb-src hirsute main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb hirsute-updates main restricted
# deb-src hirsute-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb hirsute universe
# deb-src hirsute universe
deb hirsute-updates universe
# deb-src hirsute-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb hirsute multiverse
# deb-src hirsute multiverse
deb hirsute-updates multiverse
# deb-src hirsute-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb hirsute-backports main restricted universe multiverse
# deb-src hirsute-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb hirsute partner
# deb-src hirsute partner
deb hirsute-security main restricted
# deb-src hirsute-security main restricted
deb hirsute-security universe
# deb-src hirsute-security universe
deb hirsute-security multiverse
# deb-src hirsute-security multiverse
8

3 Answers

Correct permissions:

sudo chmod 777 -R /tmp
5

Please, locate the PID for apt update with:

ps ax | grep "apt"

When you know type:

ls -al /proc/PID/fd/

Where PID is the process number you obtained before.

What is the File Descriptor named 7?.

Update 2021-07-05:

May be it is normal.

According to Termux documentation :

Apt usage under root is restricted to prevent messing up ownership and SELinux labels on Android /data partition.

We strongly recommend to use a pkg utility instead of apt directly...

Downgrading is not supported. In order to reclaim disk space, we do not keep history of package versions.

5

[As of 1st dec, 2021]

For me it was due to mounting to /tmp path with ubuntu 20.04. I had to change mount location to /usr/local/bin

Check here and here.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like