Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment variable LOGNAME or USER does not correspond to effective user id #130

Open
tompscanlan opened this issue Apr 29, 2024 · 5 comments
Labels
bug invalid Out of scope/alignment with the project, or issue is expected, intended behavior. stage/waiting-reply

Comments

@tompscanlan
Copy link

Overview of the Issue

Running packer on a host indirectly. I'm seeing a warning that looks like it is causing a parsing error. when doing a VBoxManage --version.

This is the error:

Error reading version for guest additions download: No version found: WARNING: Environment variable LOGNAME or USER does not correspond to effective user id. 7.0.16r162802

Reproduction Steps

I'm only able reproduce using this indirect call to packer through another tool. Error seems to be here:

versionRe := regexp.MustCompile("^([.0-9]+)(?:_(?:RC|OSEr)[0-9]+)?")
when a string is prepended to the version.

Plugin and Packer version

Packer v1.10.2

Simplified Packer Buildfile

If the file is longer than a few dozen lines, please include the URL to the
gist of the log or use the Github detailed
format

instead of posting it directly in the issue.

Operating system and Environment details

Happens on Ubuntu and Rocky Linux.

Log Fragments and crash.log files

virtualbox-iso.vm: output will be in this color.
2024/04/29 20:44:09 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2024/04/29 20:44:09 VBoxManage path: /usr/bin/VBoxManage
2024/04/29 20:44:09 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 2024/04/29 20:44:09 VBoxManage --version output: WARNING: Environment variable LOGNAME or USER does not correspond to effective user id.
2024/04/29 20:44:09 packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64 plugin: 7.0.16r162802
2024/04/29 20:44:09 [INFO] (telemetry) ending virtualbox-iso.vm
7.0.16r162802
==> Wait completed after 29 milliseconds 413 microseconds
2024/04/29 20:44:09 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2024/04/29 20:44:09 machine readable: virtualbox-iso.vm,error []string{"Error reading version for guest additions download: No version found: WARNING: Environment variable LOGNAME or USER does not correspond to effective user id.\n7.0.16r162802"}
7.0.16r162802
==> Builds finished but no artifacts were created.
2024/04/29 20:44:09 [INFO] (telemetry) Finalizing.
Build 'virtualbox-iso.vm' errored after 29 milliseconds 337 microseconds: Error reading version for guest additions download: No version found: WARNING: Environment variable LOGNAME or USER does not correspond to effective user id.
7.0.16r162802
==> Wait completed after 29 milliseconds 413 microseconds
==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso.vm: Error reading version for guest additions download: No version found: WARNING: Environment variable LOGNAME or USER does not correspond to effective user id.
7.0.16r162802
==> Builds finished but no artifacts were created.
2024/04/29 20:44:10 waiting for all plugin processes to complete...
2024/04/29 20:44:10 /usr/local/bin/packer: plugin process exited
2024/04/29 20:44:10 /tmp/runner-3846468805/.config/packer/plugins/github.com/hashicorp/virtualbox/packer-plugin-virtualbox_v1.0.5_x5.0_linux_amd64: plugin process exited
2024/04/29 20:44:10 /usr/local/bin/packer: plugin process exited
2024/04/29 20:44:10 /usr/local/bin/packer: plugin process exited
2024/04/29 20:44:10 /usr/local/bin/packer: plugin process exited
2024/04/29 20:44:10 /usr/local/bin/packer: plugin process exited
@tompscanlan
Copy link
Author

Opened ticket upstream, but we could be defensive with a slightly tighter regex.

https://www.virtualbox.org//ticket/22060#ticket

@nywilken
Copy link
Contributor

nywilken commented Jul 19, 2024

Hi there @tompscanlan this is not a bug in the plugin, as the returned version from VBoxManage --version is returning "Environment variable LOGNAME or USER does not correspond to effective user id\n7.0.16r162802" which is indeed not a validated version. The VBoxManage command is returning this warning because the invocation of Packer is executed by a user whose name does not match the logged-in user $LOGNAME. Can you shed some light on where you are invoking Packer and how?

