Fails to install correctly if /etc/group contains any line matching "kvm"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
kvm (Debian) |
Fix Released
|
Unknown
|
|||
kvm (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Binary package hint: kvm
This is a copy of the same debian bug which also affects ubuntu.
In debian i uploaded kvm-72+dfsg-2 to fix it, which is now migrating to Lenny.
kvm's preinst contains the following code:
> GROUP=kvm
>
> # Workaround for bug in addgroup
> . /etc/adduser.conf
> [ -z "$FIRST_SYSTEM_UID" ] && exit 1
> [ -z "$LAST_SYSTEM_UID" ] && exit 2
>
> GID=$(grep ${GROUP} /etc/group >/dev/null && grep ${GROUP} /etc/group | cut -d ':' -f 3)
>
> if [ -n "$GID" ] \
> && [ "$GID" -lt "$FIRST_SYSTEM_UID" \
> -o "$GID" -gt "$LAST_SYSTEM_UID" ]; then
> cat >&2 <<EOF
>
> Error: The kvm package needs to create a group named "${GROUP}" in
> /etc/group to be used for /dev/kvm, but the group ${GROUP} already exists
> and it is not a group in the system range (${FIRST_
> the circumstances, you may want to remove or rename the currently
> existing ${GROUP} group before reinstalling the kvm package.
>
> Aborting the installation of kvm now.
>
> EOF
> exit 3
> fi
>
> if [ -z "$GID" ]; then
> /usr/sbin/addgroup --system ${GROUP}
> if [ $? -ne 0 ]; then
> echo >&2 "Error: failed to add the group ${GROUP}."
> exit 4
> fi
> else
> echo >&2 "kvm: Using the existing group \"$GROUP\" (gid $GID) for /dev/kvm"
> fi
In particular, note that it simply does "grep ${GROUP} /etc/group".
This will match any line in /etc/group which contains the string
"kvm". This can lead to two possible failures:
* If an /etc/group line for a non-system group contains "kvm"
somewhere, the install will incorrectly complain that the group
already exists.
* If an /etc/group line for a system group contains "kvm" somewhere,
kvm will use it rather than creating a group "kvm".
Might I suggest "getent group kvm"?
(Also, I haven't seen code like this in any other package that creates
a group.)
- Josh Triplett
Changed in kvm (Debian): | |
status: | Unknown → Fix Released |
Thank you for your bug report. It seems that this has been fixed in Debian. I will prepare a fixed Ubuntu package when I get home from work if somebody else has not done so already.