You are not logged in.

#1 2012-09-19 22:01:19

bpont
Banned
Registered: 2010-03-24
Posts: 161

Trying to finish my conversion to pure systemd

I'm trying to complete my conversion to systemd.  The only lines left in my /etc/rc.conf are:

NETWORK_PERSIST="no"

(where does this belong now?)

and my daemons:

DAEMONS=(syslog-ng @crond dbus avahi-daemon alsa network @ntpd netfs)

as you can see, some of my daemons are backgrounded at boot and I'm not sure how to accomplish that with systemd or whether it's even necessary.

These are the systemd equivalents and I have questions about some of them

syslog-ng.service

(I believe syslog-ng can be discarded under systemd, yes?)

cronie.service
dbus.service

(dbus.service does not need to be explicitly enabled according to systemd wiki?)

avahi-daemon.service
alsa-store.service alsa-restore.service

(do I need to load both alsa services enabled?)

ntpd.service

My netfs daemon is no longer needed under systemd?

I have all the systemd configuration files set up, specifically:

/etc/hostname, /etc/vconsole.conf, /etc/locale.conf, /etc/timezone, /etc/adjtime, /etc/modules-load.d/<program>.conf, /etc/systemd/logind.conf

So all should be left to do is to reboot and remove the

init=/bin/systemd

from

/etc/default/grub

then run:

# grub-mkconfig -o /boot/grub/grub.cfg

then manually remove initscripts, and then install systemd-sysvcompat and reboot again.

Is there any issue I've overlooked? I login from the shell and start X via ~/.bash_profile

What does systemd do with /etc/rc.local,  ~/.xinitrc, ~/.fluxbox/startup, ~/.bash_profile? I need all these files to run correctly under systemd

Last edited by bpont (2012-09-19 22:03:12)

Offline

#2 2012-09-19 22:21:47

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,444

Re: Trying to finish my conversion to pure systemd

bpont wrote:

I'm trying to complete my conversion to systemd.  The only lines left in my /etc/rc.conf are:

NETWORK_PERSIST="no"

(where does this belong now?)

Ditch it. Systemd will take care of it itself.

bpont wrote:
syslog-ng.service

(I believe syslog-ng can be discarded under systemd, yes?)

Yep.

bpont wrote:
dbus.service

(dbus.service does not need to be explicitly enabled according to systemd wiki?)

Yep.

bpont wrote:
alsa-store.service alsa-restore.service

(do I need to load both alsa services enabled?)

Ignore the alsa services. They're used by default.

bpont wrote:

My netfs daemon is no longer needed under systemd?

Hmm, not sure.

bpont wrote:

So all should be left to do is to reboot and remove the

init=/bin/systemd

from

/etc/default/grub

then run:

# grub-mkconfig -o /boot/grub/grub.cfg

then manually remove initscripts, and then install systemd-sysvcompat and reboot again.

Make sure you have everything installed and working via systemd before making any other changes. Services enabled and running, etc. This means removing them from rc.conf as you enable them in systemd. Once that is done, you just remove the init line and install grub, remove initscripsts, install systemd-sysvcompat, then reboot.

bpont wrote:

What does systemd do with /etc/rc.local,  ~/.xinitrc, ~/.fluxbox/startup, ~/.bash_profile? I need all these files to run correctly under systemd

rc.local should go away under systemd once you uninstall initscripts. All of the others have to do with programs that have nothing to do with systemd at all.

Last edited by Scimmia (2012-09-19 22:34:38)

Offline

#3 2012-09-19 22:47:20

bpont
Banned
Registered: 2010-03-24
Posts: 161

Re: Trying to finish my conversion to pure systemd

Scimmia wrote:

rc.local should go away under systemd once you uninstall initscripts.

But I mount /home/user on a separate partition via /etc/rc.local.  How do I accomplish that after removing initscripts?

Offline

#4 2012-09-19 22:57:27

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,444

Re: Trying to finish my conversion to pure systemd

why not just do it via fstab?

Offline

#5 2012-09-19 23:14:56

bpont
Banned
Registered: 2010-03-24
Posts: 161

Re: Trying to finish my conversion to pure systemd

Also, when I ran

# systemctl enable cronie.service

I got this error message:

Failed to issue method call: No such file or directory

Offline

#6 2012-09-19 23:15:49

bpont
Banned
Registered: 2010-03-24
Posts: 161

Re: Trying to finish my conversion to pure systemd

Scimmia wrote:

why not just do it via fstab?

Because it's encrypted.

Offline

#7 2012-09-19 23:25:52

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,751
Website

Re: Trying to finish my conversion to pure systemd

why not just do it via crypttab?

bpont wrote:

Also, when I ran

# systemctl enable cronie.service

I got this error message:

Failed to issue method call: No such file or directory

Is cronie installed and up-to-date?

Last edited by WorMzy (2012-09-19 23:26:42)


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#8 2012-09-20 00:16:06

bpont
Banned
Registered: 2010-03-24
Posts: 161

Re: Trying to finish my conversion to pure systemd

WorMzy wrote:

why not just do it via crypttab?

bpont wrote:

Also, when I ran

# systemctl enable cronie.service

I got this error message:

Failed to issue method call: No such file or directory

Is cronie installed and up-to-date?

I don't think crypttab supports truecrypt does it?

I had dcron installed which is why I got the error message.  I corrected it.

Offline

#9 2012-09-20 00:28:14

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,444

Re: Trying to finish my conversion to pure systemd

I don't know anything about drive encryption, but if you need to, you can always write a systemd service to run a script. I think the instructions are in the wiki.

Offline

#10 2012-09-20 01:46:53

bpont
Banned
Registered: 2010-03-24
Posts: 161

Re: Trying to finish my conversion to pure systemd

Scimmia wrote:

I don't know anything about drive encryption, but if you need to, you can always write a systemd service to run a script. I think the instructions are in the wiki.

I've never written a .service file before.  Will this work as a drop-in replacement to my /etc/rc.local entry?  Is the syntax right?


[Unit] Description=Mount truecrypt volume to /home/user during boot

[Service] ExecStart=/usr/bin/truecrypt /dev/sdxx /home/user
Type=oneshot
RemainAfterExit=yes

[Install] WantedBy=multi-user.target

Offline

#11 2012-09-20 01:54:41

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,444

Re: Trying to finish my conversion to pure systemd

AFAIK, that should do it.

Offline

#12 2012-09-20 03:23:27

bpont
Banned
Registered: 2010-03-24
Posts: 161

Re: Trying to finish my conversion to pure systemd

Scimmia wrote:

AFAIK, that should do it.

Actually, this is what worked:

[Unit]
Description=Mount truecrypt volume to /home/user during boot
ConditionFileIsExecutable=/usr/bin/truecrypt

[Service]
Type=oneshot
ExecStart=/usr/bin/truecrypt /dev/sdxx /home/user
StandardInput=tty
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Offline

#13 2012-09-20 15:50:37

bpont
Banned
Registered: 2010-03-24
Posts: 161

Re: Trying to finish my conversion to pure systemd

bpont wrote:
Scimmia wrote:

AFAIK, that should do it.

Actually, this is what worked:

[Unit]
Description=Mount truecrypt volume to /home/user during boot
ConditionFileIsExecutable=/usr/bin/truecrypt

[Service]
Type=oneshot
ExecStart=/usr/bin/truecrypt /dev/sdxx /home/user
StandardInput=tty
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Actually, after I completed the transition to pure systemd (mainly removing the kernel line, initscripts, etc.) and rebooted, my system hung when this service was called.  I do not know the proper syntax to make it work yet.

Offline

#14 2012-09-20 16:19:07

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,444

Re: Trying to finish my conversion to pure systemd

I'm going to guess the problem is with the "StandardInput=tty" line. From man systemd.exec:

StandardInput=

    Controls where file descriptor 0 (STDIN) of the executed processes is connected to. Takes one of null, tty, tty-force, tty-fail or socket. If null is selected standard input will be connected to /dev/null, i.e. all read attempts by the process will result in immediate EOF. If tty is selected standard input is connected to a TTY (as configured by TTYPath=, see below) and the executed process becomes the controlling process of the terminal. If the terminal is already being controlled by another process the executed process waits until the current controlling process releases the terminal. tty-force is similar to tty, but the executed process is forcefully and immediately made the controlling process of the terminal, potentially removing previous controlling processes from the terminal. tty-fail is similar to tty but if the terminal already has a controlling process start-up of the executed process fails. The socket option is only valid in socket-activated services, and only when the socket configuration file (see systemd.socket(5) for details) specifies a single socket only. If this option is set standard input will be connected to the socket the service was activated from, which is primarily useful for compatibility with daemons designed for use with the traditional inetd(8) daemon. This setting defaults

