dleidert / openmediavault-upgrade

Script to upgrade openmediavault from one major release into the next
GNU General Public License v3.0
48 stars 1 forks source link

run.d/30-debconf-preselect: Might fail if there are two users/entries using the word "backup" #15

Closed godfuture closed 3 years ago

godfuture commented 3 years ago

Following answer from https://github.com/dleidert/openmediavault-upgrade/issues/14#issuecomment-757141329 I tried to upgrade my system. I get the following error:

run-parts: executing /root/openmediavault-upgrade-4.6/run.d/30-debconf-preselect
error: parse error on line 1: 'base-passwd base-passwd/system/user/backup/shell/_usr_sbin_nologin'
warning: Unknown type false, skipping line 2
run-parts: /root/openmediavault-upgrade-4.6/run.d/30-debconf-preselect exited with return code 1

I have tested the input into echo, which is the same:

root@media-server:~/openmediavault-upgrade-4.6# shell="$(grep backup /etc/passwd | awk -F ':' '{print $7}' | tr '/' '_')"
root@media-server:~/openmediavault-upgrade-4.6# $shell
bash: _usr_sbin_nologin: Kommando nicht gefunden.
root@media-server:~/openmediavault-upgrade-4.6# shell="$(grep nobody /etc/passwd | awk -F ':' '{print $7}' | tr '/' '_')"
root@media-server:~/openmediavault-upgrade-4.6# $shell
bash: _usr_sbin_nologin: Kommando nicht gefunden.
dleidert commented 3 years ago

If you do shell="..." && $shell the contents of $shell will be executed as command, thus leading to the error that the command is unknown. What you want to do is print the contents of the variable: shell="..." && echo $shell. What does:

sudo grep backup /etc/passwd | awk -F ':' '{print $7}' | tr '/' '_'
sudo grep nobody /etc/passwd | awk -F ':' '{print $7}' | tr '/' '_'

say?

godfuture commented 3 years ago

This is the output:

root@media-server:~/openmediavault-upgrade-4.6# sudo grep backup /etc/passwd | awk -F ':' '{print $7}' | tr '/' '_'
_usr_sbin_nologin
_bin_false
root@media-server:~/openmediavault-upgrade-4.6# sudo grep nobody /etc/passwd | awk -F ':' '{print $7}' | tr '/' '_'
_usr_sbin_nologin
dleidert commented 3 years ago

There are two users with the name of "backup". Thus creating a preseed line which is not correct. I need to change the grep part.

dleidert commented 3 years ago

Should be fixed in all branches.

dleidert commented 3 years ago

You can test it with both fixes using

wget -qO- https://github.com/dleidert/openmediavault-upgrade/archive/e15e0f707981ee005cdf408187cc49347aa93d36.tar.gz | tar -xz
sudo openmediavault-upgrade-e15e0f707981ee005cdf408187cc49347aa93d36/omv-release-upgrade-5