virtualmin / virtualmin-gpl

Virtualmin web hosting control panel for Webmin
https://www.virtualmin.com
GNU General Public License v3.0
315 stars 98 forks source link

Cannot install virtualmin pro under Ubuntu 22.04 (running in an Azure VM) #914

Open danboid opened 2 days ago

danboid commented 2 days ago

We've had to start over with our virtualmin server but I've not been able to get it the latest vmin pro install.sh script to install any packages under Ubuntu 22.04 running in an Azure VM.

As per the vmin download page instructions, I'm trying to install it using the install.sh I downloaded from https://www.virtualmin.com/account/ when signed in.

Apparently ./install -s should fix the repos but that gives me errors.

# sh ./install.sh -s
[INFO] Log will be written to: /home/danielm/virtualmin-install.log
[INFO] Started Virtualmin 7 Professional software repositories setup
▣ Phase 1 of 1: Setup
Downloading Virtualmin 7 key                                                 ✔ 
Installing Virtualmin 7 key                                                  ✔ 
Downloading repository metadata                                             [ERROR] Failed with error: 100
 ✘ 

[ERROR] Something went wrong. Exiting.
[ERROR] The last few log entries were:
Err:6 https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0B8B7
Hit:12 https://esm.ubuntu.com/infra/ubuntu jammy-infra-updates InRelease
Get:13 https://download.webmin.com/download/newkey/repository stable Release [18.3 kB]
Get:14 https://download.webmin.com/download/newkey/repository stable Release.gpg [819 B]
Ign:14 https://download.webmin.com/download/newkey/repository stable Release.gpg
Reading package lists...
W: https://packages.microsoft.com/ubuntu/22.04/prod/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for d
etails.
W: GPG error: https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0
B8B7
E: The repository 'https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease' is not signed.
W: GPG error: https://download.webmin.com/download/newkey/repository stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2D223B91
8916F2A2
E: The repository 'https://download.webmin.com/download/newkey/repository stable Release' is not signed.
Downloading repository metadata: [2024-10-01 15:38:39 BST] [ERROR] Failed with error: 100
[2024-10-01 15:38:39 BST] [ERROR] Something went wrong. Exiting.
[2024-10-01 15:38:39 BST] [ERROR] The last few log entries were:
# cat virtualmin-install.log 
Checking for HTTP client .. found /usr/bin/wget -nv
2024-10-01 15:38:33 URL:https://software.virtualmin.com/lib/slib.sh [24222/24222] -> "slib.sh" [1]
[2024-10-01 15:38:33 BST] [INFO] Log will be written to: /home/danielm/virtualmin-install.log
[2024-10-01 15:38:33 BST] [DEBUG] LOG_ERRORS_FATAL=1
[2024-10-01 15:38:33 BST] [DEBUG] LOG_LEVEL_STDOUT=INFO
[2024-10-01 15:38:33 BST] [DEBUG] LOG_LEVEL_LOG=DEBUG
Checking for Perl .... found Perl at /usr/bin/perl
Checking for HTTP client .. found /usr/bin/wget -nv
Checking for GPG .. found GPG command
[2024-10-01 15:38:33 BST] [INFO] Started Virtualmin 7 Professional software repositories setup
[2024-10-01 15:38:33 BST] [DEBUG] Install mode: setup
[2024-10-01 15:38:33 BST] [DEBUG] Product: Virtualmin Professional
[2024-10-01 15:38:33 BST] [DEBUG] virtualmin-install.sh version: 7.4.0
[2024-10-01 15:38:33 BST] [DEBUG] Installing serial number and license key into /etc/virtualmin-license
[2024-10-01 15:38:33 BST] [DEBUG] Operating system name:    Ubuntu
[2024-10-01 15:38:33 BST] [DEBUG] Operating system version: 22.04
[2024-10-01 15:38:33 BST] [DEBUG] Operating system type:    ubuntu
[2024-10-01 15:38:33 BST] [DEBUG] Operating system major:   22
[2024-10-01 15:38:33 BST] [DEBUG] Configuring package manager for Ubuntu 22.04 ..
[2024-10-01 15:38:33 BST] [DEBUG] apt-get repos: virtualmin
[2024-10-01 15:38:33 BST] [DEBUG] Installing Webmin and Virtualmin package signing keys ..
Spin pid is: 226324
2024-10-01 15:38:33 URL:https://software.virtualmin.com/lib/RPM-GPG-KEY-virtualmin-7 [3212/3212] -> "RPM-GPG-KEY-virtualmin-7" [1]
Downloading Virtualmin 7 key: Success.
Spin pid is: 226349
gpg: key 3E570892B9A0B8B7: "Virtualmin, Inc. (Package signing key for Virtualmin 7) <security@virtualmin.com>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
Installing Virtualmin 7 key: Success.
Spin pid is: 226379
Hit:1 https://packages.microsoft.com/ubuntu/22.04/prod jammy InRelease
Hit:2 http://azure.archive.ubuntu.com/ubuntu jammy InRelease
Hit:3 http://azure.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:4 http://azure.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:5 http://azure.archive.ubuntu.com/ubuntu jammy-security InRelease
Get:6 https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease [10.7 kB]
Hit:7 https://esm.ubuntu.com/cis/ubuntu jammy InRelease
Hit:8 https://esm.ubuntu.com/apps/ubuntu jammy-apps-security InRelease
Hit:9 https://esm.ubuntu.com/apps/ubuntu jammy-apps-updates InRelease
Hit:10 https://esm.ubuntu.com/infra/ubuntu jammy-infra-security InRelease
Ign:11 https://download.webmin.com/download/newkey/repository stable InRelease
Err:6 https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0B8B7
Hit:12 https://esm.ubuntu.com/infra/ubuntu jammy-infra-updates InRelease
Get:13 https://download.webmin.com/download/newkey/repository stable Release [18.3 kB]
Get:14 https://download.webmin.com/download/newkey/repository stable Release.gpg [819 B]
Ign:14 https://download.webmin.com/download/newkey/repository stable Release.gpg
Reading package lists...
W: https://packages.microsoft.com/ubuntu/22.04/prod/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for d
etails.
W: GPG error: https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0
B8B7
E: The repository 'https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease' is not signed.
W: GPG error: https://download.webmin.com/download/newkey/repository stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2D223B91
8916F2A2
E: The repository 'https://download.webmin.com/download/newkey/repository stable Release' is not signed.
Downloading repository metadata: [2024-10-01 15:38:39 BST] [ERROR] Failed with error: 100
[2024-10-01 15:38:39 BST] [ERROR] Something went wrong. Exiting.
[2024-10-01 15:38:39 BST] [ERROR] The last few log entries were:

