Randomizing network Hostname/DHCP only gives name of the template based OS?

I followed the guide on how to randomize your mac address and hostname.

Each time i finish following the guide it works by changing “sys-net” to either “debian”/“fedora”, which is good but according to the guide it should be PC-(random number).

I have tried it on both full and minimal template based still the same result.
Note: randomizing of mac address works flawlessly.

Just want to know if there’s something else i need to change?

Works for me. So I guess you missed some step of the instructions.

the name switches to PC-(random number) after you are connected to a network…

Thank you but no, i don’t think i missed a step (not that I’m aware of).
I even lost count of how many times i have tried it…

I wonder why mine doesn’t change from ‘debia’/‘fedora’.

What could go wrong in a “simple” copy-and-paste guide?

Well, for some reason mine doesn’t, even after several reboots.

Well you can test what part fails by executing the following inside your network VM:

[ -f “/rw/config/protected-files.d/protect_hostname.txt” ] || echo “Step 3”
[ -f “/etc/hosts/lock” ] || echo “Step 2”

The guide also assumes a non-disposable network VM. You can also use a disposable one, but then you’d have to execute step 3 inside the disposable VM template and steps 1 & 2 inside the debian/fedora template.

To correct my own typo, it is:

[ -f “/rw/config/protected-files.d/protect_hostname.txt” ] || echo “Step 3”
[ -f “/etc/hosts.lock” ] || echo “Step 2”

I tested both commands (“Step 3” & “Step 2”) in my netvm which is a minimal template and it returns no error/no message.

netvm means sys-net generally, i.e. not inside its template.

Sorry i meant to say inside sys-net vm which is based off fedora 33 minimal.

Ok sorry, then I’m somewhat at a loss.

Of course it also assumes that you run nm-applet in sys-net and it only changes the hostname right before you connect to a network.

Does hostname somename not change the hostname in your sys-net?

Or does fedora 33 minimal maybe not have hostname or sed installed?

Or maybe you didn’t make the script executable? I.e. chmod +x on the script?

Btw you can also run the bash script for randomizing the hostname manually with #!/bin/bash -x to see what it does.

Hi @tripleh

“sys-net” to either “debian”/“fedora”

I checked with “dnf list installed” and it’s there (hosname_x64-x86)

And this my friend, was the problem :grinning:.
Just after executing the command (chmod +x -v 00_hostname) and i restarted the sys-net qube and sys-net template vm…Bhoom! it changed from “debian/fedora” to whatever i will replace with "PC" inside the script.

Everything is okay now no need.

Thank you very much for having the time to help a noob like myself.
Gracias :slightly_smiling_face: