[Bug 612409] Re: grub-install bricks systems if ran in a chroot jail
Marcus Tomlinson
marcus.tomlinson at canonical.com
Thu Mar 5 12:41:50 UTC 2020
This release of Ubuntu is no longer receiving maintenance updates. If
this is still an issue on a maintained version of Ubuntu please let us
know.
** Changed in: grub2 (Ubuntu)
Status: New => Incomplete
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub2 in Ubuntu.
https://bugs.launchpad.net/bugs/612409
Title:
grub-install bricks systems if ran in a chroot jail
Status in grub2 package in Ubuntu:
Incomplete
Bug description:
Binary package hint: grub2
(yes, package not installed, I removed it after it bricked my system)
Due to incessent boot and driver issues I converted my ubuntu system
to run in a chroot jail.
the next apt-get dist-upgrade bricked my system by installing grub on
the host drive.
Normally you would think, ok it boots the guest kernel and this can be
fixed from within.
However, in this case, / wasn't the root of any partition so it could
not boot.
Since grub-install was root, it could have checked for this
straightforwardly:
int check_for_root()
{
int fd1, fd2;
struct stat st1, st2;
fd1 = open(".", O_RDONLY, 0);
chdir("/");
if (chroot("/etc")) return 3;
stat(".", &st1);
stat("..", &st2);
if (st1.st_dev == st2.st_dev) {
if (st1.st_ino == st2.st_ino)
return 2; /* REAL ROOT */
return 0; /* CHROOT */
}
return 1; /* CHROOT ON MOUNTPOINT (probably safe to run bootloader) */
}
ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: grub-pc (not installed)
Uname: Linux 2.6.32-5-amd64 x86_64
NonfreeKernelModules: minix vboxnetadp vboxnetflt vboxdrv snd_hda_codec_nvhdmi snd_hda_codec_via snd_hda_intel snd_hda_codec snd_hwdep snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_midi snd_rawmidi snd_seq_midi_event i2c_nforce2 shpchp video snd_seq snd_timer snd_seq_device snd soundcore snd_page_alloc tpm_tis edac_core k8temp i2c_core pci_hotplug output parport_pc tpm edac_mce_amd tpm_bios pcspkr parport evdev asus_atk0110 button wmi psmouse serio_raw processor ext3 jbd mbcache usbhid hid sg sr_mod cdrom sd_mod crc_t10dif ata_generic ohci_hcd pata_amd ahci ehci_hcd floppy forcedeth libata scsi_mod usbcore nls_base thermal thermal_sys
Architecture: amd64
Date: Sun Aug 1 19:40:53 2010
ProcEnviron:
LANGUAGE=
PATH=(custom, user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: grub2
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/612409/+subscriptions
More information about the foundations-bugs
mailing list