Command-not-found in Debian

I wrote this up years ago, but with the demise of CrunchBang those bits are rotting away. The URL is still good, but my post is mostly gone. I just installed Debian Stretch on my Mom’s old MacBook and the issue is still there, so here it is again.

If you invoke a command that doesn’t exist, most shells will simply tell you so.

$ play
play: command not found

Ubuntu has a utility called command-not-found. If you invoke a command that is not installed, but is available, it will tell you how to install it.

$ play
The program 'play' is currently not installed. You can install it by typing:
sudo apt install play

Nice!

This command is now available in other Debian systems too, including the latest stable: stretch.

sudo apt install command-not-found
sudo apt update
sudo update-command-not-found

But it doesn’t quite work right, as is.

$ play
The program 'play' is currently not installed. To run 'play'
please ask your administrator to install package 'play'

But I am the administrator! Why doesn’t it think so? It seems that Ubuntu uses different groups than Debian. In particular, command-not-found is looking for membership in group “admin”, but Debian doesn’t use that. We want it to check for membership in group “sudo” instead. We can fix that!

sudoedit /usr/share/command-not-found/CommandNotFound/CommandNotFound.py
# change "admin" to "sudo" on line 93

Most programs transition from Debian to Ubuntu. This one transitioned the other way. I guess the trip isn’t as smooth, since this was years ago and it’s still not fixed (indeed, it’s still line 93). I think this affects at least Debian wheezy, jessie, and stretch. It looks like it’s fixed on github and in Ubuntu (checks for either “admin” or “sudo”), but has not been backported to Debian yet.

Advertisements
Command-not-found in Debian

Emacs 24.4 in Debian jessie

Hey, Emacs 24.4 is in Debian jessie…I’m typing on a Debian jessie laptop right now! Let’s upgrade!

$ emacs --version
GNU Emacs 24.3.1
Copyright (C) 2013 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

$ sudo apt-get update
...

$ sudo apt-get upgrade
...

$ emacs --version
GNU Emacs 24.4.1
Copyright (C) 2014 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Sweet! Now we have to re-install the use-package package using the Emacs package manager and re-install all of the Cask packages.

$ cd ~/.emacs.d
$ cask install
...

Restart Emacs and we’re back in business!

I’ve been using the fancy rectangle mode hidden inside of CUA mode for a while now, but I don’t want the rest of CUA mode, so I have these lines in my init file.

'(cua-enable-cua-keys nil)
'(cua-mode t nil (cua-base))

Emacs 24.4 has its own fancy rectangle mode using C-x SPACE. That seems to work fine, so I removed those cua-mode lines.

Rats! Now when I try to post this blog, I just get

Wrong type argument: stringp, netrc-get

in the minibuffer. It seems that netrc.el is busted in Emacs 24.4!

Emacs 24.4 in Debian jessie