dleidert / openmediavault-upgrade

Script to upgrade openmediavault from one major release into the next

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

godfuture opened this issue · comments

Following answer from #14 (comment) 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.

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?

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

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.

Should be fixed in all branches.

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