does truecrypt need tty input?

Last edited by Scimmia (2012-09-20 16:19:53)

Offline

#15 2012-09-20 20:05:40

bpont
Banned
Registered: 2010-03-24
Posts: 161

Re: Trying to finish my conversion to pure systemd

Scimmia wrote:

I'm going to guess the problem is with the "StandardInput=tty" line. From man systemd.exec:

StandardInput=

    Controls where file descriptor 0 (STDIN) of the executed processes is connected to. Takes one of null, tty, tty-force, tty-fail or socket. If null is selected standard input will be connected to /dev/null, i.e. all read attempts by the process will result in immediate EOF. If tty is selected standard input is connected to a TTY (as configured by TTYPath=, see below) and the executed process becomes the controlling process of the terminal. If the terminal is already being controlled by another process the executed process waits until the current controlling process releases the terminal. tty-force is similar to tty, but the executed process is forcefully and immediately made the controlling process of the terminal, potentially removing previous controlling processes from the terminal. tty-fail is similar to tty but if the terminal already has a controlling process start-up of the executed process fails. The socket option is only valid in socket-activated services, and only when the socket configuration file (see systemd.socket(5) for details) specifies a single socket only. If this option is set standard input will be connected to the socket the service was activated from, which is primarily useful for compatibility with daemons designed for use with the traditional inetd(8) daemon. This setting defaults

does truecrypt need tty input?

I removed the StandardInput=tty line, but now it exits with a status 1 failure.

Offline

#16 2012-09-20 20:55:47

stewie
Member
Registered: 2009-05-16
Posts: 20

Re: Trying to finish my conversion to pure systemd

bpont wrote:
Scimmia wrote:

AFAIK, that should do it.

Actually, this is what worked:

[Unit]
Description=Mount truecrypt volume to /home/user during boot
ConditionFileIsExecutable=/usr/bin/truecrypt

[Service]
Type=oneshot
ExecStart=/usr/bin/truecrypt /dev/sdxx /home/user
StandardInput=tty
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

You might want to change the ExecStart line to the correct partition.

What partition is your /home/user dir?

Also is your username user?


We wants it, we needs it. Must have the precious. Arch Linux.

Offline

#17 2012-09-20 21:13:45

bpont
Banned
Registered: 2010-03-24
Posts: 161

Re: Trying to finish my conversion to pure systemd

stewie wrote:
bpont wrote:
Scimmia wrote:

AFAIK, that should do it.

Actually, this is what worked:

[Unit]
Description=Mount truecrypt volume to /home/user during boot
ConditionFileIsExecutable=/usr/bin/truecrypt

[Service]
Type=oneshot
ExecStart=/usr/bin/truecrypt /dev/sdxx /home/user
StandardInput=tty
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

You might want to change the ExecStart line to the correct partition.

What partition is your /home/user dir?

Also is your username user?

Um. My partition and username are correct.  I just printed a generic description of them on a public forum.

I should also mention that my original configuration worked when I had a mixed system, but since removing initscripts, etc. and moving over to a pure systemd environment, now I can't get this service file to work.

Last edited by bpont (2012-09-20 21:14:08)

Offline

#18 2012-09-20 22:11:21

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: Trying to finish my conversion to pure systemd

bpont wrote:
DAEMONS=(syslog-ng @crond dbus avahi-daemon alsa network @ntpd netfs)

as you can see, some of my daemons are backgrounded at boot and I'm not sure how to accomplish that with systemd or whether it's even necessary.

systemd takes care of dependencies, you don't need to specify order/backgrounding any longer.

My netfs daemon is no longer needed under systemd?

Correct.

Offline

#19 2012-09-20 22:50:54

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: Trying to finish my conversion to pure systemd

Maybe your service file needs to specify that it should be used after something else is ready? Not sure though - still struggling with this transition myself.

By the way, you can leave removing the init from the command line until last - it won't interfere with anything, it just isn't necessary once the compatibility symlink is in place.

