[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Re: Camera SD card mounting problems (defined by systemd)



The Wanderer:
If the mount failing isn't that  critical, then the "right way" to fix
> the problem under systemd's apparent design would probably be to add
> the "noauto" label to the fstab, so that the device will not mount
> automatically on boot.

Actually, that's just the widespread NON-systemd way of doing things, for which systemd has such compatibility mechanisms as systemd-fstab-generator, a program that reads /etc/fstab at bootstrap and that generates a whole load of nonce units that translate fstab records to the systemd way of doing things. Adding "noauto" and fixing the erroneous device name so that it is correctly spelled is the way to fix things even if one isn't using systemd at all.

The raw systemd way of doing things is mount and device units, per the systemd.mount(5) and systemd.device(5) manual pages. In the raw systemd way of doing things, there's a device unit named "dev-sde1.device" which is a base requirement for a mount unit named "media-lumix\x2dphotos.mount". If made by hand, they would look something like:

    # /etc/systemd/system/dev-sde1.device
    [Unit]
    Description=Device unit for %N

    # /etc/systemd/system/media-lumix\x2dphotos.mount
    [Unit]
    Description=Mount unit for %N
    # For exposition:
    BindsTo=dev-sde1.device
    [Install]
    RequiredBy=local-fs.target
    [Mount]
    What=/dev/sde1
    Where=%N
    Type=vfat
    Options=users,iocharset=utf8,umask=000

And these are, in essence, what systemd-fstab-generator and systemd-udevd generate on the fly. There will be an auto-generated /run/systemd/generator/media-lumix\x2dphotos.mount similar to the above. If the fstab record is "auto" there will also be a symbolic link in /run/systemd/generator/local-fs.target.requires pointing to the mount unit. When the /dev/sde1 device appears, dev-sde1.device is auto-generated and started by systemd-udevd.

Mounting and unmounting are thus start and stop actions on this unit:
    * systemctl start media-lumix\x2dphotos.mount
    * systemctl stop media-lumix\x2dphotos.mount

Turning bootstrap-time automatic startup on and off is simply a matter of enabling and disabling the specified requires relationship from local-fs.target:
    * systemctl enable media-lumix\x2dphotos.mount
    * systemctl disable media-lumix\x2dphotos.mount

One could even make an automount unit (which systemd-fstab-generator auto-generates when it sees "x-systemd.automount" in an /etc/fstab record):

    # /etc/systemd/system/media-lumix\x2dphotos.automount
    [Unit]
    Description=Automount unit for %N
    [Automount]
    Where=%N
    [Install]
    RequiredBy=local-fs.target


Reply to: