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

Shutdown error unmounting /rw/home #2708

Open
Rudd-O opened this Issue Mar 16, 2017 · 12 comments

Comments

Projects
None yet
4 participants
@Rudd-O

Rudd-O commented Mar 16, 2017

Qubes OS version R3.2

Affected TemplateVMs:

fedora-24
fedora-24-minimal

Mount option for /rw/home should not be noauto. It should be auto. Otherwise systemd will assume it is a mount that was mounted by the user/operator, attempt to unmount it too early, and this will almost always fail because applications will still be running and holding files in /rw/home open.

It is not a problem to change the option since those file systems are mounted manually anyway.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Mar 16, 2017

Member

AFAIK changing to auto is a problem, because systemd will attempt to mount it earlier, when it may not be populated (on fresh VM startup) yet. And also there are cases when we don't want to mount it at all (DispVM).

Member

marmarek commented Mar 16, 2017

AFAIK changing to auto is a problem, because systemd will attempt to mount it earlier, when it may not be populated (on fresh VM startup) yet. And also there are cases when we don't want to mount it at all (DispVM).

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Mar 16, 2017

Member

If it's about ordering during shutdown, probably some ordering options should be added, instead of touching auto/noauto.

Member

marmarek commented Mar 16, 2017

If it's about ordering during shutdown, probably some ordering options should be added, instead of touching auto/noauto.

@adrelanos

This comment has been minimized.

Show comment
Hide comment
@adrelanos

adrelanos Mar 16, 2017

Member
Member

adrelanos commented Mar 16, 2017

@Rudd-O

This comment has been minimized.

Show comment
Hide comment
@Rudd-O

Rudd-O Mar 17, 2017

Rudd-O commented Mar 17, 2017

@Rudd-O

This comment has been minimized.

Show comment
Hide comment
@Rudd-O

Rudd-O Mar 17, 2017

Rudd-O commented Mar 17, 2017

@Rudd-O

This comment has been minimized.

Show comment
Hide comment
@Rudd-O

Rudd-O Mar 17, 2017

Qubes-mount-dirs.service:

[Unit]
Description=Initialize and mount /rw and /home
# There is a dependency on dev-xvdb.device because
# mount-dirs.sh calls setup-rwdev.sh which
# must happen only when /dev/xvdb has appeared.
After=qubes-sysinit.service dev-xvdb.device
DefaultDependencies=no
Before=local-fs.target rw.mount home.mount qubes-gui-agent.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/qubes/init/mount-dirs.sh
# There is no need for an ExecStop because systemd
# cleans up mount units in the right order, killing
# processes as needed.

[Install]
WantedBy=multi-user.target

See the Before=rw.mount and the Before=home.mount?

That means systemd will always execute the script before the mount points are mounted, thus mounting /home and /rw the way we like it, rather than letting systemd do it.

Rudd-O commented Mar 17, 2017

Qubes-mount-dirs.service:

[Unit]
Description=Initialize and mount /rw and /home
# There is a dependency on dev-xvdb.device because
# mount-dirs.sh calls setup-rwdev.sh which
# must happen only when /dev/xvdb has appeared.
After=qubes-sysinit.service dev-xvdb.device
DefaultDependencies=no
Before=local-fs.target rw.mount home.mount qubes-gui-agent.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/qubes/init/mount-dirs.sh
# There is no need for an ExecStop because systemd
# cleans up mount units in the right order, killing
# processes as needed.

[Install]
WantedBy=multi-user.target

See the Before=rw.mount and the Before=home.mount?

That means systemd will always execute the script before the mount points are mounted, thus mounting /home and /rw the way we like it, rather than letting systemd do it.

@Rudd-O

This comment has been minimized.

Show comment
Hide comment
@Rudd-O

Rudd-O Mar 17, 2017

By the way, I tried it. I can also confirm that changing to auto fixes the problem of unmounting /rw cleanly.

Rudd-O commented Mar 17, 2017

By the way, I tried it. I can also confirm that changing to auto fixes the problem of unmounting /rw cleanly.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Mar 17, 2017

Member

What about the cases of not mounting /home at all (DispVM)? In that case, adding auto would make /home mounted anyway, effectively breaking DispVMs.

Member

marmarek commented Mar 17, 2017

What about the cases of not mounting /home at all (DispVM)? In that case, adding auto would make /home mounted anyway, effectively breaking DispVMs.

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Mar 17, 2017

Member

Maybe that could be fixed by adding appropriate ConditionPathExists= to rw.mount and home.mount using drop-ins files (after dropping noauto)?

Member

marmarek commented Mar 17, 2017

Maybe that could be fixed by adding appropriate ConditionPathExists= to rw.mount and home.mount using drop-ins files (after dropping noauto)?

@Rudd-O

This comment has been minimized.

Show comment
Hide comment
@Rudd-O

Rudd-O Mar 18, 2017

Rudd-O commented Mar 18, 2017

@marmarek

This comment has been minimized.

Show comment
Hide comment
@marmarek

marmarek Mar 18, 2017

Member
Member

marmarek commented Mar 18, 2017

@Rudd-O

This comment has been minimized.

Show comment
Hide comment
@Rudd-O

Rudd-O Mar 19, 2017

Rudd-O commented Mar 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment