5

I have a somewhat complicated setup on my computer (a Chromebook) where in a kernel without an initial RAM disk is used to reboot into another kernel with an initial RAM disk using kexec. I have a systemd unit (?) file that successfully runs /etc/rc.local (as in it will be called), which is what I use to call kexec, but I need it to start after entries in fstab have been mounted. The first-stage kernel runs without any use of the display (I haven't figured out how to get it to do use the display), so I don't know if /etc/rc.local is being called before or after fstab entries have been mounted.

I copied the rc-local.service file from another place and it looks like this:

[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

I hadn't noticed the SysVStartPriority until now and assume that value it's set to would make it run last, but when I swapped out my kexec kernel for the normal one (which boots straight with a display), I noticed that the logs or the console output said that that parameter was deprecated. So, I need to specify a After= parameter to control when rc.local runs. What is the systemd unit/service name that mounts fstab entries?

1 Answer 1

6

You're looking for local-fs.target (for local filesystems) and remote-fs.target (for network filesystems). There are documented in the systemd.special manpage.

See also the RequiresMountsFor directive in systemd.unit.

3
  • I thought it would end with .service. Why doesn't it? Commented Jun 7, 2017 at 20:15
  • 1
    @Melab well, because it's not a service. There are a bunch of different types of unit files, services are just one. There are also mount units (which is what your /etc/fstab gets turned into in systemd, or you can write them yourself), device units, automount units, socket units, and probably a few more I'm forgetting. Then there are target units, which are used mainly as dependency simplifications/abstractions: instead of depending on the potentially dozens of .mount units that give local filesystems, you just depends on local-fs.target. Commented Jun 7, 2017 at 22:27
  • @Melab you might want to start with the systemd.unit manpage. Or systemctl list-units --all Commented Jun 7, 2017 at 22:28

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.