Are you invoking the script via a crontab?

If you are invoking Packer from a crontab, specify a username or set the user to $LOGNAME via env USER=$LOGNAME in the crontab entry.

@nywilken nywilken added invalid Out of scope/alignment with the project, or issue is expected, intended behavior. stage/waiting-reply and removed stage/needs-investigation labels Jul 19, 2024
@tompscanlan
Copy link
Author

I forget details now, but invocation was not via crontab, but was indirect like Makefile -> scriptA.sh -> scriptB.sh which may have switched users.

The real issue is upstream I believe, My ask here is to improve the error message. I dug for a bit and could have saved time with a better error. If it doesn't make sense to change, then no worries, just close.

@vyngur
Copy link

vyngur commented Oct 21, 2024

Hi,
I see this happening while running VirtualBox >= 7.0.16 (official and rpmfusion) inside Docker. While on 7.0.14 everything was working but now Packer (tested with 1.10.3 and 1.11.2) builds break with the aforementioned message:

2024/10/18 16:27:59 Starting build run: virtualbox-iso.AlmaLinux
2024/10/18 16:27:59 Running builder: virtualbox-iso
2024/10/18 16:27:59 [INFO] (telemetry) Starting builder virtualbox-iso.AlmaLinux
2024/10/18 16:27:59 packer-plugin-virtualbox_v1.1.1_x5.0_linux_amd64 plugin: 2024/10/18 16:27:59 VBoxManage path: /usr/bin/VBoxManage
2024/10/18 16:28:00 packer-plugin-virtualbox_v1.1.1_x5.0_linux_amd64 plugin: 2024/10/18 16:28:00 VBoxManage --version output: WARNING: Environment variable LOGNAME or USER does not correspond to effective user id.
2024/10/18 16:28:00 packer-plugin-virtualbox_v1.1.1_x5.0_linux_amd64 plugin: 7.1.0_rpmfusionr164728
2024/10/18 16:28:00 [INFO] (telemetry) ending virtualbox-iso.AlmaLinux
7.1.0_rpmfusionr164728
==> Wait completed after 82 milliseconds 839 microseconds
2024/10/18 16:28:00 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2024/10/18 16:28:00 machine readable: virtualbox-iso.AlmaLinux,error []string{"Error reading version for guest additions download: No version found: WARNING: Environment variable LOGNAME or USER does not correspond to effective user id.\n7.1.0_rpmfusionr164728"}
7.1.0_rpmfusionr164728
==> Builds finished but no artifacts were created.
2024/10/18 16:28:00 [INFO] (telemetry) Finalizing.
2024-10-18T16:28:00Z: Build 'virtualbox-iso.AlmaLinux' errored after 82 milliseconds 745 microseconds: Error reading version for guest additions download: No version found: WARNING: Environment variable LOGNAME or USER does not correspond to effective user id.
7.1.0_rpmfusionr164728

==> Wait completed after 82 milliseconds 839 microseconds

==> Some builds didn't complete successfully and had errors:
--> virtualbox-iso.AlmaLinux: Error reading version for guest additions download: No version found: WARNING: Environment variable LOGNAME or USER does not correspond to effective user id.
7.1.0_rpmfusionr164728

On the host side everything's as expected:

[user@localhost]$ vboxmanage --version
7.1.0_rpmfusionr164728

@ifurther
Copy link

The message is this
WARNING: Environment variable LOGNAME or USER does not correspond to effective user id.\n7.1.0_rpmfusionr164728
Maybe this line is broken

versionRe := regexp.MustCompile("^([.0-9]+)(?:_(?:RC|OSEr)[0-9]+)?")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug invalid Out of scope/alignment with the project, or issue is expected, intended behavior. stage/waiting-reply
Projects
None yet
Development

No branches or pull requests

5 participants