ADMIN shell access: Unable to create and initialize directory '/nonexistent'. Permission denied

Hello,
after updating from SCALE 24.04 to SCALE ElectricEel-24.10-RC.2, I was presented with the notification to upgrade my pool because new feature flags are available for it.
Going to System>Shell I received this prompt:

Linux TrueNAS-SM 6.6.44-production+truenas #1 SMP PREEMPT_DYNAMIC Fri Oct 4 00:43:02 UTC 2024 x86_64

    TrueNAS (c) 2009-2024, iXsystems, Inc.
    All rights reserved.
    TrueNAS code is released under the LGPLv3 and GPLv3 licenses with some
    source files copyrighted by (c) iXsystems, Inc. All other components
    are released under their own respective licenses.

    For more information, documentation, help or support, go here:
    http://truenas.com

Welcome to FreeNAS
Last login: Mon Oct 7 15:10:00 CEST 2024 on pts/1
Creating directory ‘/nonexistent’.
Unable to create and initialize directory ‘/nonexistent’.

Permission denied

I was not able to change the home directory for user admin using the GUI. So I logged in via ssh and with sudo I changed the admin home directory in /etc/passwd.
I was then able to access the shell via GUI and I upgraded my pool. After a reboot the changes made in /etc/passwd were not there anymore and accessing the shell by the GUI was again not possible.
How to make those changes permanent? Do I have to delete and create a new admin user?
This installation comes from several updates during last year and it is not a fresh one where admin use is created by default.

How can I solve this issue?

Let me know if you need any further information.
Thanks!

What version of 24.04 did you upgrade to 24.10 from? If you had previously upgraded to 24.04.1 or later, TrueNAS should have automatically migrated the home directory from /nonexistent to /var/empty. It’s strange that you ended up in that position if you followed the recommended upgrade path from the last maintenance version.

It’s expected that changes made via the shell might not survive update, so you’d want to make them using the UI. Creating a new admin in 24.10 is something we generally recommend for security purposes (not using default credentials) so that would be a good workaround for this. Then you can simply disable password login for the default account.

You could also potentially try modifying the admin home directory in the UI again after changing it in shell, but I’m not sure if that would work.

What is the error you are seeing here?

Generally speaking, if you want to provide a particular user shell access it will need:

  1. a valid shell
  2. a valid home directory

This isn’t a unique truenas requirement. There was a bug in which this accidentally worked prior to dragonfish because pam_mkhomedir would actually create the /nonexistent directory. This is no longer possible because the root filesystem is readonly.

I went through all the updates, 24.04.0> 24.04.1> 24.04.1.1> 24.04.2> 24.04.2.1> 24.04.2.2> 24.10-RC.1 and now 24.10-RC.2.
I have tried to modifying the admin home directory in the UI again after changing it in shell, but it was not possible.
I have just verified and unfortunately I cannot delete admin user, even if it appears to be a no built-in user and neither if I’m logged is as root.

No error, it is just greyed out and I cannot edit those fields to point to the existing /home/admin directory. The strange thing is that when i do the temporary changes via ssh as root, I am able to login as admin and to execute any sudo command. Probably the solution would be to reinstall TrueNAS from scratch.

Strange, I’d expect it to have previously migrated your admin user home directory then.

Right, I had forgotten but I believe that is expected behavior for a default admin user.

You do not need to delete the admin user. Just create a new administrator account and use that to log in. See:

1 Like

I realize this post is incredible old, but I wanted to thank DjP-iX for the quick fix. I ran into a similar issue (but not with the builtin admin).

What version of 24.04 did you upgrade to 24.10 from? If you had previously upgraded to 24.04.1 or later, TrueNAS should have automatically migrated the home directory from /nonexistent to /var/empty. It’s strange that you ended up in that position if you followed the recommended upgrade path from the last maintenance version.
Specifically what did it for me was I restored a 24.04 backup to a system running 25.04. (I also wasn’t paying attention to support because personal, not business.)