Activity log for bug #1756517

Date Who What changed Old value New value Message
2018-03-17 09:07:39 TJ bug added bug
2018-03-17 09:07:50 TJ grub2 (Ubuntu): status New Triaged
2018-03-17 09:07:54 TJ grub2 (Ubuntu): importance Undecided Low
2018-03-17 09:07:58 TJ grub2 (Ubuntu): assignee TJ (tj)
2018-03-18 17:49:30 TJ description This has and continues to affect all releases of Ubuntu including 18.04 and probably beyond. This bug is to track potential fixes to allow writes for some common scenarios - the easiest being a RAID-1 mirror where it is just a case of mapping the writes to the underlying device nodes. In summary, upstream GRUB has a 'diskfilter' module for dealing with LVM (lvm2), Device Mapper (dmsetup), Multiple Device (mdadm). The module only supports reading from these devices. When trying to install to such a device the operation fails with: $ grub-install /dev/md0 Installing for i386-pc platform. grub-install: error: diskfilter writes are not supported. There are work-arounds which involve identifying and operating on the underlying device, e.g: for a RAID-1 mirror: $ cat /proc/mdstat Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] md0 : active raid1 sdb[1] sda[0] 244198400 blocks super 1.0 [2/2] [UU] $ grub-install /dev/sda $ grub-install /dev/sdb These cam be sub-optimal in some circumstances as well as breaking some standard OS package-upgrade operations. The responsible code is ./grub-core/disk/diskfilter.c: static grub_err_t grub_diskfilter_write (grub_disk_t disk __attribute ((unused)), grub_disk_addr_t sector __attribute ((unused)), grub_size_t size __attribute ((unused)), const char *buf __attribute ((unused))) { return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "diskfilter writes are not supported"); } The read functionality gives some indication of how the write operation might be organised: grub_diskfilter_read() >read_lv() >>read_segment() >>>grub_diskfilter_read_node() >>>>grub_disk_read() It should be possible to factor out and re-use the common device and offset calculation code from these functions since all but the actual grub_disk_write() only do in-memory operations. Related bugs: Bug #701351 "grub-install fails to install on a raid1 array" (same issue) Bug #1274320 "Error: diskfilter writes are not supported" (boot-time fix) This has and continues to affect all releases of Ubuntu including 18.04 and probably beyond. This bug is to track potential fixes to allow writes for some common scenarios - the easiest being a RAID-1 mirror where it is just a case of mapping the writes to the underlying device nodes. In summary, upstream GRUB has a 'diskfilter' module for dealing with LVM (lvm2), Device Mapper (dmsetup), Multiple Device (mdadm). The module only supports reading from these devices. When trying to install to such a device the operation fails with: # grub-install /dev/md0 Installing for i386-pc platform. grub-install: error: diskfilter writes are not supported. There are work-arounds which involve identifying and operating on the underlying device, e.g: for a RAID-1 mirror: # cat /proc/mdstat Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] md0 : active raid1 sdb[1] sda[0]       244198400 blocks super 1.0 [2/2] [UU] # grub-install /dev/sda # grub-install /dev/sdb These cam be sub-optimal in some circumstances as well as breaking some standard OS package-upgrade operations. The workaround is to create a /boot/grub/device.map using grub-probe to get the correct GRUB identity: # grub-probe -t bios_hints -d /dev/md0 mduuid/68143ebfa5bcfd733bca032a9afc0f72 $ echo "($(sudo grub-probe -t bios_hints -d /dev/md0)) /dev/md0" | sudo tee -a /boot/grub/device.map Should then have added: (mduuid/68143ebfa5bcfd733bca032a9afc0f72) /dev/md0 After which, despite the warning message, this will install correctly: # grub-install /dev/md0 Installing for i386-pc platform. grub-install: warning: the drive name `mduuid/68143ebfa5bcfd733bca032a9afc0f72' in device.map is incorrect. Using hostdisk//dev/md0 instead. Please use the form [hfc]d[0-9]* (E.g. `hd0' or ` cd'). Installation finished. No error reported. If we want it to work without needing to manually intervene (which requires understanding the device.map syntax and that ignoring the warnings is OK), then the responsible code is ./grub-core/disk/diskfilter.c: static grub_err_t   grub_diskfilter_write (grub_disk_t disk __attribute ((unused)),        grub_disk_addr_t sector __attribute ((unused)),        grub_size_t size __attribute ((unused)),        const char *buf __attribute ((unused)))   {     return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,            "diskfilter writes are not supported");   } The read functionality gives some indication of how the write operation might be organised: grub_diskfilter_read() >read_lv() >>read_segment() >>>grub_diskfilter_read_node() >>>>grub_disk_read() It should be possible to factor out and re-use the common device and offset calculation code from these functions since all but the actual grub_disk_write() only do in-memory operations. Related bugs: Bug #701351 "grub-install fails to install on a raid1 array" (same issue) Bug #1274320 "Error: diskfilter writes are not supported" (boot-time fix)
2018-05-03 09:43:55 Óscar Frías bug added subscriber Óscar Frías
2018-05-03 09:43:59 Óscar Frías removed subscriber Óscar Frías
2018-10-03 13:19:15 Mathieu Trudel-Lapierre grub2 (Ubuntu): status Triaged Incomplete
2020-06-05 08:05:32 Andrew Bonney bug added subscriber Andrew Bonney
2020-07-20 21:57:21 Björn bug added subscriber Björn