I've installed Ubuntu without creating a swap partition and with / on a btrfs.# Now I get the message "Sparse file is not allowed" on each boot. This message appears before the splash-screen. Is there a way to kill this warning?

# I use some programs that tend to get havoc on memory usage. To prevent them from killing my system, I let the OOM killer do the rest when out of memory rather than making my system unreasonably slow by excessive swapping.

link|improve this question

50% accept rate
2  
Op, what do you mean by "I use some programs that tend to get havoc on memory usage?" What is "I the OOM killer do the rest"? Are you running some additional software that you think might be causing trouble? – balloons Feb 17 at 21:09
I use Haskell for programming. As Haskell has not much semantics on the order of evaluation, recursion that can't be converted to a tail-call is likely to allocate memory till nothing is left. The OOM killer is a part of the Linux kernel that kills the process which demands the most memory when nothing is left. – FUZxxl Feb 17 at 22:22
1  
A workaround is to use a dedicated /boot partition. – ændrük May 1 at 2:11
ændrük: Why you no write an anser??? – FUZxxl May 2 at 11:52
feedback

1 Answer

up vote 7 down vote accepted
+50

OK after a bit of rummaging around I found a how-to too get rid of this problem at least temporarily it is fairly simple however I don't have my system set-up with btrfs so I can't confirm this fix.

either comment out or remove this line:

if [ -n ${have_grubenv} ]; then save_env recordfail; fi

in this file

/etc/grub.d/00_header

then run

update-grub

the reason for not editing /boot/grub/grub.cfg directly is that it will be over written every time grub is updated in this case you would only have to "re do" the fix if the grub common packages is updated.

This is the bug on launchpad if you want to add yourself bug #736743

Quoting Colin Watson from the bug report

This is actually a misleading error message: what's happening is that GRUB's btrfs implementation doesn't implement the file read hook interface for returning blocklists to calling code. I posted to grub-devel about this and the upstream maintainer pointed out that, even aside from multi-device problems, writing to btrfs from GRUB is fundamentally risky because:

  • the same block may be used by multiple snapshots * every tree which uses a given block will contain its checksum, and so on recursively

However, btrfs reserves space at the start for the boot loader. This space is more than GRUB needs to embed itself, and so we could use 1KB of it for an environment block.

In any case, this is not a new problem that arose from using subvolumes, nor does it prevent booting (you get a spurious "Press any key to continue" prompt, but if you just ignore it it'll boot anyway). Downgrading to wishlist.

Hope this helps

link|improve this answer
1  
Can you find an explanation as to why it spits out this error to begin with? Thanks. :) – jrg Feb 17 at 21:31
In my config file, the line looks like this: if [ -n "\${have_grubenv}" ]; then if [ -z "\${boot_once}" ]; then save_env recordfail; fi; fi – FUZxxl Feb 17 at 22:26
I would comment out. If it fails to boot you should still be able to uncomment the line using a live disk – Allan Feb 17 at 22:57
okay. I'm going to try this out. – FUZxxl Feb 18 at 16:27
2  
Nice, it works! – FUZxxl Feb 18 at 23:27
show 2 more comments
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.