I can provide any other logs you require.

Hopefully we won't have to install Ubuntu 20.04 and then upgrade from there, it is out of support in a few months so thats only a temp workaround.

I have tried running

sudo apt clean
sudo apt update

After running the install.sh -s but that doesn't help.

Is the vmin apt repo signed in a way that is friendly with Ubuntu 22.04 and later? It seems they changed the way apt deals with gpg keys in Ubuntu 22.04, apt-key is deprecated. I have read a number of reports of people who can install vmin under Ubuntu 20.04 and then update it to Ubuntu 22 or Ubuntu 24 but cannot get it to install under 22.04 and I can't help but think its this:

https://sites.google.com/site/installationubuntu/home/ubuntu-22-04/apt-key-is-deprecated

danboid commented 2 days ago

A tool I'd never come across before today when searching for a fix to these errors is Y PPA manager

https://askubuntu.com/questions/1877/what-is-the-easiest-way-to-resolve-apt-get-badsig-gpg-errors/145933#145933

That's a GUI tool though. Is there a terminal friendly equivalent I wonder?

I also tried:

gpg --refresh-keys

Didn't work for me.

danboid commented 2 days ago

The end of my install.sh run looks like:

Virtualmin may already be installed. This can happen if an installation failed,
  and can be ignored in that case.

  However, if Virtualmin has already been successfully installed you must not
  run this script again! It will cause breakage to your existing configuration.

  Virtualmin repositories can be fixed using install.sh -s command.

  License details can be changed using virtualmin change-license command.
  Changing the license never requires re-installation.

  Updates and upgrades must be performed from within either Virtualmin or using
  system package manager on the command line.

 Continue? (y/n) y
