You are not logged in.

#1 2012-11-28 10:53:16

nazarener
Member
Registered: 2009-02-07
Posts: 19

systemd: Does not boot without USB plugged in

I just tried to switch to systemd and followed the wiki.


Usually I have a USB stick connected to my laptop. It turns out, that my laptop wont boot if this USB stick is not connected.
Running journalctl reveals stuff like:

Nov 28 12:40:11 yellowmobil systemd[1]: Job dev-disk-by\x2duuid-EEAE\x2dD2D2.device/start timed out.
Nov 28 12:40:11 yellowmobil systemd[1]: Timed out waiting for device dev-disk-by\x2duuid-EEAE\x2dD2D2.device.
Nov 28 12:40:11 yellowmobil systemd[1]: Dependency failed for /media/EEAE-D2D2.
Nov 28 12:40:11 yellowmobil systemd[1]: Dependency failed for Local File Systems.

For this USB stick i have the following /etc/fstab-entry:

/dev/disk/by-uuid/EEAE-D2D2 /media/EEAE-D2D2 vfat owner,users,rw     0 0

Furthermore I have an UDEV-rule, which triggers when I plug in this USB stick:

SUBSYSTEM=="block", ATTR{size}=="31266784", RUN+="/home/yell/bin/Crypt"

The file Crypt looks like this:

#!/bin/bash
mount /dev/disk/by-uuid/EEAE-D2D2
sleep 1
truecrypt -t --non-interactive   -k /media/EEAE-D2D2/key /dev/sda2

Usually (with rcinit) it would go like this: (Re)plug in the USB stick; /dev/sda2 gets mounted to /media/truecrypt1. If i reboot, the folder /media/truecypt1 is gone.
Now it is like this: Plug in the USB stick, a new folder /media/truecrypt{123..} is created. If I try to access I get the error "ls: cannot access truecrypt1: Transport endpoint is not connected". Once i reboot the folder is still there and of course, i can only reboot if the USB stick is connected.

Last edited by nazarener (2012-11-28 10:53:52)

Offline

#2 2012-11-28 12:23:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: systemd: Does not boot without USB plugged in

Two wrongs don't make a right.  Remove the fstab entry to allow systemd to boot to get rid of one wrong.  Then reconsider the udev rule and look into the better methods of automounting to get rid of the other.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2012-11-28 14:11:48

nazarener
Member
Registered: 2009-02-07
Posts: 19

Re: systemd: Does not boot without USB plugged in

Ok, after removing the fstab entry my computer boots without usb stick. I also removed the udev-rules and installed autofs. However, i could not find out how to run a custom command with autofs in response of mounting the usb stick.
This created a new problem:
I need to run

 chown yell /sys/class/backlight/acpi_video0/brightness 

at boot to be able to toggle the screen brightness. I put this command into rc.local
then I created the following service and installed it.

[unit]
Description=/etc/rc.local Compatibility

[Service]
Type=oneshot
ExecStart=/etc/rc.local
TimeoutSec=0
StandardInput=tty
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

However, while booting i get an error: the mentioned file can not be found. Somehow i think this is related to autofs, because it worked before installing that.

Offline

#4 2012-11-28 14:15:27

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

Re: systemd: Does not boot without USB plugged in

Systemd will go into emergency mode if something in your fstab cannot be mounted at boot. To avoid that you could append 'nofail' to your options in fstab.

You'd probably be best of with using native systemd service files for truecrypt if they exist (I don't use TC, so don't really know). Assuming the wiki page is up-to-date there should be a way: https://wiki.archlinux.org/index.php/Tr … md_service

Offline

#5 2012-11-29 03:09:36

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

Re: systemd: Does not boot without USB plugged in

nazarener wrote:

I need to run

 chown yell /sys/class/backlight/acpi_video0/brightness 

at boot to be able to toggle the screen brightness.

Why?


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

#6 2012-11-29 05:17:03

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: systemd: Does not boot without USB plugged in

@cfr, I would imagine from the OP's choice of automount/decrypt method, he/she seems to have the idea that using the lowest level userspace stuff is ideal.  I assume that the birghtness keys must be mapped to actually directly change the value in the brightness file.  To me this seems as silly as using a udev rule to mount... but hey, thats me.

@OP, have you looked into tools that assist in changing the backlight?  Namely, xorg-xbacklight? I also came across a community contribution called Light the other day, and it works pretty well.  Its available in the AUR.

Offline

#7 2012-11-29 13:47:11

nazarener
Member
Registered: 2009-02-07
Posts: 19

Re: systemd: Does not boot without USB plugged in

Thanks WonderWoofy: I installed xorg-xbacklight, which replaced my script. So far it does everything I want.
@cfr: This way to change the brightness is, what came up after googling some very long time ago.

I can understand you, that there might be easier ways to get something done. But it finding the right package to use, reading and understanding the documentation and then configuring it just takes way longer then writing the udev rule.
I mean, I dont really use an udev rule for mounting. I rather using it for "if i plug in my usb stick, encrypt and mount my second harddrive using the keyfile on this usb stick".
So far i don't really know how to get the desired behavior out of autofs. I guess I will use the weekend to understand tomeguns link.
Thanks so far @all.

Edit: I just tried the 'light' from AUR aswell. It does the same as my self-made method, namely write some numbers into '/sys/class/backlight/intel_backlight/brightness'. This would also require to change owner or at least give write access to the mentioned file (which is the same problem i encountered before).

Last edited by nazarener (2012-11-29 13:56:55)

Offline

Board footer

Powered by FluxBB