31

After upgrading from Ubuntu 12.04 to Ubuntu 12.10, I get a message "scanning for btrfs file systems" at starting-up. I don't have any BTRFS filesystem. It delays the booting for about 15 seconds.

How can I get rid of this?

user
  • 28,161
  • 13
  • 75
  • 138
cnvzmxcvmcx
  • 527
  • 1
  • 4
  • 9
  • I uninstalled btrfs to find out, that the scan for btrfs is not the reason for the delay. after removing btrfs it still hangs but one line earlyer at `Begin: Running /scripts/local-premount` – rubo77 May 09 '18 at 17:09
  • There is also btrfs superblock scanning in every partition in libblkid - https://github.com/karelzak/util-linux/blob/master/libblkid/src/superblocks/btrfs.c#L62 https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/libblkid/src/superblocks/btrfs.c – osgx Oct 21 '18 at 12:56

7 Answers7

21

On Ubuntu 18.04 you can uninstall btrfs-support with

apt purge btrfs-progs

But that probably wouldn't save you much boot time. On my system the reason was, that I don't have a swap partition but on boot it is searched for such for about 30 seconds (while displaying the btrfs-scan).

remove the swap check

  • open /etc/initramfs-tools/conf.d/resume
  • replace RESUME=UUID=xxx with RESUME=none
  • issue sudo update-initramfs -u
  • reboot your system

(create the file if it does not exist and just add RESUME=none in it)

source: https://askubuntu.com/a/1034952/34298

rubo77
  • 27,777
  • 43
  • 130
  • 199
18

The btrfs-tools package adds an action to the initramfs to load the btrfs module. If you purge that package (sudo apt-get purge btrfs-tools), followed by an update-initramfs -ukall if the uninstallation doesn't do it already, that should go away (though I've not tested it). If it doesn't, you can always blacklist the brtfs module in /etc/modprobe.d.

Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501
  • 1
    Doing this on Ubuntu server 16.04 apt gives me "The following packages will be REMOVED: btrfs-tools* ubuntu-server*". Hmm, I'd like to keep the server though... – elomage Apr 29 '17 at 21:02
  • 1
    @elomage, `ubuntu-server` is just a _meta-package_ that is used to pull packages typically found on server-style installations as dependencies. By removing it (provided no other package are removed as a result), you're not removing any software. – Stéphane Chazelas Apr 30 '17 at 07:55
  • Thanks. Improved my elementary Juno startup times. – Jürgen Hörmann Nov 16 '18 at 21:03
5

Btrfs isn’t too much stable to be used as deafult file-system. Most Linux distributions, probable all, are still using ext4 as primary file-system. So, you can completely remove it from your computer. Try the given command:

sudo apt-get purge btrfs-tools

This command will remove btrfs-tools from your computer. You may need to wait some minutes to complete the process. Your initramfs should be updated automatically but if not happen, do it by this command:

sudo update-initramfs -ukall

Then make a grub update:

sudo update-grub

All is well. Now make a restart. Hope your Ubuntu will start successfully this time.

Reference: http://www.ugcoder.com/disable-scanning-for-btrfs-file-systems-in-ubuntu/

Let me know if you have some questions still.

  • The package is not installed on my system. So i tried `echo "blacklist btrfs">>/etc/modprobe.d/blacklist.conf` But no effect. still scanning for btrfs on boot – rubo77 May 09 '18 at 17:02
4

I saw this as well on 18.04 during boot. Since

/usr/share/initramfs-tools/scripts/local-premount/btrfs

calls for the scan, you can workaround this issue by dealing with that file. Since I wasn't using btrfs regularly, I purged the file through

sudo apt purge btrfs-progs
m1st0
  • 41
  • 1
  • 2
    To get rid of that message, you need to do `sudo update-initramfs -ukall` as well. But still, that doesn't help much, the boot process then hangs at the step before saying `Begin: Running /scripts/local-premount` – rubo77 May 10 '18 at 06:36
2

Circa 2021

At least with server versions of ubuntu btrfs-tools is not loaded by default and thus this unwanted scan is not an issue. The issue arises when you install a distro that has tools which have btrfs-tools as a dependency like the popular timeshift which is included with mint. That creates the issue. If you can live without timeshift then just remove btrfs-tools per other posts and you should be good to go (it will remove timeshift and update initramfs automatically).

BUT if you are like me use qt-fsarchiver or need timeshift then you can't just remove btrfs-tools as it is a dependency of both. If you remove it you will remove them. :(.

So this is what I did.

sudo modprobe -r btrfs
echo blacklist btrfs | sudo tee -a /etc/modprobe.d/blacklist-btrfs.conf
sudo update-initramfs -u

now reboot and watch to see if the btrfs scan was disabled.

GAD3R
  • 63,407
  • 31
  • 131
  • 192
DKebler
  • 272
  • 4
  • 11
  • That's similar to what I did, technically, after updating the initramfs, it's also possible to delete the blacklist file, and it'll allow using btrfs after the boot has finished. – Didi Kohen Nov 26 '22 at 16:58
  • If the kernel gets updated then initramfs will get rebuilt and if you remove the blacklist I guessing it will end up including the module again. Unless there is reason to I'd leave the blacklist. If you indeed have a btrfs partition on the machine this whole issue is moot. The scan should complete quickly and continue to boot so no reason to blacklist it. – DKebler Nov 29 '22 at 15:59
1

It is the btrfs kernel module that does the scanning (for filesystems scanning multiple devices).

I have not found an indication that this is configurable, so your only options seems to be removing that module from your kernel (modprobe -r btrfs) assuming your kernel supports that.

Anthon
  • 78,313
  • 42
  • 165
  • 222
-2

The script which starts the search looks for the existence of btrfs. Simply renaming the executable /sbin/btrfs to p.e /sbin/btrfs.save (as sudo) will eliminate the search , gaining some 10-20 seconds in the boot-process!

Raphael Ahrens
  • 9,701
  • 5
  • 37
  • 52
  • 2
    it is not recommended to just delete system files. better uninstall the btrfs too with `apt purge btrfs-tools` – rubo77 May 10 '18 at 06:38