If I understand the code correctly, 30-hostname only changes the hostname if it was the default like `(none)` or if it was set by dhcpcd previously (that's why need_hostname checks for the old hostname).
In case /etc/hostname is included in the initrd (which is probably the case for your initrd), the hostname will not be changed by 30-hostname.
If I understand the code correctly, 30-hostname only changes the hostname if it was the default like `(none)` or if it was set by dhcpcd previously (that's why need_hostname checks for the old hostname).
In case /etc/hostname is included in the initrd (which is probably the case for your initrd), the hostname will not be changed by 30-hostname.
Can you change
```
need_hostname || return
```
to
```
need_hostname || return 0
```
This should exit 30-hostname in this case.