Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: /etc/profile

  1. #1

    Default /etc/profile

    Dear all,

    I upgraded LEAP from 42.2 to 42.3.
    After that when i try to enter as root I've this output:

    Code:
    -bash: /etc/profile: line 165: syntax error near unexpected token `/usr/bin/X11'
    -bash: /etc/profile: line 165: `/usr/bin/X11 '
    these are lines from 164 to 166 of the /etc/profile file:

    Code:
    for dir in /usr/X11/bin
    /usr/bin/X11
    /usr/X11R6/bin
    .......
    I updated the system, "zypper dup" and "up".
    I tried to install the NVIdia drivers but the problem persists....my repositories set on Yes are:
    - nvidia
    - packman.inode.at-suse
    - repo-non-oss
    - repo-oss
    - repo-update
    - repo-update-non-oss

    Any advice?

    Many thanks in advance!!!

  2. #2
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,131

    Default Re: /etc/profile

    I do not know what happened, but I have a vague recollection of having seen this before. Those lines should have terminated with a trailing “\” to denote continuation.
    This is what that section (lines 148-179) looks like on one of my Leap-42.3 systems:
    Code:
    #
    # Make path more comfortable
    #
    if test -z "$PROFILEREAD" ; then
        PATH=/usr/local/bin:/usr/bin:/bin
        if test "$HOME" != "/" ; then
            for dir in $HOME/bin/$CPU $HOME/bin ; do
                test -d $dir && PATH=$dir:$PATH
            done
        fi
        if test "$UID" = 0 ; then
            test -d /opt/kde3/sbin  && PATH=/opt/kde3/sbin:$PATH
            PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
        fi
        for dir in  /usr/X11/bin \
                    /usr/bin/X11 \
                    /usr/X11R6/bin \
                    /var/lib/dosemu \
                    /usr/games \
                    /opt/bin \
                    /opt/kde3/bin \
                    /opt/kde2/bin \
                    /opt/kde/bin \
                    /usr/openwin/bin \
                    /opt/cross/bin
        do
            test -d $dir && PATH=$PATH:$dir
        done
        unset dir
        export PATH
    fi
    ~Thank you for sharing an interesting problem.
    --
    slàinte mhath,
    rayH

  3. #3

    Default Re: /etc/profile

    GREAT!!!!!

    It works!

    Many thanks eng-it!

  4. #4
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    2,514

    Default Re: /etc/profile

    Or, even better, forcibly re-install the package which provides "/etc/profile":
    Code:
     > rpm --query --whatprovides /etc/profile
    aaa_base-13.2+git20140911.61c1681-27.2.x86_64
     >
    Code:
     # zypper install --force aaa_base
     .
     .

  5. #5
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,481
    Blog Entries
    3

    Default Re: /etc/profile

    Quote Originally Posted by dcurtisfra View Post
    Or, even better, forcibly re-install the package which provides "/etc/profile":
    I'm not sure that does what you expect. It may leave a "profile.rpmnew" there, but not change the existing "profile".

    So maybe first check if there is already "/etc/profile.rpmnew"
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  6. #6
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,131

    Default Re: /etc/profile

    Quote Originally Posted by dcurtisfra View Post
    Or, even better, fo rcibly re-install the package which provides "/etc/profile":-- aaa_base-13.2+git20140911.61c1681-27.2.x86_64
    Unfortunately although aaa_base may provide /etc/profile it does not seem to actually write it.

    (@nrickert -- I did check for the presence of a .rpmnew or .rpmsav before copying from profile.)

    This is what I just did:
    Code:
    ns3:/etc # lh -d prof*
    -rw-r--r--   1 root root    9.0K Jul  7  2017 profile
    drwxr-xr-x   2 root root    1.2K Mar 31 15:09 profile.d
    
    ns3:/etc # cp -a profile profile.good
    ns3:/etc # echo "## ray" >>  profile
    ns3:/etc # grep "^##" profile
    ## ray
    ns3:/etc # 
    
    ns3:/etc # zypper install --force aaa_base
    Loading repository data...
    Reading installed packages...
    Forcing installation of 'aaa_base-13.2+git20140911.61c1681-27.2.x86_64' from repository '42.3-Repo-oss'.
    Resolving package dependencies...
    
    The following package is going to be reinstalled:
      aaa_base
    
    1 package to reinstall.
    Overall download size: 132.5 KiB. Already cached: 0 B. No additional space will be
    used or freed after the operation.
    Continue? [y/n/...? shows all options] (y): 
    Retrieving package aaa_base-13.2+git20140911.61c1681-27.2.x86_64
                                                   (1/1), 132.5 KiB (262.2 KiB unpacked)
    Retrieving: aaa_base-13.2+git20140911.61c1681-27.2.x86_64.rpm ..[done (164.8 KiB/s)]
    Checking for file conflicts: .................................................[done]
    (1/1) Installing: aaa_base-13.2+git20140911.61c1681-27.2.x86_64 ..............[done]
    Additional rpm output:
    Updating /etc/sysconfig/language...                                                 
    Updating /etc/sysconfig/backup...                                                   
    Updating /etc/sysconfig/proxy...                                                    
    Updating /etc/sysconfig/windowmanager...                                            
    Updating /etc/sysconfig/news...                                                     
    Updating etc/passwd...unchanged                                                     
    Updating etc/group...unchanged                                                      
    Updating etc/shadow...unchanged                                                     
    
    
    ns3:/etc # lh -d prof*
    -rw-r--r-- 1 root root 9.0K Apr  3 18:26 profile
    drwxr-xr-x 2 root root 1.2K Apr  3 18:32 profile.d
    -rw-r--r-- 1 root root 9.0K Jul  7  2017 profile.good
    
    ns3:/etc # grep "^##" profile
    ## ray
     
    ns3:/etc # lh -d prof*
    -rw-r--r-- 1 root root 9.0K Apr  3 18:26 profile
    drwxr-xr-x 2 root root 1.2K Apr  3 18:32 profile.d
    -rw-r--r-- 1 root root 9.0K Jul  7  2017 profile.good
    ns3:/etc #
    Could someone please either confirm this or tell me where I have gone wrong.
    ~Thank you for sharing an interesting problem.
    --
    slàinte mhath,
    rayH

  7. #7
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    2,514

    Default Re: /etc/profile

    Quote Originally Posted by eng-int View Post
    Could someone please either confirm this or tell me where I have gone wrong.
    You didn't provoke any wrongdoings …
    • It seems that, the RPM rules in the 'aaa_base' package ensure that, any administrator changes to "/etc/profile" are preserved -- without a "/etc/profile.rpmnew" being written.
    • A "diff -cw profile profile.good" would have been helpful.

    The workaround for such cases is, to download the .rpm package file and extract the miscreant file with something such as KDE "Ark".
    Then, the decision can be made to either edit the differences into the existing system file or, to simply replace it.

    As a thought, a system upgrade possibly drops a '.rpmnew' copy into '/etc/' …

  8. #8
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    2,514

    Default Re: /etc/profile

    Quote Originally Posted by nrickert View Post
    I'm not sure that does what you expect. It may leave a "profile.rpmnew" there, but not change the existing "profile".
    Given eng-int's investigation it seems that, the RPM rules in the 'aaa_base' package do not provide a '.rpmnew' copy, which, IMHO, defeats the possibility to simply recover from any changes inadvertently made to "/etc/profile".

    It also seems to be a contradiction to the SUSE comment in "/etc/profile":
    Code:
    # PLEASE DO NOT CHANGE /etc/profile. There are chances that your changes
    # will be lost during system upgrades. Instead use /etc/profile.local for
    # your local settings, favourite global aliases, VISUAL and EDITOR
    # variables, etc ...
    Code:
    if test "$is" != "ash" ; then
        #
        # And now let's see if there is a local profile
        # (for options defined by your sysadmin, not SuSE Linux)
        #
        test -s /etc/profile.local && . /etc/profile.local
    fi

  9. #9
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,114
    Blog Entries
    2

    Default Re: /etc/profile

    I can verify.
    So, after the testing I'll describe my solution (skip to end of this post)

    On one of my machines, it somehow had escaped my attention and was still 42.1.
    So, taking advantage of the situation, I inspected /etc/profile and found that the trailing back-slashes were there (not missing),
    Then to test the perserverance of edits to this file I added a comment to the end of this file and then
    Upgraded the machine (from 42.1 to 42.3).
    The test comment inserted into /etc/profile survived the upgrade.

    I then tested for replacing /etc/profile with a forced re-install.
    First, to determine and verify the package which contains the file I ran
    Code:
    zypper se -x --provides /etc/profile
    Verifying the package is aaa_base, I then ran
    Code:
    zypper in -f aaa_base
    Inspecting the file /etc/profile again, I still found the inserted test comment.

    So, apparently someone has gone out of its way to make sure that the /etc/profile is not over-written.
    This may be useful in some cases (I remember a Forum thread which discussed where the official documentation for some app instructed direct edits to /etc/profile) but as we can see in this thread that the behavior is unexpected.

    My solution:

    Code:
    # rm /etc/profile
    # zypper in -f aaa_base
    Verified this installs a default /etc/profile.

    HTH,
    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  10. #10
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,481
    Blog Entries
    3

    Default Re: /etc/profile

    Quote Originally Posted by dcurtisfra View Post
    Given eng-int's investigation it seems that, the RPM rules in the 'aaa_base' package do not provide a '.rpmnew' copy, which, IMHO, defeats the possibility to simply recover from any changes inadvertently made to "/etc/profile".
    I'm an old fashioned traditionalist with respect to "/etc/profile".

    In my opinion, the distro should not provide "/etc/profile". That file properly belongs to the local system administrator, not to the vendor.

    The distro should provide "/etc/profile.example", but not "/etc/profile".

    At the end of a clean install, if there is no "/etc/profile", then it should copy "/etc/profile.example" to "/etc/profile". But that would be done as a final install step, not as part of a package install.

    If done that way, a forced update of "aaa_base" would replace "/etc/profile.example" with the correct version. It would be up to the local system administrator to then copy that to "/etc/profile" if desired.

    Most linux distros seem to get this wrong (in my opinion).
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •