How to clean up full /boot safely?

Tom H tomh0665 at gmail.com
Thu Feb 15 14:16:16 UTC 2018


On Wed, Feb 14, 2018 at 8:26 PM, Ralf Mardorf <silver.bullet at zoho.com> wrote:
> On Wed, 14 Feb 2018 15:02:50 -0500, Tom H wrote:


>> Nitpick: "/boot" isn't bind-mounted in a dual-boot situation because a
>> bind-mount implies that both distributions/installs are running.
>
> Wrong, to bind doesn't require that both Linux are running, see the
> fstab part of [1].

Copied from below:

> [rocketmouse at archlinux ~]$ cat /mnt/moonstudio/etc/fstab
> #<file system>                             <mount point>  <type> <options>  <dump pass>
> /dev/sdb11                                  /              ext4   rw,relatime       0 1
> /dev/sda10                                  none           swap   sw                0 0
> /dev/sdb7                                   none           swap   sw                0 0
> /dev/sda9                                   /mnt/archlinux ext4   defaults,relatime 0 2
> /dev/sdb5                                   /mnt/winos7    ext4   defaults,relatime 0 2
> /mnt/archlinux/.boot/ubuntu_moonstudio/boot /boot          none   bind              0 0

You've already mounted the other install's "/boot".

In my case, the Ubuntu install has "/dev/sda1" as "/boot" and
"/dev/sdb1" as "/" and the Gentoo install has "/dev/sdc1" as "/".

They both boot from the kernel and grub files on "/dev/sdb1".

If I want/need to access Ubuntu's files on "/boot" from Gentoo, I run
"mount /dev/sda1 /boot". Of course, I could run "mount /dev/sdb1 /mnt
; mount /dev/sda1 /mnt/boot ; mount -o bind /mnt/boot /boot" manually
or when booting, but why?.


>> You don't have to mount "/boot" in order to run Linux.
>
> I don't know, perhaps it's not required, I'm to lazy to read how
> initramfs exactly is used, but at least for kernel upgrades syslinux
> requires the bind or a sync/copy workaround.

This has nothing to do with the initramfs. grub (and lilo) loads
"linux-image-..." and "initrd-..." from the "/boot" filesystem
(whether it's separate or not) without needing a mounted filesystem.


> What syslinux at least is unable to do, would be to boot Ubuntu from
> one UUID and Gentoo from another UUID, the kernel has to be on the
> same partition as /boot/syslinux/, if you don't want to use
> chainloading, while /boot/grub/ could be on one partition and the
> kernels could be on other partitions, IOW there is no need to use
> chainloading.

I set up a Debian VM, hostname "ralf1", and replaced grub with
extlinux. I duped it and purged "linux-image-..." and "extlinux" from
the copy. I can boot from either using the extlinux installed on
"ralf1" (there's not even a separate "/boot" filesystem on "ralf1").

root at ralf1 ~ # blkid
/dev/sda1: UUID="541ba927-f549-46a0-a79c-14205f90fec8" TYPE="ext3"
PARTUUID="46716548-01"
/dev/sdb1: UUID="c7d95e4f-f56f-4af5-9bab-8ba3318e1638" TYPE="ext3"
PARTUUID="46716548-01"

root at ralf1 ~ # findmnt -n /
/      /dev/sda1 ext3   rw,relatime,data=ordered

root at ralf1 ~ # ls /boot/
System.map-4.14.0-3-amd64  config-4.14.0-3-amd64
initrd.img-4.14.0-3-amd64  syslinux  vmlinuz-4.14.0-3-amd64

root at ralf1 ~ # cat /boot/syslinux/syslinux.cfg
UI menu.c32
TIMEOUT 20
DEFAULT buster

LABEL buster
    LINUX ../vmlinuz-4.14.0-3-amd64
    APPEND root=UUID=541ba927-f549-46a0-a79c-14205f90fec8 ro
    INITRD ../initrd.img-4.14.0-3-amd64

LABEL buster-no-boot
    LINUX ../vmlinuz-4.14.0-3-amd64
    APPEND root=UUID=c7d95e4f-f56f-4af5-9bab-8ba3318e1638 ro
    INITRD ../initrd.img-4.14.0-3-amd64

root at ralf1 ~ #

AFAIK, unlike grub, extlinux couldn't load a kernel from
"c7d95e4f-f56f-4af5-9bab-8ba3318e163" (if it existed) without
chainloading a bootloader install on
"c7d95e4f-f56f-4af5-9bab-8ba3318e163"; but this isn't what I was
talking about.




More information about the ubuntu-users mailing list