Results 1 to 6 of 6

Thread: Suse 11.0 and Command-not-found

  1. #1
    LewsTherinTelemon is offline Busy Penguin
    Join Date
    Oct 2008
    Posts
    446

    Smile Suse 11.0 and Command-not-found

    Hi everyone,

    I am running 11.0 and don't wish to upgrade to 11.1 at this time, though I would like to implement the command-not-found feature of it. I seem to have run into a snag on implementing it however - rather surprising as it should be pretty simple, but still - I can't seem to get it to work.

    I was working from command-not-found for openSUSE | sticklog and the repos of Pavol Rusnak

    I found the one-click install from Software.openSUSE.org fails, but was able to manually get the packages I needed from ftp://ftp5.gwdg.de/pub/opensuse/repo...prusnak:/scout and others.

    I did contact Pavol Rusnak (who created the command-not-found package) and he made the suggestion that I was not running the patched bash required, but in fact I am running it. I also appear to have all the required packages, etc.

    Specifics:

    The packages I have are:

    Callandor:~ # rpm -qa | grep -e scout -ecommand-not-found -e python-satsolver
    scout-bin-suse110-2008.10.07-15.1
    python-satsolver-0.13.0-20.1
    command-not-found-0.1.0-45.1
    scout-0.1.0-45.1

    Callandor:~ # rpm -q --provides bash
    bash(CommandNotFound)
    bash = 3.2-148.1

    I have modified my /etc/bash.bashrc.local and my local bash profile for root and a user account:

    Callandor:/usr/src # cat /etc/bash.bashrc.local
    if [ -f /etc/bash_command_not_found ]; then
    . /etc/bash_command_not_found
    fi

    Despite the above, command-not-found does not work.

    I believe the issue may be that scout does not appear to be working correctly?
    <code>
    Callandor:~ # scout bin -l
    Traceback (most recent call last):
    File "/usr/bin/scout", line 10, in <module>
    ret = scout.ScoutCore.run()
    File "/usr/lib/python2.5/site-packages/scout/__init__.py", line 942, in run
    result = module.ScoutModule().main(clp.module_args)
    File "/usr/lib/python2.5/site-packages/scout/bin.py", line 61, in __init__
    self._repo_list = scout.RepoList(self._cls.name, ('zypp', ))
    File "/usr/lib/python2.5/site-packages/scout/__init__.py", line 690, in __init__
    self._repos_conf = RepoConfigReader().read()
    File "/usr/lib/python2.5/site-packages/scout/__init__.py", line 669, in read
    self.parser.read([os.path.join(Config.data_path, Config.config_file), ])
    File "/usr/lib/python2.5/ConfigParser.py", line 267, in read
    self._read(fp, filename)
    File "/usr/lib/python2.5/ConfigParser.py", line 490, in _read
    raise e
    ConfigParser.ParsingError: File contains parsing errors: /usr/share/scout/repos.conf
    [line 7]: '[jpackage50\n'
    [line 22]: '[packman111\n'
    </code>

    I am running the stock Suse Xen kernel:

    Callandor:/usr/src # uname -a
    Linux Callandor 2.6.25.18-0.2-xen #1 SMP 2008-10-21 16:30:26 +0200 i686 i686 i386 GNU/Linux


    The other odd thing is that even if I source the file manually . /etc/bash_command_not_found I does not see any python processes running - which seems odd. I would think I would see this run in the background continuously to provide the command-not-found parsing functions.

    Perhaps I am just missing the boat on this, but it just seems like this should work.

    Mr. Rusnak was kind to respond once, however I thought I would get the input of the community members here as well as I am not sure he will have the time to assist me further.

    Any suggestions are welcome! Has anyone else gotten this to work on 11.0?

    Thanks,
    Pete

  2. #2
    ken_yap is offline Flux Capacitor Penguin
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,955
    Blog Entries
    4

    Default Re: Suse 11.0 and Command-not-found

    No, it doesn't look like it needs an additional process running, it does the search on demand. The command_not_found script is quite simple:

    Code:
    command_not_found_handle() {
    
        # do not run when inside Midnight Commander
        if [ -n "$MC_SID" ]; then
            return 127
        fi
    
        # run command-not-found program
        [ -x /usr/bin/python ] && [ -x /usr/bin/command-not-found ] && /usr/bin/python /usr/bin/command-not-found "$@" zypp
    
    }
    So what you could do to debug this step by step is to run that last command interactively and see what happens:

    Code:
    /usr/bin/python /usr/bin/command-not-found mdadm zypp
    Nothing magical about mdadm, it is just a program in /sbin. Hopefully you don't have a private symlink to it.

    If that works, then you have to figure out why the command_not_found_handle function is not installed or not called.

  3. #3
    LewsTherinTelemon is offline Busy Penguin
    Join Date
    Oct 2008
    Posts
    446

    Default Re: Suse 11.0 and Command-not-found

    Hi Ken_yap,

    Thanks for the suggestion. I forgot to add that I had tried that as well, but it does not seem to work - which I find rather strange:

    Callandor:/ # /usr/bin/python /usr/bin/command-not-found mdadm zypp
    Callandor:/ #

    As the patched bash is installed, per my understanding, it should call the command-not-found handle and should do the trick. But not much happens as you can see.

    Any other suggestions?

    Cheers,
    Pete

  4. #4
    prusnak's Avatar
    prusnak is offline openSUSE Board Member
    Join Date
    Jun 2008
    Location
    Prague, Czech Republic
    Posts
    17

    Default Re: Suse 11.0 and Command-not-found

    By looking into /etc/bash_command_not_found you can see that c-n-f can be run manually by:

    /usr/bin/python /usr/bin/command-not-found mdadm suse110

    (not zypp, this was added in 11.1, 11.0 uses static database in scout-bin-suse110 package)

    I am replying to your mail right now ...
    0118 999 881 999 119 725 3

  5. #5
    prusnak's Avatar
    prusnak is offline openSUSE Board Member
    Join Date
    Jun 2008
    Location
    Prague, Czech Republic
    Posts
    17

    Default Re: Suse 11.0 and Command-not-found

    The problem was in broken repos.conf file. It was missing brackets and failed silently on parse exception. Fixed now in BuildService.
    0118 999 881 999 119 725 3

  6. #6
    LewsTherinTelemon is offline Busy Penguin
    Join Date
    Oct 2008
    Posts
    446

    Thumbs up Re: Suse 11.0 and Command-not-found

    Hi Pavol,

    You are completely right - that totally fixed it. The /usr/share/scout/repos.conf
    file now parses correctly and I have a working command-not-found. (Such a simple little bug, of course!)

    Thank you so much for taking the time to assist me with this, I really appreciate it. I didn't expect you to also be on the forum here, I just thought I would get some extra input in figuring it out.

    I am really happy this is working for Suse 11.0 - this is a great package. I made a post on my blog to help direct Suse 11.0 users to this so they can benefit from it too. Command-not-found on Suse 11.0 | Mine the Harvest

    Awesome job on supporting this package!

    Cheers,
    Pete

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.5.2