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

nixos-rebuild test (and switch) causes pam_mount to remount #44586

Closed
peterhoeg opened this issue Aug 7, 2018 · 11 comments · Fixed by #49896
Closed

nixos-rebuild test (and switch) causes pam_mount to remount #44586

peterhoeg opened this issue Aug 7, 2018 · 11 comments · Fixed by #49896
Assignees

Comments

@peterhoeg
Copy link
Member

Issue description

Within the last couple of weeks, doing nixos-rebuild test causes pam_mount to remount encrypted home directories and thus asking for passwords. This wasn't the case in the past.

Relevant output:

building '/nix/store/p6bflh7n5zy2dql8l45mix9qnzq65hbk-nixos-system-mildred-18.09.git.98592c5da79M.drv'...
activating the configuration...
setting up /etc...
reenter password for pam_mount:
(mount.c:68): Messages from underlying mount program:
(mount.c:72): crypt_activate_by_passphrase: File exists
(pam_mount.c:522): mount of /dev/mapper/vg0-lv_home_peter failed
kbuildsycoca5 running...

Steps to reproduce

  1. Set users.users.some_user.cryptHomeLuks = "/dev/mapper/some_lv";
  2. Execute nixos-rebuild test

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.17.11, NixOS, 18.09.git.98592c5da79M (Jellyfish)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.0.4
  • channels(root): "nixos-18.03pre121670.4cbbecc85db"
  • channels(peter): ""
  • nixpkgs: /home/peter/src/active/nixpkgs_unstable
@peterhoeg
Copy link
Member Author

Duplicate of #47577.

@peterhoeg peterhoeg reopened this Oct 4, 2018
@peterhoeg
Copy link
Member Author

This isn't actually a duplicate. With the fix in #47842, nixos-rebuild switch still prompts once (versus twice before) so must be another system.activationScript that causes this. This isn't critical though, just annoying.

@stale
Copy link

stale bot commented Jun 3, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 3, 2020
@peterhoeg
Copy link
Member Author

I've just patched it out locally, but this needs to be fixed properly.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 4, 2020
peterhoeg added a commit to peterhoeg/nixpkgs that referenced this issue Jun 10, 2020
nixos-rebuild test causes pam_mount to prompt for a password when running with
an encrypted home:

building '/nix/store/p6bflh7n5zy2dql8l45mix9qnzq65hbk-nixos-system-mildred-18.09.git.98592c5da79M.drv'...
activating the configuration...
setting up /etc...
reenter password for pam_mount:
(mount.c:68): Messages from underlying mount program:
(mount.c:72): crypt_activate_by_passphrase: File exists
(pam_mount.c:522): mount of /dev/mapper/vg0-lv_home_peter failed
kbuildsycoca5 running...

This change makes pam_mount not prompt. It still tries to remount (and fails in
the process) but that message can be ignored.

Fixes: NixOS#44586
@stale
Copy link

stale bot commented Dec 1, 2020

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 1, 2020
@peterhoeg peterhoeg removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Dec 2, 2020
@stale
Copy link

stale bot commented Jun 2, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 2, 2021
@peterhoeg
Copy link
Member Author

keep

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 3, 2021
peterhoeg added a commit that referenced this issue Oct 27, 2021
nixos-rebuild test causes pam_mount to prompt for a password when running with
an encrypted home:

building '/nix/store/p6bflh7n5zy2dql8l45mix9qnzq65hbk-nixos-system-mildred-18.09.git.98592c5da79M.drv'...
activating the configuration...
setting up /etc...
reenter password for pam_mount:
(mount.c:68): Messages from underlying mount program:
(mount.c:72): crypt_activate_by_passphrase: File exists
(pam_mount.c:522): mount of /dev/mapper/vg0-lv_home_peter failed
kbuildsycoca5 running...

This change makes pam_mount not prompt. It still tries to remount (and fails in
the process) but that message can be ignored.

Fixes: #44586
@Aleksanaa
Copy link
Member

Aleksanaa commented Jan 12, 2023

This issue reappleared in nixos unstable and it's the same as you described. And home manager is not working for me if pam mount is set, possibly because related problems. Any ideas? Or should I open a new issue?

@peterhoeg
Copy link
Member Author

So I have been carrying the mentioned patch on my side since this was first mentioned. I have a laptop running unstable with an encrypted home and so far there has been zero problems. Maybe you can share your nixos config?

@Aleksanaa
Copy link
Member

So I have been carrying the mentioned patch on my side since this was first mentioned. I have a laptop running unstable with an encrypted home and so far there has been zero problems. Maybe you can share your nixos config?

Do you still have these error indicating pam_mount tries to mount again (not remount):

(mount.c:68): Messages from underlying mount program:
(mount.c:72): Device _dev_nvme0n1p3 already exists.
(mount.c:72): crypt_activate_by_passphrase: File exists
(mount.c:72): Device _dev_nvme0n1p3 is still in use.

When running nixos-rebuild switch?

@peterhoeg
Copy link
Member Author

Yep, but it doesn't matter. The patch simply makes it not prompt for a password when the activation scripts tries to set up the mount, but as it's already there, you get the messages mentioned above, which is ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants