coolstorm
(Bruce Xu)
June 11, 2024, 10:55pm
1
Hello everyone, I met a strange issue with f40. When I plug in my ethernet cable, the hostname on my machine changed. I just want my hostname stay as ‘fedora’, so I follow this official instruction (Changing Hostname :: Fedora Docs ) to change my static hostname, However, I get this error.
Anybody has the same issue?
vgaetera
(Vladislav Grigoryev)
June 11, 2024, 11:18pm
2
Check the output:
ls -l -d -Z /etc /etc/hostname
awk -e '$2=="/"||$2=="/etc"' /etc/mtab
1 Like
coolstorm
(Bruce Xu)
June 11, 2024, 11:29pm
3
Thanks, I get this in return
[nathan36@MiWiFi-RC01-srv ~]$ ls -l -d -Z /etc /etc/hostname
drwxr-xr-x. 1 root root system_u:object_r:etc_t:s0 4940 Jun 11 23:55 /etc
-rw-r--r--. 1 root root unconfined_u:object_r:etc_t:s0 0 Jun 11 23:27 /etc/hostname
[nathan36@MiWiFi-RC01-srv ~]$ awk -e '$2=="/"||$2=="/etc"' /etc/mtab
/dev/nvme0n1p3 / btrfs rw,seclabel,relatime,compress=zstd:1,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/root 0 0
vwbusguy
(Scott Williams)
June 11, 2024, 11:36pm
4
Ah, that might be it then. Here’s the context it should have:
-rw-r--r--. 1 root root system_u:object_r:hostname_etc_t:s0 6 Mar 29 2021 /etc/hostname
Try sudo restorecon -v /etc/hostname
and then try your original hostnamectl command again.
2 Likes
coolstorm
(Bruce Xu)
June 11, 2024, 11:42pm
5
Thank you so much, you are life saver. This do solve my issue!
Cheers!
2 Likes