Anything here useful?


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#20 2012-09-21 13:33:14

bpont
Banned
Registered: 2010-03-24
Posts: 161

Re: Trying to finish my conversion to pure systemd

cfr wrote:

Anything here useful?

I haven't tried the fstab route yet.  I'd rather see if I can get my .service file to work because that's sort of the point of this much touted systemd.

Offline

#21 2012-09-21 14:02:49

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: Trying to finish my conversion to pure systemd

bpont wrote:
cfr wrote:

Anything here useful?

I haven't tried the fstab route yet.  I'd rather see if I can get my .service file to work because that's sort of the point of this much touted systemd.

/etc/fstab is the canonical place to configure filesystems, just like /etc/crypttab still is the place to configure encryption mappings. Unless you have a specific reason not to, I suggest using fstab rather than writing .mount files. Systemd should then DTRT and also anything else that integrates with fstab will "just work".

Offline

#22 2012-09-21 18:44:18

bpont
Banned
Registered: 2010-03-24
Posts: 161

Re: Trying to finish my conversion to pure systemd

tomegun wrote:
bpont wrote:
cfr wrote:

Anything here useful?

I haven't tried the fstab route yet.  I'd rather see if I can get my .service file to work because that's sort of the point of this much touted systemd.

/etc/fstab is the canonical place to configure filesystems, just like /etc/crypttab still is the place to configure encryption mappings. Unless you have a specific reason not to, I suggest using fstab rather than writing .mount files. Systemd should then DTRT and also anything else that integrates with fstab will "just work".

That method did not work.  I followed the instructions:

 Mount volumes via fstab

First of all, we need to write a script which will handle the way mounting via fstab is done. Place the following in /sbin/mount.truecrypt:

#!/usr/bin/env sh 
DEV="$1"
MNTPT="$2"
OPTIONS=""
TCOPTIONS=""
shift 3
IFS=','
for arg in $*; do
    if [ "${arg}" == "system" ]; then
        TCOPTIONS="${TCOPTIONS}-m=system "
    elif [[ "${arg}" == fs=* ]]; then
        FS=${arg#*=}
        TCOPTIONS="${TCOPTIONS}--filesystem=${FS} "
    else
         OPTIONS="${OPTIONS}${arg},"
    fi
done
truecrypt ${DEV} ${MNTPT} ${TCOPTIONS% *} --fs-options="${OPTIONS%,*}"

Also do not forget to make the file executable:

chmod +x /sbin/mount.truecrypt

Finally, add the device to fstab somewhat like this:

/dev/sdb3 /mnt truecrypt fs=vfat,defaults 0 0

My /etc/fstab line:

/dev/sdxx  /home/user  truecrypt  fs=ext3,defaults 0 0

Error messages on boot:

[Failed] Failed to mount /home/xxxxx  See systemctl status home-xxxxx.mount for details
[DEPEND] Dependency failed for local file systems
[DEPEND] Dependency failed for basic system
[DEPEND] Dependency failed for permit user sessions
[DEPEND] Dependency failed for multi-user
[DEPEND] Dependency failed for graphical interface

I should reiterate that my original .service file worked when I had a mixed system.  It was only after the full conversion that it stopped working.

Offline

#23 2012-09-21 21:41:38

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: Trying to finish my conversion to pure systemd

Well? Did you see systemctl status home-xxxx.mount for details?


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#24 2012-09-22 16:05:11

bpont
Banned
Registered: 2010-03-24
Posts: 161

Re: Trying to finish my conversion to pure systemd

cfr wrote:

Well? Did you see systemctl status home-xxxx.mount for details?

LOADED: Loaded (/etc/fstab)
Active: failed (result:exit-code)
Where: /home/xxxx
What: /dev/sdxx
Process: 211 ExecMount=/bin/mount /dev/sdxx /home/xxxx -t truecrypt -o fs=ext3,defaults (code=exited, status=1/FAILURE)
CGroup: name=systemd/system/home-xxxx.mount

Offline

#25 2012-09-22 21:36:53

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: Trying to finish my conversion to pure systemd

What happens if you run

/bin/mount /dev/sdxx /home/xxxx -t truecrypt -o fs=ext3,defaults

by hand?


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB