Score:-2

grub-pc error on VPS: cannot rename file in /etc/default

cn flag

I have an ubuntu 20.04.6 LTS installation. Every time I do any sudo apt-get upgrade (and other install, configure, update and upgrade actions), I have an error with grub-pc. This also happens with e.g. dpkg --configure -a.

I have been ignoring this error, but now it prevents me from upgrading to Ubuntu 22 LTS.

The error is always triggered by an unsuccessful command in the post install script for grub-pc. The grub-pc process seems to triggered by the installation / configuration attempt for grub-efi-amd64-signed. Here is the underlying error:

sed: cannot rename /etc/default/sedzFNXvt: Operation not permitted

where the file name is apparently a random temp file name created by the script. This is followed by

dpkg: error processing package grub-pc (--configure):
   installed grub-pc package post-installation script subprocess returned error exit status 4

and then

dpkg: dependency problems prevent configuration of grub-efi-amd64-signed:
  grub-efi-amd64-signed depends on grub-efi-amd64 | grub-pc; however:
    Package grub-efi-amd64 is not installed.
    Package grub-pc is not configured yet.

I have tried all kinds of things, including forced reinstall, manually removing packages etc. It always results in this same script error.

Any ideas?

EDIT

The concrete problem is that I cannot upgrade to Ubuntu 22.04.2. After do-release-upgrade I get

Checking for a new Ubuntu release
Please install all available updates for your release before upgrading.

But sudo apt-get upgrade leads to the above error.

Mundi avatar
cn flag
If you downvote a question, you should state what you take issue with. I am happy to provide more or different information.
Will avatar
id flag
Personally, I agree with your view on commenting if you downvote, though the downvoter probably won’t see your message! As to your question - it’s so quick to do a fresh install, that’s probably what I’d do pragmatically - unless you’ve done a lot of customisation, it’ll probably be much faster (and some people think it’s better anyway) just to perform a fresh 22.04LTS install.
Score:0
cn flag

Resolved by editing /var/lib/dpkg/info/grub-pc.postinst.

However, the error came back with the next update. It seems grub-pc is just broken. In another thread, people simply delete the postinst file

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.