Ubuntu Jammy Jellyfish系统sudo版本不一致及软件包最新版本安装问题咨询
Hi there! Let's break down your two questions and walk through practical solutions:
一、sudo版本显示不一致的问题
I get why this is confusing—you see two different versions for sudo depending on the command you run:
ii sudo 1.9.9-1ubuntu2.4 amd64 (from
dpkg -l/apt list --installed)
Sudo versión 1.9.15p5 (fromsudo -V)
This almost always means you've installed a newer sudo version manually (like compiling from source) that's overriding the system's official packaged version. Here's how to fix it:
First, confirm where your active sudo binary lives by running:
which sudoIf the output isn't
/usr/bin/sudo, that proves a manually installed version is taking priority in your system'sPATH.To revert to the official Ubuntu package version:
- Uninstall the manually installed sudo. If you compiled it from source, navigate to the source directory and run:
If you used another installation method, follow the corresponding steps to remove it.sudo make uninstall - Reinstall the system's sudo package to ensure it's properly set up:
sudo apt install --reinstall sudo
- Uninstall the manually installed sudo. If you compiled it from source, navigate to the source directory and run:
After these steps, run
dpkg -landsudo -Vagain—they should now show matching versions.
二、在Ubuntu Jammy中安装软件包最新版本的问题
Ubuntu 22.04 (Jammy Jellyfish) is an LTS release, which prioritizes stability over cutting-edge updates. The official repositories don't push the absolute latest versions of packages like OpenSSH; instead, they backport critical security patches to the older, tested version (1:8.9p1-3 in your case) to keep your system reliable.
If you still need the latest version (like OpenSSH 9.7/9.7p1), here are your options—note these carry potential stability risks, especially in production environments:
Manual deb package installation: Download the appropriate
.debpackages for Jammy/amd64 from a trusted source (like the official OpenSSH site). Install them withdpkg -i, but be ready to resolve any dependency conflicts manually.Third-party PPA: Some maintainers offer PPAs with updated versions. Add a trusted PPA (do your research to confirm it's safe), then update and install:
sudo add-apt-repository ppa:<ppa-identifier> sudo apt update sudo apt install openssh-serverKeep in mind PPAs aren't officially supported and might cause compatibility issues with other system packages.
Compile from source: Download the latest OpenSSH source code, compile it, and install it. However, this version won't be managed by
apt, so you'll have to handle future updates manually, and it might clash with system components.
As a best practice, if you're running a production system, stick with the official package versions—they receive all critical security fixes without the risk of breaking your setup.
备注:内容来源于stack exchange,提问作者Jose99

