I added more info about this bug here:
http://askubuntu.com/a/498281/197497
To trying to help everybody with the problem solution, I'm copy/past my
answer in the Ask Ubuntu here.
----
This bug appears when you create the boot partition (or the root
partition, when the boot partition doesn't exists) inside a LVM or a
RAID partition.
When the system is booting, Grub (using its `diskfilter` module) tries
to write some data in `/boot`. However, in this Ubuntu version,
something goes wrong and Grub cannot write the desirable data (and the
warning appears).
Let's look inside the `/boot/grub/grub.cfg` file (generated using the
`/etc/grub.d/00_header` file by the `update-grub` command):
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
[...]
According to this file, grub reads (`load_env`) the Grub environment
file (`/boot/grub/grubenv`) if it exits in every boot. Sometimes, it
saves (`save_env`) a new environment in this file too (when it's
necessary that the next boot sees a new environment).
This (save `grubenv`) can be used to save the last used grub entry
(setting `GRUB_DEFAULT=saved` in the `/etc/default/grub` file and
running `update-grub`).
This can be used by the **recordfail** feature too (see [Ubuntu Help -
Grub 2](https://help.ubuntu.com/community/Grub2), "Last Boot Failed or
Boot into Recovery ModeLast Boot Failed or Boot into Recovery Mode"
section).
In every boot, Grub updates the `recordfail` value and saves it.
Probably, at this moment, the warning appears to you (lines 104 to 124):
if [ "$quick_boot" = 1 ]; then
cat <<EOF
function recordfail {
set recordfail=1
EOF
FS="$(grub-probe --target=fs "${grubdir}")"
case "$FS" in
btrfs | cpiofs | newc | odc | romfs | squash4 | tarfs | zfs)
cat <<EOF
# GRUB lacks write support for $FS, so recordfail support is disabled.
EOF
;;
*)
cat <<EOF
if [ -n "\${have_grubenv}" ]; then if [ -z "\${boot_once}" ]; then
save_env recordfail; fi; fi
EOF
esac
cat <<EOF
}
EOF
fi
See that Grub skips the recordfail feature when using the following
filesystems: `btrfs | cpiofs | newc | odc | romfs | squash4 | tarfs |
zfs`. The LVM and RAID subsystems aren't skipped in any moment.
To work inside RAID partitions (I don't know what happens inside LVM
partitions...), Grub uses the **diskfilter** module (`insmod
diskfilter`). You can get the source code of this module running:
apt-get source grub2
vim grub2-2.02~beta2/grub-core/disk/diskfilter.c
However, even if this module was loaded, the bug will appear when grub
calls the `save_env recordfail` function.
More details about this behaviour can be found at:
https://bugzilla.redhat.com/show_bug.cgi?id=1006289
I read the source code and found the moment when the warning is
dispatched (line 821). I'm pasting the code here (lines 808 to 823):
static grub_err_t
grub_diskfilter_read (grub_disk_t disk, grub_disk_addr_t sector,
grub_size_t size, char *buf)
{
return read_lv (disk->data, sector, size, buf);
}
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");
}
As you can see in this code, the `grub_diskfilter_read` function is
implemented (and Grub can read the environment file). However, the
`grub_diskfilter_write` function isn't implemented and raises a
`GRUB_ERR_NOT_IMPLEMENTED_YET` error. In other words, Grub can't write
in a RAID array because it doesn't know how it can do this.
If you want to do not see this error anymore, you can:
- Change the `quick_boot="1"` to `quick_boot="0"` in the
`/etc/grub.d/00_header` file;
- Apply this patch:
https://launchpadlibrarian.net/175536511/diskfilter-writes.patch
- It was proposed in the Ubuntu thread [Bug #1274320, comment
#34](https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1274320/comments/34).
I think the first solution is a poor workarround (it can stop working
after a single `apt-get upgrade` of the `grub2` package). The second
solution is a better one.
However, the best solution would be if Grub implements the
`grub_diskfilter_write` function of the `diskfilter` module.
**Update:** The patch proposed in the [Bug #1274320, comment
#34](https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1274320/comments/34),
is explained above:
- First, the patch runs the command `grub-probe --target=disk "${grubdir}"`;
- The guy that made this patch used the `--target=disk` option. Maybe using
the `--target=abstraction` would be a better solution to locate boot partitions
inside RAID and LVMs;
- Second, the patch checks if the 'path' where grub is installed contains the
`"/dev/mapper"` (LVM) or the `"/dev/md"` (RAID) strings;
- Finally, if it is, the patch writes in the `/boot/grub/grub.cfg` file a
comment similar to one showed in the top of this answer:
- For example, in my case:<br>
```# GRUB lacks write support for /dev/md0, so recordfail support is
disabled.
```
To apply this path:
# Download
wget https://launchpadlibrarian.net/175536511/diskfilter-writes.patch
# Apply
patch /etc/grub.d/00_header < diskfilter-writes.patch
# Disable the old script
chmod -x /etc/grub.d/00_header.orig
# Update Grub
update-grub
This patch wasn't working for me (maybe the `00_header` was updated
since the patch was proposed). So, I made a new one:
https://gist.github.com/rarylson/23fb3ab46ded7ca2a818
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1274320
Title:
Error: diskfilter writes are not supported
To manage notifications about this bug go to:
https://bugs.launchpad.net/grub/+bug/1274320/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs