Reinstalling webmin in live server!

SYSTEM INFORMATION
OS type and version Ubuntu 22.04 LTS (Jammy Jellyfish)
Webmin version 2.202
Virtualmin version 7.30.2

I did do-release-upgrade from 22.04 to 22.04.5 & now my webmin is broken. I can’t create, edit & remove any of my virtual-servers, user account, mail users, DNS, no file manager, nothing. Luckily all my web-applications are running well.
I tried
root@vm:~# sh virtualmin-install.sh --setup (to update virtualmin repo)
root@vm:~# dpkg-reconfigure webmin

debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.)
debconf: falling back to frontend: Readline

What should I do? should I reinstall Webmin on this live server?
Is it safe to run Virtualmin install script in a live server?

Please help.

No! That’s never the right answer and can only ever break things more.

No! That’s even less the right answer (literally never do that).

I don’t know what this means, exactly. What error(s) do you get? What do you see that has caused you to panic? I can’t think of any failure mode that does what you’re describing, so I need more information to be able to figure out what’s going wrong.

Thanks @Joe for your quick response. Sorry for my uncleared description.

Please see my Webmin Dashboard:

I have 6 website running on this instance. Dashboard shows nothing but servers are on live. If I can’t find my servers in Dashboard how could I edit/work on them (file-manager, database, email users, backup etc)…?

I tried to reconfigure webmin but it failed.

root@vm:~# sh virtualmin-install.sh --setup (to update virtualmin repo)
root@vm:~# dpkg-reconfigure webmin

debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.)
debconf: falling back to frontend: Readline

You’ve somehow convinced Virtualmin to make root into a virtual server owner, rather than a super user. I don’t know how, as I thought we’d protected against every way that could be done (it used to be pretty easy to do accidentally, if you created a virtual server and put root in the owner field, or if your browser auto-filled root in the owner field of a virtual server when editing it, but that shouldn’t be easy now).

So, you need to grant the root user access to the ACL module, and then use the ACL module to grant access to all virtual servers in Virtualmin.

Edit /etc/webmin/webmin.acl and change the root line (which will be quite short now that it’s been configured to be a virtual server owner) into this:

root: acl adsl-client apache at backup-config bacula-backup bandwidth bind8 change-user cluster-copy cluster-cron cluster-passwd cluster-shell cluster-software cluster-useradmin cluster-usermin cluster-webmin cpan cron custom dfsadmin dhcpd dovecot exim exports fail2ban fdisk fetchmail filemin filter firewall firewall6 firewalld fsdump heartbeat htaccess-htpasswd idmapd inetd init inittab ipfilter ipfw ipsec iscsi-client iscsi-server iscsi-target iscsi-tgtd krb5 ldap-client ldap-server ldap-useradmin logrotate logviewer lpadmin lvm mailboxes mailcap man mount mysql net nis openslp package-updates pam pap passwd phpini postfix postgresql ppp-client pptp-client pptp-server proc procmail proftpd qmailadmin quota raid samba sarg sendmail servers shell shorewall shorewall6 smart-status smf software spam squid sshd status stunnel syslog-ng syslog system-status tcpwrappers time tunnel updown useradmin usermin webalizer webmin webmincron webminlog xinetd xterm virtual-server virtualmin-awstats virtualmin-htpasswd ruby-gems php-pear jailkit

Then, restart Webmin (systemctl restart webmin and reload the Webmin window), and browse to Webmin->Webmin Users->root->Available Modules and find Virtualmin Virtual Server in the list of modules, click on the name of the module, and then click “Reset to full access”, then save it.

That probably gets you back to normalish. Though File Manager probably also needs to be tweaked manually the ACL page, as it thinks you’re a regular user, now.

Making a Virtual Server owned by root downgrades root to a Virtual Server owner user and never makes sense. (But, people used to do it all the time. If you remember how you made root the owner of listings.sg, I’d appreciate a description of how you did it, because we really want to make that kind of mistake impossible.)

And, to be clear: Uninstalling/reinstalling/etc. would not fix this problem (it won’t fix any problem, but it definitely won’t fix this one).

2 Likes

Neither of those can possibly do anything useful here.

You do not want to restore Virtualmin or Webmin to “freshly installed” state, so stop trying to find ways to do that. The “freshly installed state” wouldn’t have any domains or any configuration you’ve done. That would be catastrophic, not a solution. (Luckily, the package manager tries to protect you from that kind of mistake.)

Webmin Menu is not available in my instance (I tried clearing cache & cookies, checked in Chrome & Firefox).

Note: I have 4 virtual server (website) running on this server. But not showing up in menu. Only listings.sg is showing up (though .

Note: ACL for user root is correct in my case (as you directed).

Webmin & Virtualmin comand-line tool is working.

Also please see Virtualmin > Virtual Server Details

A bit History:
After I did do-release-upgrade my webmin dashboard looks like this:

All 4 top level domain labeled as number & virtualmin is unable to trace them (directory, assigned database, users, etc)
Virtualmin can recognize sub-domains correctly (directory, assigned database, users, etc)

then I tried Virtualmin > Manage virtual server > Change domain name & tried to change the numeric value with real domain name (for the domain listings.sg). & then the menu broke completely. Now it is unable to find anything. Though all my server’s are live.

Please slow down. You’re trying really hard to make this situation unrecoverable. Also, please tell me you have Virtualmin backups that you made just before you did a major thing like an OS upgrade? That will have your domain information in a form that can be easily recovered.

@Ilia @Jamie this looks like another case of the Virtualmin config files being wiped out during an upgrade. How can OP recover those configs without breaking anything else? And, where are we on fixing that? We can’t roll any more Virtualmin updates until this one is identified and fixed (it happens very rarely, but “very rare” multiplied by 150,000+ installations is at least a handful of people panicked every time we roll a release).

Yes, it is.

It’s fairly easy, as explained below—I wrote a script that can be used to solve this issue, which helps to extract Virtualmin configuration from Etckeeper backups. We will need another release as soon as possible to address this and several other issues either way. And, if it were that simple, we would have fixed it already… remaining idle won’t solve the problem.

I have recently fixed the file locking for the upcoming 7.30.3 issue on Virtualmin domain configs, which could have caused this exact problem.

@tawfiq Yes, it might seem related to ACLs at first, but it is not. It’s related to writing a broken config files.

You can use the script below to extract the latest available backup of config files from Etckeeper and manually replace them in the /etc/webmin/virtual-server/domains directory and /etc/webmin/virtual-server/config itself!

#!/bin/sh

# Exit immediately if a command fails
set -e

# Check for mandatory parameters
if [ $# -lt 2 ]; then
    echo "Usage: $0 <TARGET_DIR> <SOURCE_DIR> [DEPTH] [GIT_REPO]"
    echo
    echo "Arguments:"
    echo "  TARGET_DIR   Absolute path to directory where extracted files will be stored"
    echo "  SOURCE_DIR   Path (relative to Git repository root) for files to extract"
    echo "  DEPTH        Number of recent backups to extract (optional, defaults to all)"
    echo "  GIT_REPO     Absolute path to Git repository (optional, defaults: /etc/.git)"
    echo
    echo "Examples:"
    echo "  $0 ~/git-backups webmin/virtual-server"
    echo "  $0 ~/git-backups webmin/virtual-server 1"
    echo "  $0 ~/git-backups webmin/virtual-server 0 /path/to/another/git-repo"
    exit 1
fi

# Set directory paths from arguments
TARGET_DIR="$1"
SOURCE_DIR="$2"
DEPTH="${3:-0}"
GIT_REPO="${4:-/etc/.git}"

# If TARGET_DIR is ".", default to the home directory
if [ "$TARGET_DIR" = "." ]; then
    TARGET_DIR="$HOME"
fi

# Check if Git repository exists
if [ ! -d "$GIT_REPO" ]; then
    echo "Error: Git repository not found in $GIT_REPO"
    exit 1
fi

# Create the target directory if it doesn't exist
mkdir -p "$TARGET_DIR"

# Change to the Git repository directory
cd "$GIT_REPO" || exit 1

# Get all commit hashes that modified files in the specified source directory
if [ "$DEPTH" -gt 0 ]; then
    COMMITS=$(git log -n "$DEPTH" --format="%H" -- "$SOURCE_DIR")
else
    COMMITS=$(git log --format="%H" -- "$SOURCE_DIR")
fi

# Loop through each commit
for COMMIT in $COMMITS; do
    # Get the commit date
    COMMIT_DATE=$(git show -s --format="%cd" --date=format:"%Y-%m-%d" "$COMMIT")
    
    # Create a directory for this date if it doesn't exist
    DEST_DIR="$TARGET_DIR/$COMMIT_DATE"
    mkdir -p "$DEST_DIR"
    
    # Extract all files for this commit
    git ls-tree -r "$COMMIT" --name-only "$SOURCE_DIR" | while read -r FILE; do
        # Create subdirectories if needed
        SUBDIR=$(dirname "$FILE")
        mkdir -p "$DEST_DIR/$SUBDIR"

        # Extract the file content
        git show "$COMMIT:$FILE" > "$DEST_DIR/$FILE"
        echo "Extracted $FILE (date: $COMMIT_DATE)"
    done
done

Put this script to /usr/local/sbin/git-extractor.sh and run it as:

sh git-extractor.sh /root/virtualmin-config-backups webmin/virtual-server/domains 1

Then you can use the most recent extracted files to replace the broken ones in the /etc/webmin/virtual-server/domains directory. If the extracted files aren’t exactly what you expect, you can extract older backups by passing the depth as the third parameter, e.g.:

sh git-extractor.sh /root/virtualmin-config-backups webmin/virtual-server/domains 5

Sorry about that!

@Ilia which was the patch that fixes this issue?

This one in particular, followed by this one. I believe what might have happened is that the config check was running in the background alongside the upgrade process (postinstall.pl) and disrupted the domain config files…

Thanks @Ilia for your cordial co-operation.
Please guide me how can I fix webmin menu/dashboard.

Once my webmin/virtualmin panel is fixed I can restore config files or at-list create new servers.

Have you blanked out info as I don’t see a Admin username?

looks like the OP has not copied the files extracted from etckeeper to their correct location & restarted webmin

Opps should of read full post.

You should extract Virtualmin domain configs:

sh git-extractor.sh /root/virtualmin-config-backups webmin/virtual-server/domains 3

and Virtualmin main config file:

sh git-extractor.sh /root/virtualmin-config-backups webmin/virtual-server/config 3

Take the latest extracted backup files after running the code above, and double-check they are not corrupted by examining them and making a guess based on their size (usually, corrupted files have a much smaller size). If they are corrupt, choose the other version from the directory with the older date. Copy the chosen files from /root/virtualmin-config-backups to /etc/webmin/virtual-server.

The issue with the broken navigation must be related to the main Virtualmin config file i.e., /etc/webmin/virtual-server/config needs to be restored from the backup. The problem with domains being shown as numbers is due to corrupt domain config files located in /etc/webmin/virtual-server/domains directory.

Broken Navigation Issue solved!!!

@Joe was right. it was ACL issue. I found unusual root.acl file in /etc/webmin/ & /etc/webmin/virtual-server/ folder. Removed them with

rm /etc/webmin/virtual-server/root.acl
rm /etc/webmin/root.acl

Now I am getting my dashboard correctly.

Facing file permission issues:

" You are not allowed to access /home/USER/public_html. The only allowed directories are: ``.

Note: I don’t have /root/virtualmin-config-backups :frowning_face:
I have to recreate config file manually.

Anyway Thanks everyone. It was a good experience.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.