So, it doesn’t remove the email services that are currently installed, right? What would I need to do to remove them before installing?
It only removes and after that installs exim4 packages.
You shouldn’t manually remove anything.
And is it possible to install dovecot, sieve, and spamAssassin without having to remove the corrupted services that are already installed?
Just run the script
Okay, I’ll try it and let you know how it goes
The script is spending a lot of time stuck on “Installing Exim4 packages”, without doing anything else. Is this normal or could there be a problem?
If it is taking too long, looks like there is a problem.
You could try to debug the script to know where it’s stuck:
curl -fsSLm15 https://deve.dev/scripts/i/install_exim_v2 | sudo bash -s -x --
This is what it shows. It doesn’t go beyond that
[[ 0 -ne 0 ]]
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin
HESTIA=/usr/local/hestia
HESTIA_BIN=/usr/local/hestia/bin
HESTIA_INSTALL_DIR=/usr/local/hestia/install/deb
HESTIA_COMMON_DIR=/usr/local/hestia/install/common++ lsb_release -s -r
release=24.04
exim=yes
dovecot=yes
spamd=yes
clamd=no
sieve=yes
/usr/local/hestia/bin/v-list-sys-config json
grep DB_SYSTEM
grep -q mysql
mysql=yes
echo ‘[ * ] Removing Exim4 packages’[ * ] Removing Exim4 packages
apt purge -q -y ‘exim4*’
echo ‘[ * ] Installing Exim4 packages’[ * ] Installing Exim4 packages
apt install -q -y exim4 exim4-daemon-heavy
Run this command manually and show the output:
apt install exim4 exim4-daemon-heavy
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
exim4 is already the newest version (4.97-4ubuntu4.3).
exim4-daemon-heavy is already the newest version (4.97-4ubuntu4.3).
0 upgraded, 0 newly installed, 0 to remove and 39 not upgraded.
Run this and show the output:
apt purge "exim4*"
apt install exim4 exim4-daemon-heavy
apt purge “exim4*”
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Note, selecting ‘exim4-localscanapi-6.0’ for glob ‘exim4*’
Note, selecting ‘exim4’ for glob ‘exim4*’
Note, selecting ‘exim4-config’ for glob ‘exim4*’
Note, selecting ‘exim4-dev’ for glob ‘exim4*’
Note, selecting ‘exim4-base’ for glob ‘exim4*’
Note, selecting ‘exim4-daemon-custom’ for glob ‘exim4*’
Note, selecting ‘exim4-doc-html’ for glob ‘exim4*’
Note, selecting ‘exim4-config-2’ for glob ‘exim4*’
Note, selecting ‘exim4-doc-info’ for glob ‘exim4*’
Note, selecting ‘exim4-daemon-light’ for glob ‘exim4*’
Note, selecting ‘exim4-daemon-heavy’ for glob ‘exim4*’
Package ‘exim4-daemon-custom’ is not installed, so not removed
Note, selecting ‘exim4-config’ instead of ‘exim4-config-2’
Package ‘exim4-daemon-light’ is not installed, so not removed
Package ‘exim4-doc-html’ is not installed, so not removed
Package ‘exim4-doc-info’ is not installed, so not removed
Package ‘exim4-dev’ is not installed, so not removed
The following packages were automatically installed and are no longer required:
libevent-2.1-7t64 libfile-fcntllock-perl libgnutls-dane0t64 liblockfile-bin liblockfile1 libnsl2 libpq5 libunbound8
Use ‘apt autoremove’ to remove them.
The following packages will be REMOVED:
bsd-mailx* exim4* exim4-base* exim4-config* exim4-daemon-heavy*
0 upgraded, 0 newly installed, 5 to remove and 39 not upgraded.
After this operation, 4655 kB disk space will be freed.
N: Ignoring file ‘OLD_mongodb-org-8.2.listen_OLD’ in directory ‘/etc/apt/sources.list.d/’ as it has an invalid filename extension
N: Ignoring file ‘OLD_mongodb-org-8.2.list_OLD’ in directory ‘/etc/apt/sources.list.d/’ as it has an invalid filename extension
Do you want to continue? [Y/n] Y
(Reading database … 132115 files and directories currently installed.)
Removing bsd-mailx (8.1.2-0.20220412cvs-1build1) …
Removing exim4 (4.97-4ubuntu4.3) …
Removing exim4-daemon-heavy (4.97-4ubuntu4.3) …
Removing exim4-base (4.97-4ubuntu4.3) …
Removing exim4-config (4.97-4ubuntu4.3) …
Processing triggers for man-db (2.12.0-4build2) …
(Reading database … 131967 files and directories currently installed.)
Purging configuration files for exim4-base (4.97-4ubuntu4.3) …
Purging configuration files for exim4-daemon-heavy (4.97-4ubuntu4.3) …
Purging configuration files for exim4 (4.97-4ubuntu4.3) …
Purging configuration files for bsd-mailx (8.1.2-0.20220412cvs-1build1) …
Purging configuration files for exim4-config (4.97-4ubuntu4.3) …
dpkg-statoverride: warning: no override present
dpkg: warning: while removing exim4-config, directory ‘/etc/exim4/conf.d/transport’ not empty so not removed
dpkg: warning: while removing exim4-config, directory ‘/etc/exim4/conf.d/router’ not empty so not removed
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following additional packages will be installed:
bsd-mailx exim4-base exim4-config
Suggested packages:
exim4-doc-html | exim4-doc-info eximon4 spf-tools-perl swaks
The following NEW packages will be installed:
bsd-mailx exim4 exim4-base exim4-config exim4-daemon-heavy
0 upgraded, 5 newly installed, 0 to remove and 39 not upgraded.
Need to get 0 B/2005 kB of archives.
After this operation, 4655 kB of additional disk space will be used.
N: Ignoring file ‘OLD_mongodb-org-8.2.listen_OLD’ in directory ‘/etc/apt/sources.list.d/’ as it has an invalid filename extension
N: Ignoring file ‘OLD_mongodb-org-8.2.list_OLD’ in directory ‘/etc/apt/sources.list.d/’ as it has an invalid filename extension
Do you want to continue? [Y/n] Y
N: Ignoring file ‘OLD_mongodb-org-8.2.listen_OLD’ in directory ‘/etc/apt/sources.list.d/’ as it has an invalid filename extension
N: Ignoring file ‘OLD_mongodb-org-8.2.list_OLD’ in directory ‘/etc/apt/sources.list.d/’ as it has an invalid filename extension
Preconfiguring packages …
Selecting previously unselected package exim4-config.
(Reading database … 131908 files and directories currently installed.)
Preparing to unpack …/exim4-config_4.97-4ubuntu4.3_all.deb …
Unpacking exim4-config (4.97-4ubuntu4.3) …
Selecting previously unselected package exim4-base.
Preparing to unpack …/exim4-base_4.97-4ubuntu4.3_amd64.deb …
Unpacking exim4-base (4.97-4ubuntu4.3) …
Selecting previously unselected package exim4-daemon-heavy.
Preparing to unpack …/exim4-daemon-heavy_4.97-4ubuntu4.3_amd64.deb …
Unpacking exim4-daemon-heavy (4.97-4ubuntu4.3) …
Selecting previously unselected package bsd-mailx.
Preparing to unpack …/bsd-mailx_8.1.2-0.20220412cvs-1build1_amd64.deb …
Unpacking bsd-mailx (8.1.2-0.20220412cvs-1build1) …
Selecting previously unselected package exim4.
Preparing to unpack …/exim4_4.97-4ubuntu4.3_all.deb …
Unpacking exim4 (4.97-4ubuntu4.3) …
Setting up exim4-config (4.97-4ubuntu4.3) …
Setting up exim4-base (4.97-4ubuntu4.3) …
exim: DB upgrade, deleting hints-db
Created symlink /etc/systemd/system/timers.target.wants/exim4-base.timer → /usr/lib/systemd/system/exim4-base.timer.
exim4-base.service is a disabled or a static unit, not starting it.
Setting up exim4-daemon-heavy (4.97-4ubuntu4.3) …
Created symlink /etc/systemd/system/multi-user.target.wants/exim4.service → /usr/lib/systemd/system/exim4.service.
Setting up exim4 (4.97-4ubuntu4.3) …
Setting up bsd-mailx (8.1.2-0.20220412cvs-1build1) …
update-alternatives: using /usr/bin/bsd-mailx to provide /usr/bin/mailx (mailx) in auto mode
Processing triggers for man-db (2.12.0-4build2) …
Scanning processes…
Scanning linux images…
apt install exim4 exim4-daemon-heavy
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
exim4 is already the newest version (4.97-4ubuntu4.3).
exim4-daemon-heavy is already the newest version (4.97-4ubuntu4.3).
0 upgraded, 0 newly installed, 0 to remove and 39 not upgraded.
I’ve removed the part of the script that removes/installs exim, run this one:
curl -fsSLm15 https://deve.dev/scripts/i/install_exim_kerven66 | sudo bash -s --
Running the last link displayed the following:
[ * ] Configuring Exim mail server
[ * ] Installing Dovecot
[ * ] Configuring Dovecot POP/IMAP mail server…
[ * ] Installing Roundcube…
ERROR: Install done from apt source, unable to continue
[ * ] Installing Sieve packages…
Then I ran it in debug mode and this was the output:
- [[ 0 -ne 0 ]]
- export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin
- HESTIA=/usr/local/hestia
- HESTIA_BIN=/usr/local/hestia/bin
- HESTIA_INSTALL_DIR=/usr/local/hestia/install/deb
- HESTIA_COMMON_DIR=/usr/local/hestia/install/common
++ lsb_release -s -r - release=24.04
- exim=yes
- dovecot=yes
- spamd=yes
- clamd=no
- sieve=yes
- /usr/local/hestia/bin/v-list-sys-config json
- grep DB_SYSTEM
- grep -q mysql
- mysql=yes
- ‘[’ yes = yes ‘]’
- /usr/local/hestia/bin/v-change-sys-config-value MAIL_SYSTEM exim4
- ‘[’ no = yes ‘]’
- ‘[’ yes = yes ‘]’
- /usr/local/hestia/bin/v-change-sys-config-value ANTISPAM_SYSTEM spamassassin
- ‘[’ yes = yes ‘]’
- /usr/local/hestia/bin/v-change-sys-config-value SIEVE_SYSTEM yes
- ‘[’ yes = yes ‘]’
- echo ‘[ * ] Configuring Exim mail server’
[ * ] Configuring Exim mail server - gpasswd -a Debian-exim mail
++ exim4 --version
++ head -1
++ awk ‘{print $3}’
++ cut -f -2 -d . - exim_version=4.97
- version_ge 4.94 4.97
++ printf ‘%s\n’ 4.94 4.97
++ sort -V
++ head -n 1 - test 4.94 ‘!=’ 4.94 -o -n 4.94 -a 4.94 = 4.97
- cp -f /usr/local/hestia/install/deb/exim/exim4.conf.4.95.template /etc/exim4/exim4.conf.template
- cp -f /usr/local/hestia/install/deb/exim/dnsbl.conf /etc/exim4/
- cp -f /usr/local/hestia/install/deb/exim/spam-blocks.conf /etc/exim4/
- cp -f /usr/local/hestia/install/deb/exim/limit.conf /etc/exim4/
- cp -f /usr/local/hestia/install/deb/exim/system.filter /etc/exim4/
- touch /etc/exim4/white-blocks.conf
- ‘[’ yes = yes ‘]’
- sed -i s/#SPAM/SPAM/g /etc/exim4/exim4.conf.template
- ‘[’ no = yes ‘]’
++ gen_pass
++ matrix=
++ length=
++ ‘[’ -z ‘’ ‘]’
++ matrix=A-Za-z0-9
++ ‘[’ -z ‘’ ‘]’
++ length=16
++ head /dev/urandom
++ tr -dc A-Za-z0-9
++ head -c16 - srs=BXhPvY72VPZ5s6H1
- echo BXhPvY72VPZ5s6H1
- chmod 640 /etc/exim4/srs.conf
- chmod 640 /etc/exim4/exim4.conf.template
- chown root:Debian-exim /etc/exim4/srs.conf
- rm -rf /etc/exim4/domains
- mkdir -p /etc/exim4/domains
- rm -f /etc/alternatives/mta
- ln -s /usr/sbin/exim4 /etc/alternatives/mta
- update-rc.d -f sendmail remove
- update-rc.d -f postfix remove
- systemctl stop postfix
- update-rc.d exim4 defaults
- systemctl start exim4
- check_result 0 ‘exim4 start failed’
- ‘[’ 0 -ne 0 ‘]’
- ‘[’ yes = yes ‘]’
- echo ‘[ * ] Installing Dovecot’
[ * ] Installing Dovecot - apt install -q -y dovecot-pop3d dovecot-imapd
- echo ‘[ * ] Configuring Dovecot POP/IMAP mail server…’
[ * ] Configuring Dovecot POP/IMAP mail server… - gpasswd -a dovecot mail
- cp -rf /usr/local/hestia/install/common/dovecot /etc/
- cp -f /usr/local/hestia/install/deb/logrotate/dovecot /etc/logrotate.d/
- rm -f /etc/dovecot/conf.d/15-mailboxes.conf
- chown -R root:root /etc/dovecot /etc/dovecot.bak
- touch /var/log/dovecot.log
- chown -R dovecot:mail /var/log/dovecot.log
- chmod 660 /var/log/dovecot.log
++ dovecot --version
++ cut -f -2 -d . - version=2.3
- ‘[’ 2.3 = 2.2 ‘]’
- update-rc.d dovecot defaults
- systemctl start dovecot
- check_result 0 ‘dovecot start failed’
- ‘[’ 0 -ne 0 ‘]’
- /usr/local/hestia/bin/v-change-sys-config-value IMAP_SYSTEM dovecot
- ‘[’ yes == yes ‘]’
- ‘[’ yes == yes ‘]’
- echo ‘[ * ] Installing Roundcube…’
[ * ] Installing Roundcube… - /usr/local/hestia/bin/v-add-sys-roundcube
ERROR: Install done from apt source, unable to continue - /usr/local/hestia/bin/v-change-sys-config-value WEBMAIL_ALIAS webmail
- ‘[’ yes = yes ‘]’
- echo ‘[ * ] Installing Sieve packages…’
[ * ] Installing Sieve packages… - apt install -q -y dovecot-sieve dovecot-managesieved
- RC_INSTALL_DIR=/var/lib/roundcube
- RC_CONFIG_DIR=/etc/roundcube
- echo ‘[ * ] Installing Sieve Mail Filter…’
[ * ] Installing Sieve Mail Filter… - sed -i ‘s/namespace/service stats {\n unix_listener stats-writer {\n group = mail\n mode = 0660\n user = dovecot\n }\n}\n\nnamespace/g’ /etc/dovecot/dovecot.conf
- sed -i -E -z ‘s/ }\n user = dovecot\n}/ }\n unix_listener auth-master {\n group = mail\n mode = 0660\n user = dovecot\n }\n user = dovecot\n}/g’ /etc/dovecot/conf.d/10-master.conf
- sed -i ‘s/#mail_plugins = $mail_plugins/mail_plugins = $mail_plugins quota sieve\n auth_socket_path = /var/run/dovecot/auth-master/g’ /etc/dovecot/conf.d/15-lda.conf
- sed -i ‘s/mail_plugins = quota imap_quota/mail_plugins = quota imap_quota imap_sieve/g’ /etc/dovecot/conf.d/20-imap.conf
- cp -f /usr/local/hestia/install/common/dovecot/sieve/20-managesieve.conf /usr/local/hestia/install/common/dovecot/sieve/90-sieve-extprograms.conf /usr/local/hestia/install/common/dovecot/sieve/90-sieve.conf /etc/dovecot/conf.d
- echo -e ‘require [“fileinto”];\n# rule:[SPAM]\nif header :contains “X-Spam-Flag” “YES” {\n fileinto “INBOX.Spam”;\n}\n’
- sed -i ‘s/\stransport = local_delivery/ transport = dovecot_virtual_delivery/’ /etc/exim4/exim4.conf.template
- sed -i ‘s/address_pipe:/dovecot_virtual_delivery:\n driver = pipe\n command = /usr/lib/dovecot/dovecot-lda -e -d ${extract{1}{:}{${lookup{$local_part}lsearch{/etc/exim4/domains/${lookup{$domain}dsearch{/etc/exim4/domains/}}/accounts}}}}@${lookup{$domain}dsearch{/etc/exim4/domains/}}\n delivery_date_add\n envelope_to_add\n return_path_add\n log_output = true\n log_defer_output = true\n user = ${extract{2}{:}{${lookup{$local_part}lsearch{/etc/exim4/domains/${lookup{$domain}dsearch{/etc/exim4/domains/}}/passwd}}}}\n group = mail\n return_output\n\naddress_pipe:/g’ /etc/exim4/exim4.conf.template
- touch /var/log/dovecot.log
- chown -R dovecot:mail /var/log/dovecot.log
- chmod 660 /var/log/dovecot.log
- ‘[’ -d /var/lib/roundcube ‘]’
- mkdir -p /etc/roundcube/plugins/managesieve
- cp -f /usr/local/hestia/install/common/roundcube/plugins/config_managesieve.inc.php /etc/roundcube/plugins/managesieve/config.inc.php
- ln -s /etc/roundcube/plugins/managesieve/config.inc.php /var/lib/roundcube/plugins/managesieve/config.inc.php
ln: failed to create symbolic link ‘/var/lib/roundcube/plugins/managesieve/config.inc.php’: File exists - chown -R hestiamail:www-data /etc/roundcube/
- chmod 751 -R /etc/roundcube
- chmod 644 /etc/roundcube/config.inc.php /etc/roundcube/debian-db-roundcube.php /etc/roundcube/debian-db.php /etc/roundcube/defaults.inc.php /etc/roundcube/mimetypes.php
- chmod 644 /etc/roundcube/plugins/managesieve/config.inc.php
- sed -i ‘s/“archive”/“archive”, “managesieve”/g’ /etc/roundcube/config.inc.php
- chmod 640 /etc/roundcube/config.inc.php
- systemctl restart dovecot
- systemctl restart exim4
- /usr/local/hestia/bin/v-change-sys-config-value SIEVE_SYSTEM yes
- ‘[’ yes = yes ‘]’
- echo ‘[ * ] Installing SpamAssassin…’
[ * ] Installing SpamAssassin… - apt install -q -y spamassassin
- ‘[’ 24.04 = 24.04 ‘]’
- spamd_srvname=spamd
- echo ‘[ * ] Configuring SpamAssassin…’
[ * ] Configuring SpamAssassin… - update-rc.d spamd defaults
- sed -i s/ENABLED=0/ENABLED=1/ /etc/default/spamd
- systemctl start spamd
- check_result 0 ‘spamd start failed’
- ‘[’ 0 -ne 0 ‘]’
++ systemctl list-unit-files
++ grep spamassassin - unit_files=‘spamassassin-maintenance.service static -
spamassassin-maintenance.timer disabled enabled’ - [[ spamassassin-maintenance.service static -
spamassassin-maintenance.timer disabled enabled =~ disabled ]] - systemctl enable spamd
- sed -i s/#CRON=1/CRON=1/ /etc/default/spamd
- /usr/local/hestia/bin/v-change-sys-config-value ANTISPAM_SYSTEM spamassassin
- echo ‘[ * ] Done!’
[ * ] Done!
It should be ok now except roundcube, because you also installed roundcube from OS packages
. Run this script:
/usr/local/hestia/install/upgrade/manual/migrate_roundcube.sh
Processing triggers for fontconfig (2.15.0-1.1ubuntu2) …
[ * ] Delete possible trail
Error: Unable to create database roundcube
mysqldump: Deprecated program name. It will be removed in a future release, use ‘/usr/bin/mariadb-dump’ instead
mysql: Deprecated program name. It will be removed in a future release, use ‘/usr/bin/mariadb’ instead
mysql: Deprecated program name. It will be removed in a future release, use ‘/usr/bin/mariadb’ instead
Executing database schema update.
ERROR: SQLSTATE[HY000] [1045] Access denied for user ‘roundcube’@‘localhost’ (using password: YES)
ERROR: Failed to connect to database
The mail service is totally broken and Roundcube does not work
Take backups (v-backup-users) then wipe the server, reinstall hestia and restore the backups. Its probaly the easiest way.
I think it will be the best. I only have one question: can I restore a backup copy older than the one that appears in the Hestia Backup option? I ask this because even though the oldest copy is in the /backup folder, Hestia does not show it