6

I have Ubuntu 18.04 installed on a UEFI system with /boot on a btrfs partition (subvol=@).

Because of recent changes in Ubuntu I always get grub timeout 30 sec. This is by design if /boot is on a btrfs partition.

Part of /grub.cfg

function recordfail {
  set recordfail=1
  # GRUB lacks write support for btrfs, so recordfail support is disabled.
}
...
if [ "${recordfail}" = 1 ] ; then
  set timeout=30

I think that if I create a separate ext2 /boot partition the problem will be solved.

The question is if the above assumption is correct, how do I move boot from a btrfs subvol to an ext2 partition?

Pilot6
  • 88,764
  • 91
  • 205
  • 313
  • Not really different than moving /home to new partition. Create partition, copy /boot files, edit fstab, but you will have to reinstall grub so it searches for new location. Because you need to reinstall grub anyway, you can create partition & edit fstab. Then in Boot-Repair's advanced mode do the full reinstall of grub & new kernel options. Full reinstall of grub will reset any changes you made to grub configuration, so save those or know what you normally change. – oldfred Aug 08 '19 at 15:47
  • I tried to do it without using Boot-repair and can't figure that out. Do I mount `boot/efi` partition ,etc. Maybe Boot-repair is an option. – Pilot6 Aug 08 '19 at 15:49
  • You must be sure to boot in same boot mode, UEFI or BIOS, so reinstall is correct. Boot-Repair will see in fstab, the ESP & /boot partitions, so they must be in fstab first. – oldfred Aug 08 '19 at 15:50
  • Alternatively you could set grub's timeout with a single line `set timeout=x` in `/etc/grub.d/40_custom`, `chmod +x /etc/grub.d/40_custom`, `sudo update-grub` to your desired timeout. The snippet you show is from `/etc/grub.d/00_header` which is processed first when creating `grub.cfg`, setting the timeout later again will then take precedence. – mook765 Aug 08 '19 at 16:09
  • It looks like boot-repair fixed it. But it checks `/boot`/ every time. – Pilot6 Aug 08 '19 at 16:32
  • Here we have `btrfs` specifics. – Pilot6 Aug 08 '19 at 17:41

2 Answers2

4

I managed to do it using Boot-repair from a LiveUSB.

Before start I recommend to create a snapshot of @ subvolume in case something goes wrong.

  1. Shrink / partition to leave 1-2 GB free with gparted

  2. Create ext2 partition.

  3. Mount the / partition to /mnt

  4. Mount the new ext2 partition to /media

  5. Run cp -a /mnt/@/boot/* /media

  6. Edit /mnt/@/etc/fstab and add there mount of the new ext2 partition to /boot.

  7. Delete old boot from / by sudo rm -r /mnt/@/boot

  8. Run sudo umount /mnt && sudo umount /media

  9. Run boot-repair and do a default check.

All should work, and grub timeout is OK now.

Pilot6
  • 88,764
  • 91
  • 205
  • 313
0

There is another way to fix timeout issue on btrfs file systems.

You can add

GRUB_RECORDFAIL_TIMEOUT=0

to /etc/default/grub and run sudo update-grub.

But make sure you can always get into UEFI settings using ESC or other key.

Pilot6
  • 88,764
  • 91
  • 205
  • 313