Skip to content

Commit

Permalink
Fix #10
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei-Pozolotin committed Feb 27, 2018
1 parent af6ea19 commit dfbed2e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions initrd-sysroot-mount.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool

# Ensure /sysroot mount before switch root.
# See issue #10.
# See https://www.freedesktop.org/software/systemd/man/bootup.html

[Unit]
Description=Initrd SysRoot Mount
Documentation=https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/README.md
ConditionPathExists=/etc/initrd-release
ConditionPathExists=/dev/mapper/root
ConditionPathExists=/sysroot
ConditionPathIsMountPoint=!/sysroot
DefaultDependencies=no
After=initrd-cleanup.service
After=initrd-root-fs.target initrd-fs.target initrd.target
Before=initrd-switch-root.service
Before=initrd-switch-root.target

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/mount /dev/mapper/root /sysroot

This comment has been minimized.

Copy link
@jlsalvador

jlsalvador Mar 5, 2018

Contributor

This path /dev/mapper/root is not always correct.
In my case, root it's a LVM partition inside a LUKS partition. Maybe, you can fetch the root from fstab or the kernel args.
I'll try to improve it this weekend if it isn't fixed until then.

This comment has been minimized.

Copy link
@Andrei-Pozolotin

Andrei-Pozolotin Mar 5, 2018

Author Collaborator

application is handled by filter

ConditionPathExists=/dev/mapper/root

and unit initrd-sysroot-mount.service is intended more like a prototype

similar to how fstab is just a template
https://github.com/random-archer/mkinitcpio-systemd-tool/blob/master/fstab

looking forward to you solution


[Install]
WantedBy=initrd-switch-root.service
WantedBy=initrd-switch-root.target

[X-SystemdTool]

# enable service
InitrdService=enable

0 comments on commit dfbed2e

Please sign in to comment.