DietPi-Patch Error while updating to Dietpi v9.11

Details:

  • Date | 2025-02-25 14:17:18
  • Program name | DietPi-Patch
  • Command | usermod -rG pihole www-data
  • Exit code | 2
  • DietPi version | v9.11.0 (MichaIng/master)
  • Distro version | bullseye (ID=6,RASPBIAN=1)
  • Kernel version | Linux DietPi 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l GNU/Linux
  • Architecture | armhf
  • Hardware model | RPi 3 Model B (armv7l) (ID=3)
  • Power supply | (EG: RAVPower 5V 1A)
  • SD card | (EG: SanDisk Ultra 16 GB)
  • Pre-image | Raspbian Lite

Steps to reproduce:

  1. I simply ran dietpi-update

Expected behaviour:

  • Update should complete without error

Actual behaviour:

  • Update stopped due to error.

Extra details:

  • I had already manually updated PiHole to v6 by pihole -up prior to running dietpi-update

Additional logs:

usermod: invalid option -- 'r'
Usage: usermod [options] LOGIN

Options:
  -b, --badnames                allow bad names
  -c, --comment COMMENT         new value of the GECOS field
  -d, --home HOME_DIR           new home directory for the user account
  -e, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE
  -f, --inactive INACTIVE       set password inactive after expiration
                                to INACTIVE
  -g, --gid GROUP               force use GROUP as new primary group
  -G, --groups GROUPS           new list of supplementary GROUPS
  -a, --append                  append the user to the supplemental GROUPS
                                mentioned by the -G option without removing
                                the user from other groups
  -h, --help                    display this help message and exit
  -l, --login NEW_LOGIN         new value of the login name
  -L, --lock                    lock the user account
  -m, --move-home               move contents of the home directory to the
                                new location (use only with -d)
  -o, --non-unique              allow using duplicate (non-unique) UID
  -p, --password PASSWORD       use encrypted password for the new password
  -R, --root CHROOT_DIR         directory to chroot into
  -P, --prefix PREFIX_DIR       prefix directory where are located the /etc/* files
  -s, --shell SHELL             new login shell for the user account
  -u, --uid UID                 new UID for the user account
  -U, --unlock                  unlock the user account
  -v, --add-subuids FIRST-LAST  add range of subordinate uids
  -V, --del-subuids FIRST-LAST  remove range of subordinate uids
  -w, --add-subgids FIRST-LAST  add range of subordinate gids
  -W, --del-subgids FIRST-LAST  remove range of subordinate gids
  -Z, --selinux-user SEUSER     new SELinux user mapping for the user account

It seems that the usermod is stripped down from all the options and doesn’t have -r. Something @MichaIng should look at.

I ran dietpi-update for a second time and it completed without any errors. I’m not sure if any of the clean up scripts was run because I was not prompted to uninstall the previous pihole dependencies?

How do I run the clean up script manually?

Probably web server and PHP are still used by other applications. At least we check for know apps like Nextcloud. In this case, no decency will be removed.

Best indicator for a successful DietPi/ Pihole migration is the availability of PiHole on port 8089

To force a new DietPi update, you can run

dietpi-update -1

What would be helpful is if you share the entire log the next time you hit the error. That way we would know at which step it stops.

I am doing the same update (on bullseye) and got the same error, at the moment I’ve used the option to use a temp shell and this is what I can add to the OP:
I already had pihole 6 installed and I was running it on a different port as 80/4433 are used by reversed proxy.
this is the on screen log:

 DietPi-Update
─────────────────────────────────────────────────────
 Phase: Applying incremental patches

[ INFO ] DietPi-Update | Current version : v9.10.0
[ INFO ] DietPi-Update | Latest version  : v9.11.2
[ INFO ] DietPi-Patch | Patching to DietPi v9.11...
[  OK  ] DietPi-Patch | rm /var/www/pihole
[  OK  ] DietPi-Patch | rm /var/www/admin
[  OK  ] DietPi-Patch | rm -f /etc/lighttpd/conf-available/99-dietpi-pihole-block_public_admin.conf /etc/lighttpd/conf-available/99-dietpi-pihole.conf /etc/lighttpd/conf-enabled/99-dietpi-pihole-block_public_admin.conf /etc/lighttpd/conf-enabled/99-dietpi-pihole.conf
[.     ]usermod: invalid option -- 'r'hole www-data
[FAILED] DietPi-Patch | usermod -rG pihole www-data

Currently I am on the shell, so let me know what you’d like me to check
Thanks.

Same here. I upgraded pi-hole on Feb. 22. after running dietpi-update.
Today I ran dietpi-update again and saw the same error message.
I simply ran dietpi-update once more without error message.

But there’s more: Outdated certificate, unbound not working . . .
I will first google a little more before posting.

Thanks for reading, Emil

we will have a look into this

That -r option was added with Bookworm it seems, hence Bullseye systems run into this. I’ll replace it with gpasswd -d www-data pihole. Only nasty that this one fails, if the user in not in the group anymore. usermod handles this more gracefully.

I just pushed this to master directly. Retrying the update should hence work now.

1 Like

I would like to take this opportunity to point to our blog. Debian Bookworm has been released – DietPi Blog Maybe it’s the right time to update to Bookworm. Especially since the next Debian release Trixi will be released this summer 2025 and it will turn Bullseye into oldoldstable Debian :wink:

1 Like

I ran this again and there were no errors. There were still no prompt to clean up? Is there supposed to be? I only have PiHole, Vaultwarden, and Caddy on this Pi.

Depends on software installed. Can you check

dietpi-software list | grep " =2 "

Ok, looks like there were more than I thought, some that I didn’t explicitly install. Is there anything I can uninstall, Lighttpd perhaps?

ID 0 | =2 | OpenSSH Client: Feature-rich SSH, SFTP and SCP client |
ID 69 | =2 | Python 3 RPi.GPIO: Control Raspberry Pi GPIO channels in Python 3 | | https://dietpi.com/docs/software/hardware_projects/#rpigpio
ID 81 | =2 | LLSP: Lighttpd + SQLite  + PHP | +Lighttpd +SQLite +PHP | https://dietpi.com/docs/software/webserver_stack/#llsp-web-stack
ID 82 | =2 | LLMP: Lighttpd + MariaDB + PHP | +Lighttpd +MariaDB +PHP | https://dietpi.com/docs/software/webserver_stack/#llmp-web-stack
ID 84 | =2 | Lighttpd: Extremely lightweight webserver | | https://dietpi.com/docs/software/webserver_stack/#lighttpd
ID 87 | =2 | SQLite: Persistent single-file database system | | https://dietpi.com/docs/software/databases/#sqlite
ID 88 | =2 | MariaDB: Persistent cached file-per-table database server | | https://dietpi.com/docs/software/databases/#mariadb
ID 89 | =2 | PHP: Hypertext Preprocessor for dynamic web content | | https://dietpi.com/docs/software/webserver_stack/#php
ID 93 | =2 | Pi-hole: block adverts for any device on your network | +Git | https://dietpi.com/docs/software/dns_servers/#pi-hole
ID 96 | =2 | Samba Server: Feature-rich SMB/CIFS server | | https://dietpi.com/docs/software/file_servers/#samba
ID 103 | =2 | DietPi-RAMlog: Makes /var/log a RAM disk, preserves file structure on reboot | | https://dietpi.com/docs/software/log_system/#dietpi-ramlog
ID 105 | =2 | OpenSSH Server: Feature-rich SSH server with SFTP and SCP support | +OpenSSH Client | https://dietpi.com/docs/software/ssh/#openssh
ID 182 | =2 | Unbound: validating, recursive, caching DNS resolver | | https://dietpi.com/docs/software/dns_servers/#unbound
ID 183 | =2 | vaultwarden: Unofficial Bitwarden password manager server written in Rust | +SQLite | https://dietpi.com/docs/software/cloud/#vaultwarden

If not needed, removing software ID 81 and 82 should clean it.

I’ve resumed the upgrade and replaced the usermod with gpasswd -d www-data pihole and the upgrade finished successfully. However, pihole installation has changed the gui ports I’ve defined for http and https and used port 8089 for http and nothing for https.
(I had pihole 6 working on user defined ports since 80/443 were taken)
It is easy to change it back, but just wanted to mention it in case others user run into it and think pihole-web is not installed.
Thanks for the quick fix.

This is expected and communicated during DietPi update. As well we give the command how to change ports.

The Pi-hole v6 migration is indeed not done a second time, as the existence of the /var/www/pihole symlink is used as marker, and it has been removed on the first attempt already.

Webserver stacks cannot be removed directly. They are only a meta option for installing webserver, database and PHP, and the install status adjusts automatically based on whether this trio is installed. Hence, uninstall the webserver and PHP explicitly, if not needed:

dietpi-software uninstall 84 89

I also see nothing which depends on the MariaDB database server, unless you configured vaultwarden to use MariaDB instead of SQLite. But better be sure really nothing else uses it, and remember why it has been installed in the first place, before removing it.

I logged into the database and checked. Looked like a default install with the usual tables so I uninstalled it along with the others. Many thanks to you and @Joulinar.

1 Like