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

systemd-tmpfiles returns status 73 #680

Open
AFI4711 opened this issue Oct 18, 2023 · 11 comments
Open

systemd-tmpfiles returns status 73 #680

AFI4711 opened this issue Oct 18, 2023 · 11 comments

Comments

@AFI4711
Copy link

AFI4711 commented Oct 18, 2023

Error

Error: 
   0: Install failure
   1: Error executing action
   2: Action `configure_init_service` errored
   3: Failed to execute command with status 73 `"systemd-tmpfiles" "--create" "--prefix=/nix/var/nix"`, stdout: 
      stderr: 

Metadata

key value
version 0.13.1
os linux
arch x86_64
@grahamc
Copy link
Member

grahamc commented Oct 18, 2023 via email

@AFI4711
Copy link
Author

AFI4711 commented Oct 18, 2023

Yes of course:

Linux B360M 5.4.0-164-generic #181-Ubuntu SMP Fri Sep 1 13:41:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

`systemctl --version 
systemd 245 (245.4-4ubuntu3.22)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid
`

cat /etc/os-release:

NAME="Linux Mint"
VERSION="20.3 (Una)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 20.3"
VERSION_ID="20.3"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.linuxmint.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=una
UBUNTU_CODENAME=focal


The whole protocol:

`curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
info: downloading installer https://install.determinate.systems/nix/tag/v0.13.1/nix-installer-x86_64-linux
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
[sudo] Passwort für andi:          
Nix install plan (v0.13.1)
Planner: linux (with default settings)

Planned actions:
* Create directory `/nix`
* Fetch `https://releases.nixos.org/nix/nix-2.18.1/nix-2.18.1-x86_64-linux.tar.xz` to `/nix/temp-install-dir`
* Create a directory tree in `/nix`
* Move the downloaded Nix into `/nix`
* Create build users (UID 30000-30032) and group (GID 30000)
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
* Configure the shell profiles
* Configure Nix daemon related settings with systemd
* Remove directory `/nix/temp-install-dir`


Proceed? ([Y]es/[n]o/[e]xplain): Y
 INFO Step: Create directory `/nix`
 INFO Step: Provision Nix
 INFO Step: Create build users (UID 30000-30032) and group (GID 30000)
 INFO Step: Configure Nix
 INFO Step: Create directory `/etc/tmpfiles.d`
 INFO Step: Configure Nix daemon related settings with systemd
ERROR 
   0: Install failure
   1: Error executing action
   2: Action `configure_init_service` errored
   3: Failed to execute command with status 73 `"systemd-tmpfiles" "--create" "--prefix=/nix/var/nix"`, stdout: 
      stderr: 
   3: 

Location:
   /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/convert/mod.rs:716

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Consider reporting this error using this URL: https://github.com/DeterminateSystems/nix-installer/issues/new?title=%3Cautogenerated-issue%3E&body=%23%23+Error%0A%60%60%60%0AError%3A+%0A+++0%3A+Install+failure%0A+++1%3A+Error+executing+action%0A+++2%3A+Action+%60configure_init_service%60+errored%0A+++3%3A+Failed+to+execute+command+with+status+73+%60%22systemd-tmpfiles%22+%22--create%22+%22--prefix%3D%2Fnix%2Fvar%2Fnix%22%60%2C+stdout%3A+%0A++++++stderr%3A+%0A%0A%60%60%60%0A%0A%23%23+Metadata%0A%7Ckey%7Cvalue%7C%0A%7C--%7C--%7C%0A%7C**version**%7C0.13.1%7C%0A%7C**os**%7Clinux%7C%0A%7C**arch**%7Cx86_64%7C%0A
Installation failure, offering to revert...
Nix uninstall plan (v0.13.1)

Planner: linux (with default settings)

Planned actions:
* Unconfigure Nix daemon related settings with systemd
* Remove the directory `/etc/tmpfiles.d` if no other contents exists
* Unconfigure the shell profiles
* Remove the Nix configuration in `/etc/nix/nix.conf`
* Unset the default Nix profile
* Remove Nix users and group
* Remove the directory tree in `/nix`
* Remove the directory `/nix`


