Page 1 of 1

urpmi not working in gnome terminal (Mandriva)

Posted: 06 May 2010, 11:25
by viking60
I have been playing arround a bit with the .bashrc file in Mandriva and Arch. After todays uodate in cooker the gui was gone (bug that could be fixed by an update).
But bash cannot find the urpmi command in the Gnome-terminal (yes the other commands are working) - so I have to do a CTRL+ALT+ F1 to enter urpmi commands.

This is clearly guru stuff - so I thought I'll give it a go here? My .bashrc looks like this.

Code: Select all

# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

Which is the standard I belive?

So far I have tried to boot into an older kernel, same sh....

Re: urpmi not working in gnome terminal

Posted: 06 May 2010, 14:15
by dedanna1029
I have the same.

Code: Select all

$ cat .bashrc
# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
   . /etc/bashrc
fi

*shrug*

What happens if you

Code: Select all

rpm -qa | grep urpmi

?

Re: urpmi not working in gnome terminal

Posted: 06 May 2010, 16:12
by viking60
It is all there:

thomas@thomas-pc ~]$ rpm -qa | grep urpmi
urpmi-6.35-1mdv2010.1
urpmi-parallel-ssh-6.35-1mdv2010.1
gurpmi-6.35-1mdv2010.1

It all works in a non gui sesion (CTRL+ALT+F1) The command is not recognized in the gnome terminal.
Hmm.. since we have the same .bashrc I am beginning to think cooker bug...

And in fact it was the modifications of .bashrc that was the reason, It seems like cooker now needs a path in the /root/.bashrc

Code: Select all

PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin
ENV=$HOME/.bashrc
USERNAME="root"
export USERNAME ENV PATH

This comes before the standard code that you have.
(Mine is still heavily modified - because Über-Berserks always must have the coolest command line prompts) +1

Re: urpmi not working in gnome terminal

Posted: 06 May 2010, 19:29
by dedanna1029
LOL. I used to do the same, but after a while got to where I didn't care any more.

I suspected a cooker bug from the get-go; have been eyeing the issues people are having after the latest update, and they are plenty. :\ Go file one. The most they can do is say no (and more times than not, they do).

Re: urpmi not working in gnome terminal

Posted: 06 May 2010, 21:45
by viking60
dedanna1029 wrote:LOL. I used to do the same, but after a while got to where I didn't care any more.

You are just jealous that I have a smiley in my command line prompt :!: ;) And if I write a wrong code it turns red and sour - it's neat

In root the CL changes color every time I hit enter. This is useful when you query a lot of stuff and wonder where the list starts.

Re: urpmi not working in gnome terminal SOLVED

Posted: 07 May 2010, 00:26
by dedanna1029
Eh, jealous, no. Don't have time to futz with the computer for stuff much any more. :\

So, you've marked this solved. What solved it?

Re: urpmi not working in gnome terminal SOLVED  Topic is solved

Posted: 07 May 2010, 09:36
by viking60
Obviously I did not wrap it up correctly :oops: ; this is what toke care of it:

I have the traditional .bashrc file in my home directory: /home/viking/.bashrc
I modified it and thereby I also needed (and created) a different .bashrc file for the root user in: /root/.bashrc

Now the traditional content of .bashrc that you and I checked out was:

Code: Select all

# .bashrc

# User specific aliases and functions

# Source global definitions
if [ -f /etc/bashrc ]; then
   . /etc/bashrc
fi


It works perfectly fine with one exception; in Cooker the urpmi command is lost - it is simply not found by bash in the terminal.
This only affects the root user (well urpmi does not work as a normal user anyway). So I got a friend i the Mandriva community to post the content of his .bashrc and discovered that cooker (2010.1) has an altered standard for the file.
http://forum.mandriva.com/viewtopic.php?t=127892
I need to put the path above into the file for the root user.

So the perfect working system no has two .bashrc files; one in my home directory that looks like this:

Code: Select all

   # .bashrc

# User specific aliases and functions

# Source global definitions
#if [ -f /etc/bashrc ]; then
#   . /etc/bashrc
#fi
# Check for an interactive session
#[ -z "$PS1" ] && return

#alias ls='ls --color=auto'
#PS1='[\u@\h \W]\$ '
bash_prompt_cmd() {
RTN=$?



smiley() {
    if [ $1 == 0 ] ; then
echo ":)"
    else
echo ":("
       fi
    }
smileyc() {
    if [ $1 == 0 ] ; then
echo $GREEN
else
echo $RED
       fi
    }
 if [ $(tput colors) -gt 0 ] ; then
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
RST=$(tput op)
fi
smiley=$(smiley $RTN)
smileyc=$(smileyc $RTN)
        local CY="\[\e[1;31m\]" # Each is 12 chars long
        local BL="\[\e[1;34m\]"
        local WH="\[\e[1;37m\]"
        local BR="\[\e[0;33m\]"
        local RE="\[\e[1;31m\]"
        local PROMPT="${CY}$"
        [ $UID -eq "0" ] && PROMPT="${RE}#"

        # Add the first part of the prompt: username,host, and time
        local PROMPT_PWD=""
        local PS1_T1="$BL.:[ $CY`whoami`@`hostname` $BL: $CY\t $BL:$CY "
        local ps_len=$(( ${#PS1_T1} - 12 * 6 + 6 + 4 )) #Len adjust for colors, time and var
        local PS1_T2=" $BL]:.\n\[\$smileyc\]\$smiley\[$RST\] "
        local startpos=""

        PROMPT_PWD="${PWD/#$HOME/~}"
        local overflow_prefix="..."
        local pwdlen=${#PROMPT_PWD}
        local maxpwdlen=$(( COLUMNS - ps_len ))
        # Sometimes COLUMNS isn't initiliased, if it isn't, fall back on 80
        [ $maxpwdlen -lt 0 ] && maxpwdlen=$(( 80 - ps_len ))

        if [ $pwdlen -gt $maxpwdlen ] ; then
                startpos=$(( $pwdlen - maxpwdlen + ${#overflow_prefix} ))
                PROMPT_PWD="${overflow_prefix}${PROMPT_PWD:$startpos:$maxpwdlen}"
        fi     
        export PS1="${PS1_T1}${PROMPT_PWD}${PS1_T2}"
}
PROMPT_COMMAND=bash_prompt_cmd

This is not the important code and could have been the code you have really.

And one in the root directory /root/.bashrc:

Code: Select all

PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin
ENV=$HOME/.bashrc
USERNAME="root"
export USERNAME ENV PATH
colors=("\[\e[0;30m\]" "\[\e[0;31m\]" "\[\e[0;32m\]" "\[\e[0;33m\]" "\[\e[0;34m\]"
"\[\e[0;35m\]" "\[\e[0;36m\]" "\[\e[0;37m\]" "\[\e[1;30m\]" "\[\e[1;31m\]"
"\[\e[1;32m\]" "\[\e[1;33m\]" "\[\e[1;34m\]" "\[\e[1;35m\]" "\[\e[1;36m\]" "\[\e[1;37m\]")

PROMPT_COMMAND='let R=$RANDOM%16+0;color=${colors[$R]};PS1="${color}\u@\h:\w\$\[\e[0m\] "'

The four first lines of this code make urpmi work again - the rest makes the command line prompt change color every time I hit enter. This is useful when you query a lot of stuff and wonder where the list starts.

I hope this makes sense :?: