Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

no-os install requires root login #279

Closed
sedlund opened this issue Feb 10, 2024 · 3 comments · Fixed by #293
Closed

no-os install requires root login #279

sedlund opened this issue Feb 10, 2024 · 3 comments · Fixed by #293

Comments

@sedlund
Copy link
Contributor

sedlund commented Feb 10, 2024

I am installing NixOS with a booted installer CD this document mentions it can be done as nixos user that is present on the installer cd.

password in order to access it. To set a password for the `nixos` user, run the

but I received these errors:

+ wipefs --all -f /dev/xvda1
wipefs: error: /dev/xvda1: probing initialization failed: Permission denied
+ wipefs --all -f /dev/xvda2
wipefs: error: /dev/xvda2: probing initialization failed: Permission denied
+ wipefs --all -f /dev/xvda3
wipefs: error: /dev/xvda3: probing initialization failed: Permission denied
++ zdb -l /dev/xvda
++ sed -nr 's/ +name: '\''(.*)'\''/\1/p'
+ zpool=
+ [[ -n '' ]]
+ unset zpool
++ lsblk /dev/xvda -l -p -o type,name
++ awk 'match($1,"raid.*") {print $2}'
+ md_dev=
+ [[ -n '' ]]
+ wipefs --all -f /dev/xvda
wipefs: error: /dev/xvda: probing initialization failed: Permission denied
+ dd if=/dev/zero of=/dev/xvda bs=440 count=1
dd: failed to open '/dev/xvda': Permission denied
++ mktemp -d
+ disko_devices_dir=/tmp/tmp.FR9K6lAylU
+ trap 'rm -rf "$disko_devices_dir"' EXIT
+ mkdir -p /tmp/tmp.FR9K6lAylU
+ device=/dev/xvda
+ imageSize=2G
+ name=disk1
+ type=disk
+ device=/dev/xvda
+ efiGptPartitionFirst=1
+ type=gpt
+ sgdisk --align-end --new=1:0:+1M --change-name=1:disk-disk1-space --typecode=1:EF02 /dev/xvda
Problem opening /dev/xvda for reading! Error is 13.
You must run this program as root or use sudo!

I'd be happy to update the no-os doc to reflect that root is required. Or if you'd like to double check that sudo is being called in the appropriate places in the code.

Let me know

@ralpheichelberger
Copy link

I found this to be the case too. Works fine as long as root login on SSH is allowed including password auth is allowed or an entry in the authorized_users for the installing machine exists on the target host. All of that is not available on a Ubuntu Life-CD for example. With Nixos installer it's a peace of cake though.

@sedlund
Copy link
Contributor Author

sedlund commented Mar 9, 2024

I wonder if this

ssh_ "$disko_script"

needs to be:

ssh_ "${maybe_sudo}" "$disko_script"

@ibizaman
Copy link

ibizaman commented Mar 28, 2024

@sedlund not exactly. It should be something like this because the sudo must happen after sshing in the box.

ssh_ sh <<SSH
set -efu ${enable_debug}
$maybe_sudo rm -rf /root/kexec
$maybe_sudo mkdir -p /root/kexec
SSH

EDIT: Actually I was wrong, well, the snippet I showed works but in my case I had encryption enabled with a passphrase but the script failed when asking for the passphrase. With your version it works.

EDIT2: The linked PR fixes this issues, for me at least 🎉

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

Successfully merging a pull request may close this issue.

3 participants