[INFO] Started installation log in /home/danielm/virtualmin-install.log
▣◻◻◻ Phase 1 of 4: Check
Checking system time                                                         ✔ 
Checking Perl installation                                                   ✔ 
Checking CA certificates package                                             ✔ 
Checking HTTP client                                                         ✔ 
Checking GPG package                                                         ✔ 

▣▣◻◻ Phase 2 of 4: Setup
Downloading Virtualmin 7 key                                                 ✔ 
Installing Virtualmin 7 key                                                  ✔ 
Downloading repository metadata                                             [ERROR] Failed with error: 100
 ✘ 

[ERROR] Something went wrong. Exiting.
[ERROR] The last few log entries were:
Ign:12 https://download.webmin.com/download/newkey/repository stable InRelease
Err:11 https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0B8B7
Get:13 https://download.webmin.com/download/newkey/repository stable Release [18.3 kB]
Get:14 https://download.webmin.com/download/newkey/repository stable Release.gpg [819 B]
Ign:14 https://download.webmin.com/download/newkey/repository stable Release.gpg
Reading package lists...
W: https://packages.microsoft.com/ubuntu/22.04/prod/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for d
etails.
W: GPG error: https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0
B8B7
E: The repository 'https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease' is not signed.
W: GPG error: https://download.webmin.com/download/newkey/repository stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2D223B91
8916F2A2
E: The repository 'https://download.webmin.com/download/newkey/repository stable Release' is not signed.
Downloading repository metadata: [2024-10-01 16:17:46 BST] [ERROR] Failed with error: 100
[2024-10-01 16:17:46 BST] [ERROR] Something went wrong. Exiting.
[2024-10-01 16:17:46 BST] [ERROR] The last few log entries were:
danboid commented 2 days ago

I've finally got past that error. The fix for me was:

