This is weird ...
My /home directory is set up somewhat strangely, as in I've got two raw partitions, I've put dm-integrity on them, raided them together, then
put lvm on top of that.
Which got me into a bind with fstab. I've created a systemd service,
which fires up dm-integrity on those two partitions. But I get the
impression it doesn't run until fstab completes. Catch-22 - fstab tries
to mount /home, but it can't until dm-integrity has made the volume appear!
dm-integrity. Great - I enabled it and it appeared to work!
Only problem, startplasma-wayland now dumped me at a blank screen.
Now for the weirdo. I disabled it, thinking I would have to log in as
root, mount /home, and go from there. Except that, when I logged in,
/home was mounted and startplasma-wayland worked!
systemctl tells me mount.home is disabled, but also tells me that it ran
and mounted the drive.
So what on earth is going on, and more importantly, what am I misunderstanding or doing wrong. I would very much like to know why it's working, when I think it shouldn't be!
On Fri, Sep 24, 2021 at 2:25 PM antlists <antlists@youngman.org.uk <mailto:antlists@youngman.org.uk>> wrote:
This is weird ...
My /home directory is set up somewhat strangely, as in I've got two raw
partitions, I've put dm-integrity on them, raided them together, then
put lvm on top of that.
Which got me into a bind with fstab. I've created a systemd service,
which fires up dm-integrity on those two partitions. But I get the
impression it doesn't run until fstab completes. Catch-22 - fstab tries
to mount /home, but it can't until dm-integrity has made the volume
appear!
Have you tried using Before=local-fs.target in the service? Or even Before=local-fs-pre.target?
So I created a systemd mount unit for /home, which only runs after
dm-integrity. Great - I enabled it and it appeared to work!
You removed the /home entry from fstab, right?
Only problem, startplasma-wayland now dumped me at a blank screen.
Now for the weirdo. I disabled it, thinking I would have to log in as
root, mount /home, and go from there. Except that, when I logged in,
/home was mounted and startplasma-wayland worked!
That sounds like /home was still on fstab...
systemctl tells me mount.home is disabled, but also tells me that it
ran
and mounted the drive.
That should be home.mount. What does systemctl status home.mount says?
So what on earth is going on, and more importantly, what am I
misunderstanding or doing wrong. I would very much like to know why
it's
working, when I think it shouldn't be!
On 24/09/2021 21:30, Canek Peláez Valdés wrote:
There's a lot of info about how to write a service file, but if you need
to run before or after system service files, it's nowhere near so easy
to find out Before=WHAT or After=WHAT :-)
So I created a systemd mount unit for /home, which only runs after
dm-integrity. Great - I enabled it and it appeared to work!
You removed the /home entry from fstab, right?
mad it noauto, yes ...
That should be home.mount. What does systemctl status home.mount says?
anthony@thewolery ~ $ systemctl status home.mount
● home.mount - Mount Home
Loaded: loaded (/etc/systemd/system/home.mount; disabled; vendor preset: disabled)
So what on earth is going on, and more importantly, what am I
misunderstanding or doing wrong. I would very much like to know why
it's
working, when I think it shouldn't be!
So fstab says noauto, home.mount is disabled, and /home is mounted on
boot...
On Fri, Sep 24, 2021 at 2:25 PM antlists <antlists@youngman.org.uk <mailto:antlists@youngman.org.uk>> wrote:
This is weird ...
My /home directory is set up somewhat strangely, as in I've got two raw
partitions, I've put dm-integrity on them, raided them together, then
put lvm on top of that.
Which got me into a bind with fstab. I've created a systemd service,
which fires up dm-integrity on those two partitions. But I get the
impression it doesn't run until fstab completes. Catch-22 - fstab tries
to mount /home, but it can't until dm-integrity has made the volume
appear!
Have you tried using Before=local-fs.target in the service? Or even Before=local-fs-pre.target?
On Sat, Sep 25, 2021 at 1:48 PM antlists <antlists@youngman.org.uk <mailto:antlists@youngman.org.uk>> wrote:
[...]
Bear in mind, integritysetup is not in my initrd, so ...
I think you would need to put it in your initrd.
It looks to me like grub switches to the real root partition read-only
before firing stuff off, so if I tell my integritysetup.service to run
before local-fs.target, does that mean everything should be working
before systemd runs fstab?
Bear in mind dm-integrity is on my raw partitions, and I'm running lvm
and md-raid, I'm guessing they're part of local-fs-pre.target? So I
really need to run dm-integrity before that? Or preferably add
dm-integrity TO that - how do I do that?
The problem is this isn't all that discoverable - even digging around
/etc/systemd, it's hard to find clues ...
As Rich already mentioned it, noauto != remove mount point from fstab.
That's the first thing.
Then you need to specify that home.mount should run *after* md/LVM,
which in turn runs after your integrity setup service. The problem is:
you have root (/) on md/LVM too; I know they are different
RAIDs/volumes, but there is one *service* for RAID and LVM, at least out-of-the-box, in systemd. You could try to split different instances
using templates (the units with @ in their names), but the simplest
solution is to put your integrity logic in the initrd (with the added
benefit that you can mount it in emergencies if something goes wrong
with root).
If you have the integrity logic in early boot, then your integrity setup service should have:
Before=mdmonitor.service lvm2-lvmetad.service
And I think that should be enough? The home.mount unit depends on the underlying device being available, and that will happen only after md
and LVM have done it's thing.
Bear in mind, integritysetup is not in my initrd, so ...
It looks to me like grub switches to the real root partition read-only
before firing stuff off, so if I tell my integritysetup.service to run
before local-fs.target, does that mean everything should be working
before systemd runs fstab?
Bear in mind dm-integrity is on my raw partitions, and I'm running lvm
and md-raid, I'm guessing they're part of local-fs-pre.target? So I
really need to run dm-integrity before that? Or preferably add
dm-integrity TO that - how do I do that?
The problem is this isn't all that discoverable - even digging around /etc/systemd, it's hard to find clues ...
</div></div></div>
the simplest solution is to put your integrity logic in the initrd (with the added benefit that you can mount it in emergencies if something goes wrong with root).
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (3 / 13) |
Uptime: | 51:29:10 |
Calls: | 6,650 |
Calls today: | 2 |
Files: | 12,200 |
Messages: | 5,330,304 |