I tried upgrading raspbian from Stretch to Buster using this tutorial:


At the end of step 6 (maybe at 99% of the upgrade), I had a lot of errors. Now, a couple of commands give me lots of warnings related to regular expressions. For example, when I dot sudo apt update, I get

W: Invalid regular expression '^linux-image-[a-z0-9]*$' in configuration option 'APT::NeverAutoRemove' will be ignored.
W: Invalid regular expression '^linux-image-[a-z0-9]*-[a-z0-9]*$' in configuration option 'APT::NeverAutoRemove' will be ignored.

I also get 2 dozens of theses kind of messages when opening nano and other commands :

Erreur dans /usr/share/nano/gentoo.nanorc à la ligne 18 : Mauvaise expr. rationnelle « \$[-0-9@*#?$!] » : Fin d'intervalle invalide
Erreur dans /usr/share/nano/gentoo.nanorc à la ligne 19 : Mauvaise expr. rationnelle « \$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:digit:]]|@)+\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\}) » : Fin d'intervalle invalide

For those not speaking french, it says something about "bad regular expressions".

I also had a lot of errors about dpkg. When doing sudo dpkg --configure -a, 4 packages seemed to cause problem :


I did a sudo apt remove --purge of these four packages. It solved the errors about dpkg, but I still have the errors about regular expressions.

  • 2
    If you choose to ignore the Foundation advice and try an unsupported upgrade you have to debug the inevitable issues. Most of us did a fresh install (which is faster in the long run).
    – Milliways
    Dec 3, 2019 at 5:37
  • In your case the last point of the discussion about the merits of tutorials fully applies. You shouldn't have run sudo rpi-update: this installs test versions of kernel and firmware. If anything, that makes the upgrade harder to complete. Dec 3, 2019 at 12:40
  • So you think the problem is due to the rpi-update command ? Is there a way to downgrade to the last supported firmware version ?
    – jaja360
    Dec 3, 2019 at 15:54
  • Please prepend the commands with LANG=C before posting them. E.g. LANG=C ls no-file should give you ls: cannot access 'no-file': No such file or directory.
    – Ingo
    Dec 4, 2019 at 14:18
  • It works ! When I add LANG=C before my commands, there's no more regex errors. What does it means ? How to make this fix permanent ?
    – jaja360
    Dec 4, 2019 at 18:11


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.