Proceed? ([Y]es/[n]o/[e]xplain): Y
 INFO Revert: Remove directory `/nix/temp-install-dir`
 INFO Revert: Configure Nix daemon related settings with systemd
 INFO Revert: Create directory `/etc/tmpfiles.d`
 INFO Revert: Configure Nix
 INFO Revert: Create build users (UID 30000-30032) and group (GID 30000)
 INFO Revert: Provision Nix
 INFO Revert: Create directory `/nix`
Partial Nix install was uninstalled successfully!
`
Whate else do you need?

@AFI4711
Copy link
Author

AFI4711 commented Oct 18, 2023

1 entry in syslog:

Oct 18 13:10:52 B360M systemd-tmpfiles[60066]: Detected unsafe path transition / → /nix during canonicalization of /nix/var/nix.

@AFI4711
Copy link
Author

AFI4711 commented Oct 18, 2023

Success on a newer system:

Linux B360M 5.15.0-86-generic #96-Ubuntu SMP Wed Sep 20 08:23:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

cat /etc/os-release 
NAME="Linux Mint"
VERSION="21.2 (Victoria)"
ID=linuxmint
ID_LIKE="ubuntu debian"
PRETTY_NAME="Linux Mint 21.2"
VERSION_ID="21.2"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.linuxmint.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=victoria
UBUNTU_CODENAME=jammy

systemctl --version
systemd 249 (249.11-0ubuntu3.10)
+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY -P11KIT -QRENCODE +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified
`

`curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
info: downloading installer https://install.determinate.systems/nix/tag/v0.13.1/nix-installer-x86_64-linux
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
[sudo] Passwort für andi:          
Nix install plan (v0.13.1)
Planner: linux (with default settings)

Planned actions:
* Create directory `/nix`
* Fetch `https://releases.nixos.org/nix/nix-2.18.1/nix-2.18.1-x86_64-linux.tar.xz` to `/nix/temp-install-dir`
* Create a directory tree in `/nix`
* Move the downloaded Nix into `/nix`
* Create build users (UID 30000-30032) and group (GID 30000)
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
* Configure the shell profiles
* Configure Nix daemon related settings with systemd
* Remove directory `/nix/temp-install-dir`


Proceed? ([Y]es/[n]o/[e]xplain): Y
 INFO Step: Create directory `/nix`
 INFO Step: Provision Nix
 INFO Step: Create build users (UID 30000-30032) and group (GID 30000)
 INFO Step: Configure Nix
 INFO Step: Create directory `/etc/tmpfiles.d`
 INFO Step: Configure Nix daemon related settings with systemd
 INFO Step: Remove directory `/nix/temp-install-dir`
Nix was installed successfully!
To get started using Nix, open a new shell or run `. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh`

Thus it seems to be a problem with systemd?

@Hoverbear
Copy link
Contributor

Reading: https://www.freedesktop.org/software/systemd/man/latest/systemd-tmpfiles-setup.service.html

On success, 0 is returned. If the configuration was syntactically invalid (syntax errors, missing arguments, …), so some lines had to be ignored, but no other errors occurred, 65 is returned (EX_DATAERR from /usr/include/sysexits.h). If the configuration was syntactically valid, but could not be executed (lack of permissions, creation of files in missing directories, invalid contents when writing to /sys/ values, …), 73 is returned (EX_CANTCREAT from /usr/include/sysexits.h). Otherwise, 1 is returned (EXIT_FAILURE from /usr/include/stdlib.h).

So it seems to be that your systemd-tmpfiles either didn't have the correct permissions or directories expected to exist did not exist.

That would suggest either /nix/var/nix, /nix/var, or /nix did not exist (which they should at that point), or that for some reason the installer couldn't write to them...

@Hoverbear Hoverbear changed the title <autogenerated-issue> systemd-tmpfiles returns status 73 Oct 24, 2023
@AFI4711
Copy link
Author

AFI4711 commented Oct 25, 2023

All 3 directories exists and have write access (for root):

ls -al /nix/
insgesamt 9836
drwxr-xr-x  5 root root       4096 Okt 25 13:01 .
drwxr-xr-x 23 andi andi       4096 Okt 25 13:00 ..
-rwxr-xr-x  1 root root   10015256 Okt 25 13:01 nix-installer
-rw-r--r--  1 root root      29764 Okt 25 13:01 receipt.json
drwxrwxr-t 51 root nixbld     4096 Okt 25 13:01 store
drwxr-xr-x  3 root root       4096 Okt 25 13:00 temp-install-dir
drwxr-xr-x  4 root root       4096 Okt 25 13:00 var

ls -al /nix/var/nix/
insgesamt 32
drwxr-xr-x 8 root root 4096 Okt 25 13:01 .
drwxr-xr-x 4 root root 4096 Okt 25 13:00 ..
drwxr-xr-x 2 root root 4096 Okt 25 13:00 daemon-socket
drwxr-xr-x 2 root root 4096 Okt 25 13:01 db
-rw------- 1 root root    0 Okt 25 13:01 gc.lock
drwxr-xr-x 4 root root 4096 Okt 25 13:01 gcroots
drwxr-xr-x 3 root root 4096 Okt 25 13:01 profiles
drwxr-xr-x 2 root root 4096 Okt 25 13:01 temproots
drwxr-xr-x 2 root root 4096 Okt 25 13:01 userpool

ls -al /nix/temp-install-dir/nix-2.18.1-x86_64-linux/
insgesamt 124
drwxr-xr-x 3 root root  4096 Okt 25 13:00 .
drwxr-xr-x 3 root root  4096 Okt 25 13:00 ..
-rwxr-xr-x 1 root root 32687 Jan  1  1970 create-darwin-volume.sh
-rwxr-xr-x 1 root root  9348 Jan  1  1970 install
-rwxr-xr-x 1 root root  6705 Jan  1  1970 install-darwin-multi-user.sh
-rwxr-xr-x 1 root root 30955 Jan  1  1970 install-multi-user
-rwxr-xr-x 1 root root  5478 Jan  1  1970 install-systemd-multi-user.sh
-rw-r--r-- 1 root root 18120 Jan  1  1970 .reginfo
drwxr-xr-x 2 root root  4096 Okt 25 13:00 store

Since the nix-installer invoked [sudo]. the access attributes seems OK, isn't it?

Another test generates the same error:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix > install

sudo bash install install

@AFI4711
Copy link
Author

AFI4711 commented Oct 25, 2023

Nevertheless thank your for the detailed answer.

I will check the man page: https://www.freedesktop.org/software/systemd/man/latest/systemd-tmpfiles-setup.service.html

But I have no idea how to change the permissions during the installation process?

The check of the daemon config seems fine:

ll /etc/tmpfiles.d/
insgesamt 24
drwxr-xr-x   2 root root  4096 Okt 25 13:25 .
drwxr-xr-x 169 root root 12288 Okt 25 13:25 ..
lrwxrwxrwx   1 root root    60 Okt 25 13:25 nix-daemon.conf -> /nix/var/nix/profiles/default/lib/tmpfiles.d/nix-daemon.conf

ll /nix/var/nix/profiles/default/lib/tmpfiles.d/nix-daemon.conf
-r-xr-xr-x 1 root root 48 Jan  1  1970 /nix/var/nix/profiles/default/lib/tmpfiles.d/nix-daemon.conf

@Hoverbear
Copy link
Contributor

Indeed we run as root so getting permissions errors like this is quite unexpected.

@srid
Copy link
Contributor

srid commented Oct 1, 2024

@roman-bodavskiy has faced the same issue on his Linux Mint as well.

@randlega
Copy link

randlega commented Oct 16, 2024

I just hit this issue and came across this thread.

I first tried ./nix-installer install

Which gave me the following (after successfully elevating to root):

 INFO nix-installer v0.27.0
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
 INFO nix-installer v0.27.0
Nix install plan (v0.27.0)
Planner: linux (with default settings)

Planned actions:
* Extract the bundled Nix (originally from /nix/store/0xf66gpzcg4924nkfz7cn4ynqrxcfglq-nix-binary-tarball-2.24.9/nix-2.24.9-x86_64-linux.tar.xz)
* Create a directory tree in `/nix`
* Move the downloaded Nix into `/nix`
* Create build users (UID 30001-30032) and group (GID 30000)
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
* Configure the shell profiles
* Configure upstream Nix daemon service
* Remove directory `/nix/temp-install-dir`


Proceed? ([Y]es/[n]o/[e]xplain): y
 INFO Step: Create directory `/nix`
 INFO Step: Provision Nix
 INFO Step: Create build users (UID 30001-30032) and group (GID 30000)
 INFO Step: Configure Nix
 INFO Step: Create directory `/etc/tmpfiles.d`
 INFO Step: Configure upstream Nix daemon service
ERROR
   0: Install failure
   1: Error executing action
   2: Action `create_upstream_init_service` errored
   3: Action `configure_init_service` errored
   4: Failed to execute command with status 73 `"systemd-tmpfiles" "--create" "--prefix=/nix/var/nix"`, stdout:
      stderr:
   4:

...snipped...
Installation failure, offering to revert...
Nix uninstall plan (v0.27.0)

Planner: linux (with default settings)

Planned actions:
* Remove upstream Nix daemon service
* Remove the directory `/etc/tmpfiles.d` if no other contents exists
* Unconfigure the shell profiles
* Remove the Nix configuration in `/etc/nix/nix.conf`
* Unset the default Nix profile
* Remove Nix users and group
* Remove the directory tree in `/nix`
* Remove the directory `/nix`


Proceed? ([Y]es/[n]o/[e]xplain): y
 INFO Revert: Remove directory `/nix/temp-install-dir`
 INFO Revert: Configure upstream Nix daemon service
 INFO Revert: Create directory `/etc/tmpfiles.d`
 INFO Revert: Configure Nix
 INFO Revert: Create build users (UID 30001-30032) and group (GID 30000)
 INFO Revert: Provision Nix
 INFO Revert: Create directory `/nix`
Partial Nix install was uninstalled successfully!

I allowed the automatic cleanup to happen and then retried with sudo ./nix-installer install and the installer completed successfully. I'm not sure if the automatic cleanup helped, or if there is a difference in the escalation mechanism, but here's another data point.

EDIT: Adding machine details:

version 0.27.0
os linux (Ubuntu 20.04)
arch x86_64

@AFI4711 AFI4711 closed this as completed Oct 20, 2024
@AFI4711 AFI4711 reopened this Oct 20, 2024
@AFI4711
Copy link
Author

AFI4711 commented Oct 20, 2024

I repeated the same tests (using v0.27.0) on Mint 20.3:

  1. curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
  2. sudo ./nix-installer.sh install

Same error:

sudo ./nix-installer.sh install
info: downloading installer https://install.determinate.systems/nix/tag/v0.27.0/nix-installer-x86_64-linux
 INFO nix-installer v0.27.0
Nix install plan (v0.27.0)
Planner: linux (with default settings)

Planned actions:
* Create directory `/nix`
* Extract the bundled Nix (originally from /nix/store/0xf66gpzcg4924nkfz7cn4ynqrxcfglq-nix-binary-tarball-2.24.9/nix-2.24.9-x86_64-linux.tar.xz)
* Create a directory tree in `/nix`
* Move the downloaded Nix into `/nix`
* Create build users (UID 30001-30032) and group (GID 30000)
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
* Configure the shell profiles
* Configure upstream Nix daemon service
* Remove directory `/nix/temp-install-dir`


Proceed? ([Y]es/[n]o/[e]xplain): Y
 INFO Step: Create directory `/nix`
 INFO Step: Provision Nix
 INFO Step: Create build users (UID 30001-30032) and group (GID 30000)
 INFO Step: Configure Nix
 INFO Step: Create directory `/etc/tmpfiles.d`
 INFO Step: Configure upstream Nix daemon service
ERROR
   0: Install failure
   1: Error executing action
   2: Action `create_upstream_init_service` errored
   3: Action `configure_init_service` errored
   4: Failed to execute command with status 73 `"systemd-tmpfiles" "--create" "--prefix=/nix/var/nix"`, stdout:
      stderr:
   4:

Location:
   src/cli/subcommand/install.rs:253

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

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

No branches or pull requests

5 participants