Console login prompt doesn't display the system hostname and bash prompt displays system hostname after the # or ~ sign

Solution Verified - Updated -

Issue

  • When connecting to the system console, the login prompt doesn't display the system hostname, as shown below

    Red Hat Enterprise Linux
    Kernel xxx on an yyy
    
     login: 
    
  • After logging into the system using the console or SSH, the user prompt displays the system hostname (vm-rhel7 in the example) after the pound (#) or dollar ($) sign, as shown below

    $ ssh root@vm-rhel7
    Last login: Thu Jan 31 09:09:25 2019
     ~]# @vm-rhel7
    
  • The postfix service fails to start and displays the following messages in the journal (vm-rhel7 is the system hostname in the example)

    [...] postfix[3451]: warning: valid_hostname: invalid character 13(decimal): vm-rhel7?
    [...] postfix[3451]: fatal: unable to use my own hostname
    [...] systemd[1]: postfix.service: control process exited, code=exited status=1
    [...] systemd[1]: Failed to start Postfix Mail Transport Agent.
    [...] systemd[1]: Unit postfix.service entered failed state.
    [...] systemd[1]: postfix.service failed.
    
  • The NetworkManager service displays the following message in the journal (vm-rhel7 is the system hostname in the example)

    NetworkManager[3045]: <info>  [XXX] policy: set-hostname: current hostname was changed outside NetworkManager: 'vm-rhel7'
    

Environment

  • Red Hat Enterprise Linux 7
    • NetworkManager

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content