LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   slackpkg does not recognize mirrors (http://www.linuxquestions.org/questions/slackware-14/slackpkg-does-not-recognize-mirrors-591519/)

xri 10-13-2007 11:47 AM

slackpkg does not recognize mirrors
 
I used slackpkg on a prior version and it worked great. This time I did this:
  1. I installed Slack 12.0 from scratch and just slackpkg.
  2. I tested most of the mirrors uncommenting one individually each time, both using the version 11.0 mirror, and also changing it to 12.0.

I always get this message after slackpkg update

Quote:

You do not have any mirror selected in /etc/slackpkg/mirrors
Please edit that file and uncomment ONE mirror. Slackpkg
only works with ONE mirror selected.
What should I do to make it work? (It worked fine the last time I used it with Slack 10.2)

Your comments will be appreciated.

tuubaaku 10-13-2007 11:55 AM

Works great for me. Maybe post your mirrors file? Which one do you have selected? You could at least post that line.

Alien Bob 10-13-2007 03:06 PM

That slackpkg comment looks like it tells you exactly what to do. What part is not clear to you?

Eric

xri 10-13-2007 08:04 PM

Quote:

Your comments will be appreciated.
When I wrote this I meant intelligent and civil comments.
Here is my original post:
Quote:

I used slackpkg on a prior version and it worked great. This time I did this:
  1. I installed Slack 12.0 from scratch and just slackpkg.
  2. I tested most of the mirrors uncommenting one individually each time, both using the version 11.0 mirror, and also changing it to 12.0

Don't you think that, if I used slackpakg on a prior version, I know how to uncomment a line on a file?
What part of my post is not clear to you?
Thanks anyway.

rworkman 10-13-2007 11:10 PM

Slackpkg is trying to tell you that only ONE mirror can be uncommented. What part of *that* is unclear to you?

This should reveal the problem:
Code:

grep -v ^# /etc/slackpkg/mirrors

duryodhan 10-14-2007 12:16 AM

xri, you probably should just post the mirrors file, just to satisfy the cynical :D

and be sure to run the command that rworkman put up, simple and useful. You never know, you might have made a mistake .....

Quote:

When I wrote this I meant intelligent and civil comments.
aww, comeon it isn't that rude or anything. The obvious solution is usually the correct one, even if it seems really dumb.

Eric and Robby are both contributors to slackware. I can assure you that if you actually do have a genuine problem, no one would work harder than both of them to resolve it.

xri 10-14-2007 08:27 PM

Sorry if my tone above on was not my usual. Actually, I was sleep deprived and didn't pay much attention on the member's name. Now I remember seeing the 'Alien Bob' moniker many times on helpful posts. My apologies.

Regarding slackpkg,

Quote:

bash-3.1$ grep -v ^# /etc/slackpkg/mirrors


http://slackware.mirrors.tds.net/pub...lackware-12.0/

Worth noting, this is only one of many mirrors I chose successively, one mirror only each time. Initially, I tested the mirrors with the original 11.0 part, and then changed the links to 12.0 to conform to my Slack version.
I have not touched the configuration file or the blacklist.

Quote:

The obvious solution is usually the correct one, even if it seems really dumb.
This is probably true. I might be missing something really simple this time.

rworkman 10-14-2007 09:09 PM

xri:
What slackpkg version are you using?

First, let's look at /usr/sbin/slackpkg in slackpkg-2.61:
Lines 39 and 40
Code:

CONF=/etc/slackpkg
SOURCE=`grep -e "^\([a-z]\)" $CONF/mirrors`

Looking at /usr/libexec/slackpkg/core-functions.sh of slackpkg-2.61:
Lines 80-97
Code:

        # Checking if /etc/slackpkg/mirrors are in correct syntax.
        #                                                       
        if [ "$SOURCE" = "" ]; then
                echo -e "\
\nYou do not have any mirror selected in ${CONF}/mirrors\n\
Please edit that file and uncomment ONE mirror.  Slackpkg\n\
only works with ONE mirror selected.\n"
                cleanup
        else
                COUNT=`echo $SOURCE | wc -w | tr -d " "`
                if [ "$COUNT" != "1" ]; then
                        echo -e "\n\
Slackpkg only works with ONE mirror selected.  Please edit your\n\
${CONF}/mirrors and comment all but one line - two or more\n\
mirrors uncommented is not valid syntax.\n"
                        cleanup
                fi
        fi

Based on your error message, slackpkg is not detecting the uncommented mirror.
Try this (to replicate the exact command used by slackpkg):
Code:

grep -e "^\([a-z]\)" /etc/slackpkg/mirrors
What does that show?

xri 10-15-2007 03:56 PM

I can see what you mean. The variable SOURCE is empty, because

grep -e "^\([a-z]\)" /etc/slackpkg/mirrors gives me no output.

although the files and lines you showed are identical on my system (Slack 12.0 and slackpkg slackpkg-2.61).


After a 15-minute crash course on regular expressions, I replaced line 40 on /usr/sbin/slackpkg with

Quote:

SOURCE=`grep -e ^[^#] $CONF/mirrors`
Then I was able to run slackpkg update for the first time.


Thanks a lot!!


This is why I love Linux.

rworkman 10-15-2007 04:11 PM

Okay, well, I'm glad it's fixed. I've pinged PiterPunk (slackpkg author) about this. Thanks for the followup and fix. :-)

rworkman 10-15-2007 07:23 PM

xri:
For debugging purposes, your exact /etc/slackpkg/mirrors file is needed.
Can you mail it to PiterPunk: piterpunk [At] slackware.com
and CC me: rworkman [At] slackware.com

duryodhan 10-16-2007 08:47 AM

hahaha man who would have thought .. a problem in the regex ....

and robby I bow to thee .. for being smart enough to see the slackpkg scripts ... I generally assume that the scripts set by a program to be error free , would have never guessed that the slackpkg script would be at error ...

rworkman 10-16-2007 09:11 AM

Well, it's a bug somewhere, but I'm not sure where. Neither I nor PiterPunk have been able to reproduce the error, even trying various combinations of blank lines (no comment marks). That's why we need the actual unmodified mirrors file.

xri 10-20-2007 09:19 PM

Hi guys. Sorry for the delay to respond. I haven't been around my computer for a long time. Of course I'll email you my mirrors file and provide any further information about my system if needed. Thanks for your insight about this issue. I'll take my lesson home and apply a similar approach for future problems.

This is a great community.

rworkman 10-24-2007 01:30 PM

Okay, I've got the mirrors file, and I see the problem. Here's what the mirrors file has:
Code:

#ftp://slackware.mirrors.pair.com/slackware-11.0/
#USA, 1Gbit
 http://slackware.mirrors.tds.net/pub/slackware/slackware-12.0/
#ftp://slackware.mirrors.tds.net/pub/slackware/slackware-11.0/
#USA, 10Mbit

Note the blank space before the uncommented mirror.
The slackpkg code that finds uncommented mirrors is only looking at the first character of the line.


All times are GMT -5. The time now is 11:56 AM.