Fixing apt-key deprecation warnings with cPanel EA4 on Ubuntu 20.04 to 22.04

Ran into the classic warning on Ubuntu server when running apt update after Ubuntu 20.04 to 22.04 upgrade and cPanel upgrade due to November 1st EOL for version 118:

W: mirror://httpupdate.cpanel.net/ea4-u22-mirrorlist/./InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: mirror://httpupdate.cpanel.net/cpanel-plugins-u22-mirrorlist/./InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

Ubuntu is phasing out the legacy trusted.gpg keyring, so these need to be moved to /etc/apt/keyrings.


Created the keyrings folder and exported the keys:

sudo install -m 0755 -d /etc/apt/keyrings
sudo apt-key exportall | sudo gpg --dearmor -o /etc/apt/keyrings/cpanel.gpg

Searched for the cPanel repo entries:

grep -R "httpupdate.cpanel.net" /etc/apt/sources.list /etc/apt/sources.list.d

Edited the relevant repo files:

/etc/apt/sources.list.d/EA4.list
/etc/apt/sources.list.d/cpanel-plugins.list

Changed them from:

deb mirror://httpupdate.cpanel.net/ea4-u22-mirrorlist ./

to (added [signed-by=/etc/apt/keyrings/cpanel.gpg]:

deb [signed-by=/etc/apt/keyrings/cpanel.gpg] mirror://httpupdate.cpanel.net/ea4-u22-mirrorlist ./

and same for the cpanel-plugins line.


Listed the legacy keys to confirm:

sudo apt-key list

Found the old cPanel keys:

cPanel Public Build Key
cPanel Public RPM Key

Deleted them:

sudo apt-key del F222E637
sudo apt-key del 7E931C7C

Ran apt update again:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.

No more legacy trusted.gpg warnings.

I hope this helps anyone else who runs into the same cPanel key warning on Ubuntu.

Here’s the full command history [IPs and emails redacted]:

root@host:~# apt update 
Hit:1 http://fr.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 https://wp-toolkit.plesk.com/cPanel/Ubuntu-22.04-x86_64/latest/wp-toolkit ./ InRelease                                                                                                                                                
Get:3 http://fr.archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]                                                                                                                                                                  
Hit:4 https://wp-toolkit.plesk.com/cPanel/Ubuntu-22.04-x86_64/latest/thirdparty ./ InRelease                                                                                                                                                                               
Hit:5 https://repo.mysql.com/apt/ubuntu jammy InRelease                                                                                                                                                                                                                    
Hit:6 http://fr.archive.ubuntu.com/ubuntu jammy-backports InRelease                                                                                                                                                            
Get:7 http://fr.archive.ubuntu.com/ubuntu jammy-security InRelease [129 kB]                                                      
Hit:8 https://repo.imunify360.cloudlinux.com/imunify360/ubuntu/22.04 jammy InRelease                                              
Hit:9 https://download.imunify360.com/ubuntu/22.04/slot-1 jammy InRelease                                                 
Hit:10 https://repo.alt.tuxcare.com/alt-common/deb/ubuntu/22.04/stable jammy InRelease              
Hit:11 https://download.imunify360.com/ubuntu/22.04/slot-2 jammy InRelease    
Hit:12 https://download.imunify360.com/ubuntu/22.04/slot-3 jammy InRelease    
Hit:13 https://download.imunify360.com/ubuntu/22.04/slot-4 jammy InRelease    
Hit:14 https://download.imunify360.com/ubuntu/22.04/slot-5 jammy InRelease    
Hit:15 https://download.imunify360.com/ubuntu/22.04/slot-6 jammy InRelease    
Hit:16 https://download.imunify360.com/ubuntu/22.04/slot-7 jammy InRelease    
Hit:17 https://download.imunify360.com/ubuntu/22.04/slot-8 jammy InRelease    
Get:18 http://httpupdate.cpanel.net/ea4-u22-mirrorlist Mirrorlist
Hit:19 http://x.x.x.x/cpanelsync/repos/Ubuntu/22/EA4 ./ InRelease
Get:20 http://httpupdate.cpanel.net/cpanel-plugins-u22-mirrorlist Mirrorlist
Hit:21 http://x.x.x.x/cpanelsync/repos/Ubuntu/22/cpanel-plugins ./ InRelease
Fetched 259 kB in 5s (47.8 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
W: mirror://httpupdate.cpanel.net/ea4-u22-mirrorlist/./InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: mirror://httpupdate.cpanel.net/cpanel-plugins-u22-mirrorlist/./InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
root@host:~# sudo install -m 0755 -d /etc/apt/keyrings
sudo apt-key exportall | sudo gpg --dearmor -o /etc/apt/keyrings/cpanel.gpg
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
root@host:~# grep -R "httpupdate.cpanel.net" /etc/apt/sources.list /etc/apt/sources.list.d
/etc/apt/sources.list.d/EA4.list.distUpgrade:deb mirror://httpupdate.cpanel.net/ea4-u20-mirrorlist ./
/etc/apt/sources.list.d/cpanel-plugins.list.distUpgrade:deb mirror://httpupdate.cpanel.net/cpanel-plugins-u20-mirrorlist ./
/etc/apt/sources.list.d/cpanel-plugins.list:deb mirror://httpupdate.cpanel.net/cpanel-plugins-u22-mirrorlist ./
/etc/apt/sources.list.d/EA4.list:deb mirror://httpupdate.cpanel.net/ea4-u22-mirrorlist ./
root@host:~# vi /etc/apt/sources.list.d/EA4.list.distUpgrade
root@host:~# vi /etc/apt/sources.list.d/cpanel-plugins.list.distUpgrade
root@host:~# vi /etc/apt/sources.list.d/cpanel-plugins.list
root@host:~# vi /etc/apt/sources.list.d/EA4.list
root@host:~# vi /etc/apt/sources.list.d/EA4.list
root@host:~# sudo apt-key list
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
/etc/apt/trusted.gpg
--------------------
pub   rsa4096 2013-06-14 [SC]
      2EAC 15F4 3D76 9D5C C88F  E9FC 506D EE62 F222 E637
uid           [ unknown] cPanel Public Build Key <[redacted]>
sub   rsa4096 2014-12-01 [S]

pub   rsa4096 2015-08-06 [SC]
      7FB6 9A06 2F33 4F25 10CC  DFFE 2378 B595 7E93 1C7C
uid           [ unknown] cPanel Public RPM Key <[redacted]>

pub   rsa4096 2021-12-14 [SC] [expired: 2023-12-14]
      859B E8D7 C586 F538 430B  19C2 467B 942D 3A79 BD29
uid           [ expired] MySQL Release Engineering <[redacted]>

pub   dsa1024 2003-02-03 [SCA] [expired: 2022-02-16]
      A4A9 4068 76FC BD3C 4567  70C8 8C71 8D3B 5072 E1F5
uid           [ expired] MySQL Release Engineering <[redacted]>

pub   rsa1024 2020-07-09 [SCEA]
      F32E 57CE 8F22 D26D 0864  E3C1 BA33 8AA6 D917 0F80
uid           [ unknown] WordPress Toolkit for cPanel <[redacted]>

pub   rsa4096 2016-10-26 [SCEA]
      A758 B3FB CD43 BE8D 123A  3476 BB29 EE03 8ECC E87C
uid           [ unknown] infrastructure-eng <[redacted]>

pub   dsa1024 2010-06-29 [SC]
      B60A 3EC9 BC01 3B9C 2379  0EC8 B31B 29E5 548C 16BF
uid           [ unknown] New Relic <[redacted]>
sub   elg2048 2010-06-29 [E]

pub   rsa4096 2023-10-23 [SC] [expires: 2025-10-22]
      BCA4 3417 C3B4 85DD 128E  C6D4 B7B3 B788 A8D3 785C
uid           [ unknown] MySQL Release Engineering <[redacted]>
sub   rsa4096 2023-10-23 [E] [expires: 2025-10-22]

/etc/apt/trusted.gpg.d/mysql-2023.gpg
-------------------------------------
pub   rsa4096 2023-10-23 [SC] [expires: 2025-10-22]
      BCA4 3417 C3B4 85DD 128E  C6D4 B7B3 B788 A8D3 785C
uid           [ unknown] MySQL Release Engineering <[redacted]>
sub   rsa4096 2023-10-23 [E] [expires: 2025-10-22]

/etc/apt/trusted.gpg.d/RPM-GPG-KEY-CloudLinux.asc
-------------------------------------------------
pub   dsa1024 2009-10-07 [SC]
      9EE4 6764 1C63 5726 A184  D64B 8C55 A662 8608 CB71
uid           [ unknown] CloudLinux Packager (CloudLinux Key) <[redacted]>
sub   elg1024 2009-10-07 [E]

/etc/apt/trusted.gpg.d/RPM-GPG-KEY-CloudLinux-core.gpg
------------------------------------------------------
pub   dsa1024 2009-10-07 [SC]
      9EE4 6764 1C63 5726 A184  D64B 8C55 A662 8608 CB71
uid           [ unknown] CloudLinux Packager (CloudLinux Key) <[redacted]>
sub   elg1024 2009-10-07 [E]

pub   rsa4096 2025-01-08 [SC] [expires: 2035-01-06]
      C1A4 34E6 0EE1 DAD2 F100  BAFE BC9A 2431 90E0 2617
uid           [ unknown] CloudLinux Extension Signer <[redacted]>
sub   rsa4096 2025-01-08 [E] [expires: 2035-01-06]

/etc/apt/trusted.gpg.d/RPM-GPG-KEY-CloudLinux.gpg
-------------------------------------------------
pub   dsa1024 2009-10-07 [SC]
      9EE4 6764 1C63 5726 A184  D64B 8C55 A662 8608 CB71
uid           [ unknown] CloudLinux Packager (CloudLinux Key) <[redacted]>
sub   elg1024 2009-10-07 [E]

pub   rsa4096 2025-01-08 [SC] [expires: 2035-01-06]
      C1A4 34E6 0EE1 DAD2 F100  BAFE BC9A 2431 90E0 2617
uid           [ unknown] CloudLinux Extension Signer <[redacted]>
sub   rsa4096 2025-01-08 [E] [expires: 2035-01-06]

/etc/apt/trusted.gpg.d/tuxcare-keyring.gpg
------------------------------------------
pub   rsa4096 2023-03-06 [SC]
      FAD7 8590 81D0 738B 7A82  8496 D07B F2A0 8D50 EB66
uid           [ unknown] TuxCare (Software Signing Key) <[redacted]>
sub   rsa4096 2023-03-06 [E]

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg
------------------------------------------------------
pub   rsa4096 2012-05-11 [SC]
      8439 38DF 228D 22F7 B374  2BC0 D94A A3F0 EFE2 1092
uid           [ unknown] Ubuntu CD Image Automatic Signing Key (2012) <[redacted]>

/etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg
------------------------------------------------------
pub   rsa4096 2018-09-17 [SC]
      F6EC B376 2474 EDA9 D21B  7022 8719 20D1 991B C93C
uid           [ unknown] Ubuntu Archive Automatic Signing Key (2018) <[redacted]>

/etc/apt/trusted.gpg.d/ubuntu-pro-esm-apps.gpg
----------------------------------------------
pub   rsa4096 2019-11-21 [SC]
      E8A4 43CE 3581 13D1 87BE  E0E6 AB01 A101 DB53 907B
uid           [ unknown] Ubuntu Apps Automatic Signing Key <[redacted]>
sub   rsa4096 2019-11-21 [E]

/etc/apt/trusted.gpg.d/ubuntu-pro-esm-infra.gpg
-----------------------------------------------
pub   rsa4096 2019-04-17 [SC]
      56F7 650A 24C9 E9EC F87C  4D8D 4067 E403 13CB 4B13
uid           [ unknown] Ubuntu Extended Security Maintenance Automatic Signing Key v2 <[redacted]>
sub   rsa4096 2019-04-17 [E]

root@host:~# sudo apt-key del F222E637
sudo apt-key del 7E931C7C
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
root@host:~# sudo apt update
Hit:1 http://fr.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://fr.archive.ubuntu.com/ubuntu jammy-updates InRelease                                                                                                                                                                                                                       
Hit:3 http://fr.archive.ubuntu.com/ubuntu jammy-backports InRelease                                                                                                                                                                                                                     
Hit:4 http://fr.archive.ubuntu.com/ubuntu jammy-security InRelease                                                                                                                                                                                                                      
Hit:5 https://wp-toolkit.plesk.com/cPanel/Ubuntu-22.04-x86_64/latest/wp-toolkit ./ InRelease                                                                                                                                                                                            
Hit:6 https://wp-toolkit.plesk.com/cPanel/Ubuntu-22.04-x86_64/latest/thirdparty ./ InRelease                                                                                                                                                              
Hit:7 https://repo.mysql.com/apt/ubuntu jammy InRelease                                                                                                                                                                             
Hit:8 https://repo.imunify360.cloudlinux.com/imunify360/ubuntu/22.04 jammy InRelease                                                                                                                                               
Hit:9 https://repo.alt.tuxcare.com/alt-common/deb/ubuntu/22.04/stable jammy InRelease                                     
Hit:10 https://download.imunify360.com/ubuntu/22.04/slot-1 jammy InRelease                          
Hit:11 https://download.imunify360.com/ubuntu/22.04/slot-2 jammy InRelease
Hit:12 https://download.imunify360.com/ubuntu/22.04/slot-3 jammy InRelease
Hit:13 https://download.imunify360.com/ubuntu/22.04/slot-4 jammy InRelease
Hit:14 https://download.imunify360.com/ubuntu/22.04/slot-5 jammy InRelease
Hit:15 https://download.imunify360.com/ubuntu/22.04/slot-6 jammy InRelease
Get:16 http://httpupdate.cpanel.net/ea4-u22-mirrorlist Mirrorlist
Hit:18 https://download.imunify360.com/ubuntu/22.04/slot-7 jammy InRelease
Hit:19 https://download.imunify360.com/ubuntu/22.04/slot-8 jammy InRelease                
Get:20 http://httpupdate.cpanel.net/cpanel-plugins-u22-mirrorlist Mirrorlist              
Hit:17 http://x.x.x.x/cpanelsync/repos/Ubuntu/22/EA4 ./ InRelease
Hit:21 http://x.x.x.x/cpanelsync/repos/Ubuntu/22/cpanel-plugins ./ InRelease
Fetched 2,344 B in 1s (2,053 B/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
1 Like