[Solved] Permission problems with hostnamectl after perl-core install

General support questions
Post Reply
Posts: 2
Joined: 2018/02/15 08:29:54

[Solved] Permission problems with hostnamectl after perl-core install

Post by dickieb » 2018/02/15 09:14:26

I going a little nuts trying to track this down, so I'd appreciate any help and suggestions to track it down and get a fix or workaround.

I use packer to build a qcow2 image for Openstack - recently I noticed that when instances boot cloud-init is no longer able to set the hostname via hostnamectl. This is also true when I run this manually as root:

Code: Select all

# hostnamectl set-hostname test.local
Could not set property: Access denied
Basic system information from an instance running in Openstack/kvm

Code: Select all

== BEGIN uname -rmi ==
3.10.0-693.17.1.el7.x86_64 x86_64 x86_64
== END   uname -rmi ==

== BEGIN rpm -qa \*-release\* ==
== END   rpm -qa \*-release\* ==

== BEGIN cat /etc/redhat-release ==
CentOS Linux release 7.4.1708 (Core)
== END   cat /etc/redhat-release ==

== BEGIN getenforce ==
== END   getenforce ==

== BEGIN free -m ==
              total        used        free      shared  buff/cache   available
Mem:           3790         147        1111          16        2532        3370
Swap:             0           0           0
== END   free -m ==

I have played around trying to look at what is going on in a built instance, but I failed to get any useful logging out of polkit and didn't really find anything that seemed to be leading me to what is going on.

So I turned my attention to the build process to see at what point in the process this breaks.

I start with the minimal cloud image from http://cloud.centos.org/centos/7/images ... loud.qcow2 which at the time of posting is 7.4 1708.

I then run

Code: Select all

yum -y update
followed by switching off SELinux with both a

Code: Select all

setenforce 0
and modifying the config file to disabled (I have also tried leaving it as permissive to no difference). After installing a few packages I reboot the instance if the update brings in a kernel update, which it currently does.

My packer script then goes on installing and customising the image to my needs.

I have littered this script with calls to

Code: Select all

hostnamectl set-hostname test.local
, using a different hostname every time, to see at what point the change that causes the problem happens.

This has shown that it is after installing perl-core with

Code: Select all

yum -y install perl-core
, quite a lot as happened/been installed prior to that (including installing redhat-lsb in case that's relevant), but the calls to hostnamectl at each stage are ok up perl-core being installed.

The perl install seems to be fine, and all pulled in from the base repo:

Code: Select all

    openstack: Installing:
    openstack:  perl-core                       x86_64    5.16.3-292.el7         base     42 k
    openstack: Installing for dependencies:
    openstack:  perl-Archive-Extract            noarch    1:0.68-3.el7           base     28 k
    openstack:  perl-Archive-Tar                noarch    1.92-2.el7             base     73 k
    openstack:  perl-CPAN-Meta                  noarch    2.120921-5.el7         base    113 k
    openstack:  perl-CPAN-Meta-Requirements     noarch    2.122-7.el7            base     24 k
    openstack:  perl-CPAN-Meta-YAML             noarch    0.008-14.el7           base     24 k
    openstack:  perl-CPANPLUS                   noarch    0.91.38-4.el7          base    307 k
    openstack:  perl-CPANPLUS-Dist-Build        noarch    0.70-3.el7             base     28 k
    openstack:  perl-DBD-SQLite                 x86_64    1.39-3.el7             base    1.3 M
    openstack:  perl-DBI                        x86_64    1.627-4.el7            base    802 k
    openstack:  perl-DBIx-Simple                noarch    1.35-7.el7             base     43 k
    openstack:  perl-DB_File                    x86_64    1.830-6.el7            base     74 k
    openstack:  perl-ExtUtils-CBuilder          noarch    1:     base     67 k
    openstack:  perl-ExtUtils-Embed             noarch    1.30-292.el7           base     50 k
    openstack:  perl-File-Fetch                 noarch    0.42-2.el7             base     27 k
    openstack:  perl-IO-Zlib                    noarch    1:1.10-292.el7         base     51 k
    openstack:  perl-IPC-Cmd                    noarch    1:0.80-4.el7           base     34 k
    openstack:  perl-JSON-PP                    noarch    2.27202-2.el7          base     55 k
    openstack:  perl-Locale-Maketext-Simple     noarch    1:0.21-292.el7         base     50 k
    openstack:  perl-Log-Message                noarch    1:0.08-3.el7           base     29 k
    openstack:  perl-Log-Message-Simple         noarch    0.10-2.el7             base     11 k
    openstack:  perl-Module-Build               noarch    2:0.40.05-2.el7        base    281 k
    openstack:  perl-Module-CoreList            noarch    1:2.76.02-292.el7      base     85 k
    openstack:  perl-Module-Load                noarch    1:0.24-3.el7           base     11 k
    openstack:  perl-Module-Load-Conditional    noarch    0.54-3.el7             base     18 k
    openstack:  perl-Module-Loaded              noarch    1:0.08-292.el7         base     46 k
    openstack:  perl-Module-Metadata            noarch    1.000018-2.el7         base     26 k
    openstack:  perl-Net-Daemon                 noarch    0.48-5.el7             base     51 k
    openstack:  perl-Object-Accessor            noarch    1:0.42-292.el7         base     55 k
    openstack:  perl-Package-Constants          noarch    1:0.02-292.el7         base     45 k
    openstack:  perl-Params-Check               noarch    1:0.38-2.el7           base     18 k
    openstack:  perl-Parse-CPAN-Meta            noarch    1:1.4404-5.el7         base     14 k
    openstack:  perl-Perl-OSType                noarch    1.003-3.el7            base     20 k
    openstack:  perl-PlRPC                      noarch    0.2020-14.el7          base     36 k
    openstack:  perl-Term-UI                    noarch    0.36-2.el7             base     22 k
    openstack:  perl-Thread-Queue               noarch    3.02-2.el7             base     17 k
    openstack:  perl-Time-Piece                 x86_64    1.20.1-292.el7         base     69 k
    openstack:  perl-Version-Requirements       noarch    0.101022-244.el7       base     21 k
    openstack:  perl-version                    x86_64    3:0.99.07-2.el7        base     84 k
Any ideas on what to try next to try and chase this down?

I'm going to start cutting out the rest of my install steps and see if there is another dependency that is involved - I'll update if I come to any conclusions!

Posts: 2
Joined: 2018/02/15 08:29:54

Re: [Solved] Permission problems with hostnamectl after perl-core install

Post by dickieb » 2018/02/15 17:48:34

Just a quick update.

I couldn't see a good reason why perl-core would have any impact and I would have been right.

A bit more digging showed that a transfer of files to my image was changing the permissions and ownership on /etc. This happened just before the perl-core install hence the red-herring in my earlier diagnosis.

Leaving the /etc permissions alone gets rid of the problems with

Code: Select all

hostnamectl set-hostname <hostname>
Pretty grotty diagnostics...but then if you shoot yourself in the foot it's a lot to ask I guess!

Post Reply

Return to “CentOS 7 - General Support”