update-grub: cannot restore the original directory

Bug #673438 reported by artphrases
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: grub2

Release is Ubuntu 10.04.1 All Updates from 10. Nov. 2010

apt-cache policy grub2

grub2:
Installed: (none)
Candidate: 1.98-1ubuntu7

I don`t understand why the display is saying, that grub is not installed?!

What happened:
I set the GRUB_TIMEOUT=0 in /etc/default/grub and ran the command update-grub sucessfully.
After a restart I altered the same value to 1 and tried a again to run update-grub with the failure message:
/usr/sbin/grub-probe: error: cannot restore the original directory

Regards
Martin

Revision history for this message
Colin Watson (cjwatson) wrote :

That sounds like you were running update-grub from a directory that had been removed. Try making sure that the directory exists first (e.g. run 'cd $PWD', which will fail in much the same kind of way if that isn't the case).

The package you probably have installed is 'grub-pc'. grub2 is a metapackage, and you don't have to have it installed.

Revision history for this message
Yözen Hernández (yhernand) wrote :

Not sure if this is your problem Martin, but this could happen if you are updating grub-pc, or running update-grub, as a user with a Kerberized NFS home directory. If you are anywhere in the home directory, and use sudo to run those commands, then you will get errors like the above (if local root is not given root privileges on the NFS mount).

I just encountered this bug myself and it prevented grub-pc from updating. This shouldn't be a show-stopper: grub-pc should report that grub was installed correctly and just print a warning that it couldn't cd back to the original directory, as other packages seem to do.

For example, openoffice.org-emailmerge didn't fail, but just said this:

Setting up openoffice.org-emailmerge (1:3.2.0-7ubuntu4.2) ...
cd: 84: can't cd to /home/yozen

and continued.

Revision history for this message
Chris Crisafulli (itnet7) wrote :

@Yozen, thanks for adding that comment that was exactly what was happening to me, as I was receiving the same described failure message. I was attempting to run sudo update-grub from my nfs mounted home at work. I cd'd into /tmp and re-ran the command and it completed without any issues.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in grub2 (Ubuntu):
status: New → Confirmed
Revision history for this message
Gerard Weatherby (gweatherby) wrote :

A nicer error message would be nice. Or use /tmp for tempfiles instead of current working directory.

Revision history for this message
Ilya w495 Nikitin (w-495) wrote :

I can reproduce it with `grub-efi 2.04-1ubuntu26.7`

$ apt-cache policy grub-efi
grub-efi:
  Installed: 2.04-1ubuntu26.7
  Candidate: 2.04-1ubuntu26.7
  Version table:
 *** 2.04-1ubuntu26.7 500
        500 http://mirror.yandex.ru/ubuntu focal-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     2.04-1ubuntu26.2 500
        500 http://mirror.yandex.ru/ubuntu focal-security/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
     2.04-1ubuntu26 500
        500 http://mirror.yandex.ru/ubuntu focal/main amd64 Packages

$ lsb_release -a
LSB Version: core-11.1.0ubuntu2-noarch:printing-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal

Revision history for this message
Ilya w495 Nikitin (w-495) wrote :

cd /tmp also helps

Changed in grub2 (Ubuntu):
status: Confirmed → Opinion
status: Opinion → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.