[systemd-devel] Service not starting that wants first-boot-complete.target

Andrei Borzenkov arvidjaar at gmail.com
Tue Apr 8 04:40:12 UTC 2025


08.04.2025 03:40, Christopher Hunt wrote:
> Howdy. I've got a "Resize file system" service that wants first-boot-complete.target and is to be run before it. I've linked the service to the first-boot-complete.target,

What does it mean?

> removed /etc/machine-id and then reboot. The first boot condition is met, yet I see the following status once booted:
> 
> ○ resizefs.service - Resize file system to capacity on first boot
>       Loaded: loaded (/etc/systemd/system/resizefs.service; enabled; preset: enabled)
>       Active: inactive (dead)
> 
> If there was a problem with my link then I suppose wouldn't see that the above service is enabled. Which leads me to think that there's something else up.
> 
> If I check the target itself:
> 
> ○ first-boot-complete.target - First Boot Complete
>       Loaded: loaded (/usr/lib/systemd/system/first-boot-complete.target; static)
>       Active: inactive (dead)
>         Docs: man:systemd.special(7)
> 
> ...then I think that's telling me that first boot didn't complete... right? But dmesg shows that first boot is so:
> 
> [    3.024138] systemd[1]: Detected first boot.
>

it just tells you the ConditionFirstBoot is true. It does not imply that 
any specific service will be started.


> Here's my unit file:
> 
> [Unit]
> Description=Resize file system to capacity on first boot
> 
> ConditionFirstBoot=yes
> 
> DefaultDependencies=no
> # This service will need to write to the file system:
> After=systemd-remount-fs.service
> 
> Wants=first-boot-complete.target
> Before=first-boot-complete.target sysinit.target
> Conflicts=shutdown.target
> Before=shutdown.target
> 
> [Service]
> Type=oneshot
> ExecStart=/etc/systemd/system/resizefs.sh
> 

It cannot be the complete file because earlier it says "enabled" and 
this service does not have [Install] section.

Anyway - something has to start this service. So far, you did not 
explain how it is started.

> Thanks for any ideas as to why my service is not being started.
> 
> 



More information about the systemd-devel mailing list