Skip to content

OS detection fails for Debian Bookworm #1606

@dboehmer

Description

@dboehmer

Describe the bug

I upgraded a server of mine to Debian 12 Bookworm and started my Rexfile. After some steps Rex fails because it does not correctly detect Debian 12.

Output of test file from below (redacted):

$ rex -f test -u root -H bookworm.example test
[2023-08-24 07:57:17] INFO - Running task test on bookworm.example
[2023-08-24 07:57:18] INFO - OS not supported (No LSB modules are available.
Debian)
[2023-08-24 07:57:18] ERROR - Error executing task:
[2023-08-24 07:57:18] ERROR - OS/Provider not supported at .../lib/site_perl/5.34.0/Rex/Pkg.pm line 72, <> line 80.

[2023-08-24 07:57:18] ERROR - 1 out of 1 task(s) failed:
[2023-08-24 07:57:18] ERROR -   test failed on bookworm.example
[2023-08-24 07:57:18] ERROR -           OS/Provider not supported at .../lib/site_perl/5.34.0/Rex/Pkg.pm line 72, <> line 80.

Expected behavior

Old behavior with Debian 11 Bullseye (output redacted):

$ rex -f test -u root -H bullseye.example test
[2023-08-24 07:57:28] INFO - Running task test on bullseye.example
[2023-08-24 07:57:29] INFO - Installing sdfasdfasdfasfdafd-doesnt-exist.
[2023-08-24 07:57:29] WARN - Error installing sdfasdfasdfasfdafd-doesnt-exist.
[2023-08-24 07:57:29] ERROR - Error executing task:
[2023-08-24 07:57:29] ERROR - Error installing sdfasdfasdfasfdafd-doesnt-exist at .../lib/site_perl/5.34.0/Rex/Pkg/Base.pm line 94, <> line 80.

[2023-08-24 07:57:29] ERROR - 1 out of 1 task(s) failed:
[2023-08-24 07:57:29] ERROR -   test failed on bullseye.example
[2023-08-24 07:57:29] ERROR -           Error installing sdfasdfasdfasfdafd-doesnt-exist at .../lib/site_perl/5.34.0/Rex/Pkg/Base.pm line 94, <> line 80.

How to reproduce it

  1. have Debian 12 Bookworm server
  2. run Rexfile to manage that including package install

Code example

Test Rexfile:

task test => sub {
    install 'sdfasdfasdfasfdafd-doesnt-exist';
};

Additional context

if ( my $ret = i_run "lsb_release -s -i" ) {
looks like Rex asks lsb_release -s -i for detecting the OS. Output via SSH is the same Debian for both host OS versions. But when run in an interactive terminal the behavior changed:

$ ssh root@bullseye.example
# lsb_release -s -i
Debian
# exit
logout
Connection to bullseye.example closed.
$ ssh root@bookworm.example
# lsb_release -s -i
No LSB modules are available.
Debian
# exit
logout
Connection to bookworm.example closed.

The method is_debian() in lib/Rex/Commands/Gather.pm receives the string No LSB modules are available.\nDebian with a literal newline character as argument.

As a workaround I monkeypatched the method to always return true. That way I was able to successfully run my Rexfile.

Rex version

(R)?ex 1.14.3

Perl version

5.34.0

Operating system running rex

Debian 11 Bullseye

Operating system managed by rex

Debian 12 Bookworm

How rex was installed?

cpan client

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions