Skip to main content

/etc/profile error when logging in

Comments

10 comments

  • kodeslogic
    It seems something has gone wrong with your /etc/profile file you can hire a certified SafeAdmin from
    0
  • coursevector
    I see you are first on the list of the service list, which I'm sure is the reason you suggested it. I'll await a response from cPanel, thanks!
    0
  • andrew.n
    It's random, sometimes I'm the first one :D so for the issue have you tried to copy the default /etc/profile from one of your other servers with the same OS version?
    0
  • cPRex Jurassic Moderator
    I'm not finding a good way to restore that file on the system. That file is controlled by the "setup" package on the machine, which we can see here on a test server running CentOS 7: # rpm -qf /etc/profile setup-2.8.71-11.el7.noarch
    Reinstalling that package does replace the file, but doesn't include the cPanel code we add to it. I ran "yum reinstall setup-2.8.71-11.el7.noarch" and got this output when comparing the new and the original: Pulling this from another cPanel server may be the best way to resolve that.
    0
  • coursevector
    Understood, and looks like something I can do. I downloaded the profile files from the 3 servers having issues. Two of them seems to just have a LOT of blank lines inserted in it. By a lot, i mean, one had 1.5m blank lines in it. But when I removed all the blank lines and compared it to the normal file, they were exactly the same. So for those two I'll just replace it out-right sans the extra blank lines. The third had a lot of blank lines AND had a few lines missing and probably where the error was coming from. [CODE=bash]pathmunge () { case ":${PATH}:" in *:"$1":*) ;; # ---------- START MISSING *) if [ "$2" = "after" ] ; then PATH=$PATH:$1 else PATH=$1:$PATH fi esac } if [ -x /usr/bin/id ]; then if [ -z "$EUID" ]; then # ksh workaround EUID=`/usr/bin/id -u` # ---------- END MISSING UID=`/usr/bin/id -ru` fi USER="`/usr/bin/id -un`" LOGNAME=$USER MAIL="/var/spool/mail/$USER" fi
    It was also missing "#cPanel Added Limit Protections" which is at the end of the file on the clean version. Where does that come from?
    0
  • cPRex Jurassic Moderator
    The extra cPanel lines get created when cPanel is installed on the machine, as this package and file both exist as part of the operating system before cPanel is installed.
    0
  • coursevector
    Thanks @cPRex, i replaced the remaining file with a clean version and that resolved the issue. Although when I went to check I found something curious which I suspect may have been the cause of the issue. Please see below: [CODE=bash][root@host etc]# ls -lah | grep profile -rw-r--r--. 1 root root 3.2K Nov 3 10:21 profile drwxr-xr-x. 2 root root 4.0K Apr 28 2020 profile.d -rw-r--r--. 2 root root 36 Jul 3 11:39 profile.lock -rw-r--r--. 2 root root 36 Jul 3 11:39 profile.lock-141197dbba22-e6ba5fff-148e -rw-r--r--. 1 root root 35 Jan 10 2020 profile.lock-e9adaf7a4e9b-1dcdd770f-8ff -rw-r--r--. 1 root root 5.9M Nov 3 10:22 profile.original
    It looks like during some sort of update, the file was locked and prevented it from being updated properly. Would you agree? Do you think it's ok to delete those .lock files?
    0
  • cPRex Jurassic Moderator
    That's my understanding as well - whenever something is open/being read/edited you'll get those .lock files. Since you just adjusted the file manually now those are safe to remove.
    0
  • coursevector
    Excellent, thanks for the confirmation. I think it's all good now!
    0
  • cPRex Jurassic Moderator
    I'm glad it all worked out!
    0

Please sign in to leave a comment.