[Fix] Ubuntu E: Unable to locate package sudo error

# apt install sudo

Reading package lists... Done
Building dependency tree       
Reading state information... Done

E: Unable to locate package sudo

You might get unable to locate package error when executing apt package installer command on Ubuntu command line if either you are looking for package that does not exists or your apt is not up to date.


All you need to do is just run the command: apt update, this will get details of all available packages on your system and you should be able to install the package you were looking for.

root@8d376ec5427e:/# apt update

Get:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease [265 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [114 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [108 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [114 kB]
Get:5 http://ports.ubuntu.com/ubuntu-ports focal/multiverse arm64 Packages [139 kB]
Get:6 http://ports.ubuntu.com/ubuntu-ports focal/restricted arm64 Packages [1317 B]
Get:7 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 Packages [1234 kB]
Get:8 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 Packages [11.1 MB]
Get:9 http://ports.ubuntu.com/ubuntu-ports focal-updates/multiverse arm64 Packages [9095 B]                                                                                                                
Get:10 http://ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 Packages [1078 kB]                                                                                                                
Get:11 http://ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 Packages [1430 kB]                                                                                                                    
Get:12 http://ports.ubuntu.com/ubuntu-ports focal-updates/restricted arm64 Packages [3933 B]                                                                                                               
Get:13 http://ports.ubuntu.com/ubuntu-ports focal-backports/universe arm64 Packages [26.0 kB]                                                                                                              
Get:14 http://ports.ubuntu.com/ubuntu-ports focal-backports/main arm64 Packages [51.1 kB]                                                                                                                  
Get:15 http://ports.ubuntu.com/ubuntu-ports focal-security/restricted arm64 Packages [3694 B]                                                                                                              
Get:16 http://ports.ubuntu.com/ubuntu-ports focal-security/universe arm64 Packages [783 kB]                                                                                                                
Get:17 http://ports.ubuntu.com/ubuntu-ports focal-security/multiverse arm64 Packages [3254 B]                                                                                                              
Get:18 http://ports.ubuntu.com/ubuntu-ports focal-security/main arm64 Packages [1066 kB]                                                                                                                   
Fetched 17.6 MB in 12s (1506 kB/s)                                                                                                                                                                         
Reading package lists... Done
Building dependency tree       
Reading state information... Done
15 packages can be upgraded. Run 'apt list --upgradable' to see them.

Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.