Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install: systemctl preset-all does not work with --root= option #12304

Closed
wblaszcz opened this issue Apr 13, 2019 · 5 comments
Closed

install: systemctl preset-all does not work with --root= option #12304

wblaszcz opened this issue Apr 13, 2019 · 5 comments

Comments

@wblaszcz
Copy link

systemd version the issue has been seen with
242

Used distribution
LFS

Expected behaviour you didn't see
After booting system the login prompt should come up

Unexpected behaviour you saw
Boot process stops at
Starting Update UTMP about System Runlevel Changes...

Steps to reproduce the problem
build and install from tarball systemd-242.tar.gz, then boot system.
Same build process for version 241 works with no issue.

Further info
Looks like nothing is created under /etc/systemd/system except for two empty directories, getty.target.wants and multi-user.target.wants .

Creating the following symlink fixes the immediate issue.

ln -s /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service

@yuwata
Copy link
Member

yuwata commented Apr 13, 2019

From v242, you need to run systemctl preset-all or enable services by hand. See the relevant news entry:

systemd/NEWS

Lines 223 to 230 in 1e5d2d6

* During package installation (with `ninja install`), we would create
symlinks for systemd-networkd.service, systemd-networkd.socket,
systemd-resolved.service, remote-cryptsetup.target, remote-fs.target,
systemd-networkd-wait-online.service, and systemd-timesyncd.service
in /etc, as if `systemctl enable` was called for those units, to make
the system usable immediately after installation. Now this is not
done anymore, and instead calling `systemctl preset-all` is
recommended after the first installation of systemd.
.

@yuwata yuwata closed this as completed Apr 13, 2019
@wblaszcz
Copy link
Author

systemctl preset-all does not work in my case.
I build and install systemd as a non-root user to a non standard prefix, /tools.
systemctl --root=/ preset-all not only creates symlinks for unit files that are under /tools, but also from the main host system which I do not want.
systemctl --root=/tools preset-all does something strange in that not only does it try to create links under /tools/tools/.. but returns with some kind of failures like
Failed to preset unit, file /tools/tools/etc/systemd/system/ctrl-alt-del.target already exists and is a symlink to /lib/systemd/system/poweroff.target.
The above was done from a clean /tool directory.
BTW, /tools is a symlink to /home/lfs/tools.
systemctl --root=/home/lfs/tools preset-all doesn't come back with any failures but still tries to create things under tools/tools/....
I just don't get it as far as what the --root= option should be doing.
How do I get unit files that are under /tools linked from /tools/etc/systemd/system?

Thanks.

@yuwata yuwata reopened this Apr 14, 2019
@yuwata yuwata changed the title systemd-242 does not boot to login prompt install: systemctl preset-all does not work with --root= option Apr 14, 2019
@yuwata yuwata added bug 🐛 Programming errors, that need preferential fixing install labels Apr 14, 2019
@yuwata
Copy link
Member

yuwata commented Apr 14, 2019

Maybe, a workaround for this is chroot to /tool and run systemctl preset-all without --root= option.

@wblaszcz
Copy link
Author

Please ignore my previous comment. There were two factors involved, 1) PATH and 2) the assumption that --root was the same as --prefix.
The PATH affected which systemctl was being used, the system one or the just built one.
--prefix is relative to --root. --prefix was set to /tools.
So my final systemctl command looks like this:
/tools/bin/systemctl --root=/home/lfs preset-all where /tools is a symlink to /home/lfs/tools
which pretty much gives me what I want.

However I still think there is a bug in that above command which still produces errors.

/tools/bin/systemctl --root=/home/lfs preset-all
Created symlink /home/lfs/tools/etc/systemd/system/sysinit.target.wants/debug-shell.service → /tools/lib/systemd/system/debug-shell.service.
Created symlink /home/lfs/tools/etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service → /tools/lib/systemd/system/systemd-networkd-wait-online.service.
Created symlink /home/lfs/tools/etc/systemd/system/ctrl-alt-del.target → /tools/lib/systemd/system/poweroff.target.
Created symlink /home/lfs/tools/etc/systemd/system/dbus-org.freedesktop.resolve1.service → /tools/lib/systemd/system/systemd-resolved.service.
Created symlink /home/lfs/tools/etc/systemd/system/multi-user.target.wants/systemd-resolved.service → /tools/lib/systemd/system/systemd-resolved.service.
Created symlink /home/lfs/tools/etc/systemd/system/dbus-org.freedesktop.timesync1.service → /tools/lib/systemd/system/systemd-timesyncd.service.
Created symlink /home/lfs/tools/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service → /tools/lib/systemd/system/systemd-timesyncd.service.
Created symlink /home/lfs/tools/etc/systemd/system/multi-user.target.wants/remote-fs.target → /tools/lib/systemd/system/remote-fs.target.
Created symlink /home/lfs/tools/etc/systemd/system/multi-user.target.wants/machines.target → /tools/lib/systemd/system/machines.target.
Failed to preset unit, file /home/lfs/tools/etc/systemd/system/ctrl-alt-del.target already exists and is a symlink to /tools/lib/systemd/system/poweroff.target.
Created symlink /home/lfs/tools/etc/systemd/system/getty.target.wants/getty@tty1.service → /tools/lib/systemd/system/getty@.service.
Failed to preset unit, file /home/lfs/tools/etc/systemd/system/ctrl-alt-del.target already exists and is a symlink to /tools/lib/systemd/system/poweroff.target.
Failed to preset unit, file /home/lfs/tools/etc/systemd/system/ctrl-alt-del.target already exists and is a symlink to /tools/lib/systemd/system/poweroff.target.
Created symlink /home/lfs/tools/etc/systemd/system/boot-complete.target.requires/systemd-boot-check-no-failures.service → /tools/lib/systemd/system/systemd-boot-check-no-failures.service.
Created symlink /home/lfs/tools/etc/systemd/system/getty.target.wants/console-getty.service → /tools/lib/systemd/system/console-getty.service.
Created symlink /home/lfs/tools/etc/systemd/system/sockets.target.wants/systemd-networkd.socket → /tools/lib/systemd/system/systemd-networkd.socket.
Created symlink /home/lfs/tools/etc/systemd/system/dbus-org.freedesktop.network1.service → /tools/lib/systemd/system/systemd-networkd.service.
Created symlink /home/lfs/tools/etc/systemd/system/multi-user.target.wants/systemd-networkd.service → /tools/lib/systemd/system/systemd-networkd.service.
Created symlink /home/lfs/tools/etc/systemd/system/sysinit.target.wants/systemd-time-wait-sync.service → /tools/lib/systemd/system/systemd-time-wait-sync.service.
Failed to preset unit, file /home/lfs/tools/etc/systemd/system/ctrl-alt-del.target already exists and is a symlink to /tools/lib/systemd/system/poweroff.target.

The Failed to preset unit error does not make sense. It implies that the ctrl-alt-del.target is created 5 times?

@poettering
Copy link
Member

It's not supported to set the prefix to anything other than /usr. This is documented explicitly in README.

systemd is not an app you can install at arbitrary places, it's a core part of the OS, hence we make stricter requirements there.

Sorry.

@poettering poettering added not-a-bug and removed bug 🐛 Programming errors, that need preferential fixing labels Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants