How to set the hostname assigned by DHCP server?

I will edit this post as I work through there various configuration changes:

First, no static hostname assigned:

$ rm /etc/hostname && reboot

$ hostnamectl
   Static hostname: n/a
Transient hostname: archlinux
         Icon name: computer
        Machine ID: 01a83b30426646bc8fd3d018ee8f81ed
           Boot ID: f4246185eaba41f7bdf31b9325386e45
  Operating System: Manjaro ARM
            Kernel: Linux 5.9.1-1-MANJARO-ARM
      Architecture: arm64

I have also tried an empty /etc/hostname file and a /etc/hostname file with localhost

If I then modify /etc/NetworkManager/NetworkManager.conf:

 $ cat /etc/NetworkManager/NetworkManager.conf
 $ Configuration file for NetworkManager.
 $ See "man 5 NetworkManager.conf" for details.
 [main]
 hostname-mode=dhcp

And then restart NetworkManager and check the status:

[root@archlinux ~]# systemctl status NetworkManager
● NetworkManager.service - Network Manager
 Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/NetworkManager.service.d
         └─NetworkManager-ovs.conf
 Active: active (running) since Wed 2020-11-04 14:14:50 CST; 11s ago
   Docs: man:NetworkManager(8)
Main PID: 1354 (NetworkManager)
  Tasks: 5 (limit: 3711)
  CGroup: /system.slice/NetworkManager.service
         ├─1354 /usr/bin/NetworkManager --no-daemon
         └─1366 /usr/bin/dhclient -d -q -sf /usr/lib/nm-dhcp-helper -pf /var/run/NetworkManager/dhclient-eth0.pid -lf /var/lib/NetworkManager/dhcl>

Nov 04 14:14:51 archlinux NetworkManager[1354]: <info>  [1604520891.4582] device (eth0): state change: secondaries -> activated (reason 'none', sys-if>
Nov 04 14:14:51 archlinux NetworkManager[1354]: <info>  [1604520891.4604] manager: NetworkManager state is now CONNECTED_LOCAL
Nov 04 14:14:51 archlinux NetworkManager[1354]: <info>  [1604520891.4636] manager: NetworkManager state is now CONNECTED_SITE
Nov 04 14:14:51 archlinux NetworkManager[1354]: <info>  [1604520891.4643] policy: set 'Wired connection 1' (eth0) as default for IPv4 routing and DNS
Nov 04 14:14:51 archlinux NetworkManager[1354]: <info>  [1604520891.4654] policy: set-hostname: set hostname to 'rpi' (from DHCPv4)
Nov 04 14:14:51 rpi dhclient[1366]: bound to 10.208.101.110 -- renewal in 39339 seconds.
Nov 04 14:14:51 rpi NetworkManager[1354]: <info>  [1604520891.4967] device (eth0): Activation: successful, device activated.
Nov 04 14:14:51 rpi NetworkManager[1354]: <info>  [1604520891.4992] manager: startup complete
Nov 04 14:14:51 rpi NetworkManager[1354]: <info>  [1604520891.5270] agent-manager: agent[c483dfddf3d657e3,:1.39/org.freedesktop.nm-applet/0]: agent re>
Nov 04 14:14:51 rpi NetworkManager[1354]: <info>  [1604520891.6313] manager: NetworkManager state is now CONNECTED_GLOBAL

And you see it did successfully set the name to “rpi” which is indeed the dhcpd assigned name. So at this point I thought I had it… but…

Now reboot…

$ systemctl status NetworkManager
● NetworkManager.service - Network Manager
 Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/NetworkManager.service.d
         └─NetworkManager-ovs.conf
 Active: active (running) since Wed 2020-11-04 14:25:43 CST; 1min 40s ago
   Docs: man:NetworkManager(8)
Main PID: 304 (NetworkManager)
  Tasks: 4 (limit: 3711)
 CGroup: /system.slice/NetworkManager.service
         ├─304 /usr/bin/NetworkManager --no-daemon
         └─440 /usr/bin/dhclient -d -q -sf /usr/lib/nm-dhcp-helper -pf /var/run/NetworkManager/dhclient-eth0.pid -lf /var/lib/NetworkManager/dhclient-40b69cbf-6567-3931->

Nov 04 14:26:11 archlinux NetworkManager[304]: <warn>  [1604521571.4502] policy: set-hostname: couldn't set the system hostname to 'rpi': (1) Operation not permitted
Nov 04 14:26:11 archlinux NetworkManager[304]: <warn>  [1604521571.4503] policy: set-hostname: you should use hostnamed when systemd hardening is in effect!
Nov 04 14:26:11 archlinux NetworkManager[304]: <info>  [1604521571.5047] device (eth0): Activation: successful, device activated.
Nov 04 14:26:11 archlinux NetworkManager[304]: <info>  [1604521571.5283] manager: startup complete
Nov 04 14:26:36 archlinux NetworkManager[304]: <info>  [1604521596.4789] manager: NetworkManager state is now CONNECTED_GLOBAL
Nov 04 14:26:36 archlinux NetworkManager[304]: <info>  [1604521596.4819] policy: set-hostname: current hostname was changed outside NetworkManager: 'archlinux'
Nov 04 14:26:36 archlinux NetworkManager[304]: <info>  [1604521596.4821] policy: set-hostname: set hostname to 'rpi' (from DHCPv4)
Nov 04 14:26:36 archlinux NetworkManager[304]: <warn>  [1604521596.4821] policy: set-hostname: couldn't set the system hostname to 'rpi': (1) Operation not permitted
Nov 04 14:26:36 archlinux NetworkManager[304]: <warn>  [1604521596.4822] policy: set-hostname: you should use hostnamed when systemd hardening is in effect!
Nov 04 14:26:59 archlinux NetworkManager[304]: <info>  [1604521619.1293] agent-manager: agent[524c7fb20f762782,:1.38/org.freedesktop.nm-applet/0]: agent registered

$ hostnamectl
Static hostname: n/a
Transient hostname: archlinux
     Icon name: computer
    Machine ID: 01a83b30426646bc8fd3d018ee8f81ed
       Boot ID: 9c5ceb1c5a1b422d9d098b0243fc4861
Operating System: Manjaro ARM
        Kernel: Linux 5.9.1-1-MANJARO-ARM
  Architecture: arm64

So on reboot, systemd security kicks in… I did not even know this existed.

$ systemd-analyze security
NetworkManager.service                    7.8 EXPOSED   🙁 
   --- cut ---

But as you can see from log of the reboot… something changes the name to archlinux outside of NetworkManager.

I have even tried masking systemd.hostnamed thinking it was dynamically changing it, but that does not resolve the issue. Usually the fight is to stop a system from accepting the DHCP assigned name… as it is usually the default. So I am fairly stumped at the moment.

(I am finished making edits of this post and await any assistance.)