chmod 644 /usr/share/keyrings/*

iliajie commented 1 day ago

Very interesting! Do you know what it was set to before?

danboid commented 1 day ago
root@poseidon:/usr/share/keyrings# ls -l
total 76
-rw-r----- 1 root root  641 Sep 25 15:16 microsoft-prod.gpg
-rw-r--r-- 1 root root 7399 Sep 18  2018 ubuntu-archive-keyring.gpg
-rw-r--r-- 1 root root 6713 Oct 27  2016 ubuntu-archive-removed-keys.gpg
-rw-r--r-- 1 root root 3023 Mar 26  2021 ubuntu-cloudimage-keyring.gpg
-rw-r--r-- 1 root root    0 Jan 17  2018 ubuntu-cloudimage-removed-keys.gpg
-rw-r--r-- 1 root root 1227 May 27  2010 ubuntu-master-keyring.gpg
-rw-r--r-- 1 root root 1150 Aug  8 15:00 ubuntu-pro-anbox-cloud.gpg
-rw-r--r-- 1 root root 2247 Aug  8 15:00 ubuntu-pro-cc-eal.gpg
-rw-r--r-- 1 root root 2274 Aug  8 15:00 ubuntu-pro-cis.gpg
-rw-r--r-- 1 root root 2236 Aug  8 15:00 ubuntu-pro-esm-apps.gpg
-rw-r--r-- 1 root root 2264 Aug  8 15:00 ubuntu-pro-esm-infra.gpg
-rw-r--r-- 1 root root 2275 Aug  8 15:00 ubuntu-pro-fips-preview.gpg
-rw-r--r-- 1 root root 2275 Aug  8 15:00 ubuntu-pro-fips.gpg
-rw-r--r-- 1 root root 2250 Aug  8 15:00 ubuntu-pro-realtime-kernel.gpg
-rw-r--r-- 1 root root 2235 Aug  8 15:00 ubuntu-pro-ros.gpg
-rw-r----- 1 root root 2313 Oct  1 16:20 ubuntu-virtualmin-7.gpg
-rw-r----- 1 root root 2261 Oct  1 14:02 ubuntu-webmin-developers.gpg
-rw-r----- 1 root root  891 Oct  1 15:05 webmin.gpg
root@poseidon:/usr/share/keyrings# umask 
0027
danboid commented 1 day ago

We had login issues with our vmin Ubuntu 22.04 VM so we had to restore it to a backup from before I got vmin to install and it would seem that running that chmod command isn't the only thing that I had to do to fix running the vmin install.sh script under Ubuntu 22.04.

The problematic thing is that I had tried all sorts of stuff - editing the apt config files, creating and moving gpg keys etc, and non of it seemed to be working but I must've changed something else too apart from doing that chmod command to fix the installation.

I'm back to this error when I try running the vmin pro install.sh script:

[INFO] Started installation log in /home/danielm/virtualmin-install.log
▣◻◻◻ Phase 1 of 4: Check
Checking system time                                                         ✔ 
Checking Perl installation                                                   ✔ 
Checking CA certificates package                                             ✔ 
Checking HTTP client                                                         ✔ 
Checking GPG package                                                         ✔ 

▣▣◻◻ Phase 2 of 4: Setup
Downloading Virtualmin 7 key                                                 ✔ 
Installing Virtualmin 7 key                                                  ✔ 
Downloading repository metadata                                             [ERROR] Failed with error: 100
 ✘ 

[ERROR] Something went wrong. Exiting.
[ERROR] The last few log entries were:
Hit:8 https://esm.ubuntu.com/apps/ubuntu jammy-apps-updates InRelease
Hit:9 https://esm.ubuntu.com/infra/ubuntu jammy-infra-security InRelease
Hit:10 https://esm.ubuntu.com/infra/ubuntu jammy-infra-updates InRelease
Get:11 https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease [10.7 kB]
Ign:12 https://download.webmin.com/download/newkey/repository stable InRelease
Hit:13 https://download.webmin.com/download/newkey/repository stable Release
Err:11 https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3E570892B9A0B8B7
Reading package lists...
W: https://packages.microsoft.com/ubuntu/22.04/prod/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), 
see the DEPRECATION section in apt-key(8) for details.
W: GPG error: https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease: The following signatures couldn't be verified because the publ
ic key is not available: NO_PUBKEY 3E570892B9A0B8B7
E: The repository 'https://software.virtualmin.com/vm/7/pro/apt virtualmin InRelease' is not signed.
Downloading repository metadata: [2024-10-03 09:49:19 BST] [ERROR] Failed with error: 100
[2024-10-03 09:49:19 BST] [ERROR] Something went wrong. Exiting.
[2024-10-03 09:49:19 BST] [ERROR] The last few log entries were:
danboid commented 1 day ago

There are two things I mostly recall doing that I think could've fixed this that the commands are absent in my terminal history file, maybe you guys can give me the exact commands I need?

There are a couple of apt-key or gpg commands to fetch keys for your repos. I think I might've adjusted them slightly for Ubuntu 22.04 somehow.

Another thing I sorta remember doing was running

setup-repos.sh -f

Which creates a gpg key in /tmp/developers-key.asc and I think I might've used a gpg dearmor command to copy that into the required dir and/or I might adjusted the key file paths to different keys in the apt config files.

Any suggestions are gratefully accepted. We're in big hurry to get this server installed.

danboid commented 1 day ago

I've got it installing again.

The magic sequence of commands was:

 sh ./install.sh -s
 chmod 644 /usr/share/keyrings/*
 apt update

Then re-run install.sh. vmin installed without any errors under Ubuntu 22.04 after doing that.