O único problema é que a documentação não inclui esse detalhe. O código garante lidar com isso.
/* Returns true for all units that are "magic" and should be excluded from the usual start-up and shutdown dependencies. We call them "extrinsic" here, as they are generally mounted outside of the systemd dependency logic. We shouldn't attempt to manage them ourselves but it's fine if the user operates on them with us. */
if (!MANAGER_IS_SYSTEM(UNIT(m)->manager)) /* We only automatically manage mounts if we are in system mode */
return true;
if (PATH_IN_SET(m->where, /* Don't bother with the OS data itself */
"/",
"/usr"))
return true;
if (PATH_STARTSWITH_SET(m->where,
"/run/initramfs", /* This should stay around from before we boot until after we shutdown */
"/proc", /* All of this is API VFS */
"/sys", /* … dito … */
"/dev")) /* … dito … */
return true;
/* If this is an initrd mount, and we are not in the initrd, then leave this around forever, too. */
p = get_mount_parameters(m);
if (p && fstab_test_option(p->options, "x-initrd.mount if (!MANAGER_IS_SYSTEM(UNIT(m)->manager)) /* We only automatically manage mounts if we are in system mode */
return true;
if (PATH_IN_SET(m->where, /* Don't bother with the OS data itself */
"/",
"/usr"))
return true;
if (PATH_STARTSWITH_SET(m->where,
"/run/initramfs", /* This should stay around from before we boot until after we shutdown */
"/proc", /* All of this is API VFS */
"/sys", /* … dito … */
"/dev")) /* … dito … */
return true;
/* If this is an initrd mount, and we are not in the initrd, then leave this around forever, too. */
p = get_mount_parameters(m);
if (p && fstab_test_option(p->options, "x-initrd.mount%pre%") && !in_initrd())
return true;
return false;
}
") && !in_initrd())
return true;
return false;
}
Note que parece não suportar casos em que você deseja que desmonte /usr
em umount.target. É provavelmente melhor ignorar a afirmação do systemd de que ela própria suporta a montagem /usr
sem um initramfs. Essa afirmação é feita fora do repositório do git e no contexto de apontar que muitos projetos importantes rejeitaram o suporte a sistemas configurados dessa maneira.