Re: Problem with setup-storage

2024-02-07 Diskussionsfäden Rémy Dernat
Hi,

I don't know if this is really related, but as I also said on IRC,
`checkdisk` returns an empty string. All the functions depending on it
are also returning an empty string. I tried to modify it manually in
subroutines with the following content, but it did not help either:

```bash
checkdisk() {

# read lines with device name and size and check if device is a disk
# $1 can be a device name that will be ignored. Used for the device
# name of the USB stick if we boot from it
local igndev=('loop') #devices to ignore
igndev+=($1)
local isdisk
ls /dev | while read device blocks; do
isdisk=1
# old way of detecting disks: [ $(cat
/sys/block/$device/removable) -eq 1 ] && isdisk=0
[ $(stat -c %G /dev/$device) = "disk" ] || isdisk=0

# if set, ignore these devices
[[ "${igndev[@]}" =~ ${device}* ]] && isdisk=0
if [ $isdisk -eq 1 ]; then
echo "$device"
fi
done
}
```

here is the content of `fai-disk-info`:

```bash
#! /bin/bash

set_bootstick
all_disks_and_size | checkdisk $FAI_BOOTSTICK | once_only
```

That is really odd, because when I checked that modified version of
`checkdisk` locally, it works on my local machine. Moreover, I am able
to see disk devices in /dev when dracut spawn a shell terminal. I
don't know why it does not work in the dracut chroot mounted space
system; maybe a `sh` vs a `bash` issue although the subroutine calls
directly `/bin/bash` .. O_o ... All files in /usr/lib/fai/ are set in
755 mode, with owner and group root.

I am currently stuck with some machines unable to install because of
this issue...

Best regards,
Rémy

Le mar. 6 févr. 2024 à 15:59, Stephen Quinney via linux-fai
 a écrit :
>
> Diese Nachricht wurde eingewickelt um DMARC-kompatibel zu sein. Die
> eigentliche Nachricht steht dadurch in einem Anhang.
>
> This message was wrapped to be DMARC compliant. The actual message
> text is therefore in an attachment.
>
>
> -- Forwarded message --
> From: Stephen Quinney 
> To: linux-fai 
> Cc:
> Bcc:
> Date: Tue, 6 Feb 2024 14:59:08 +
> Subject: Problem with setup-storage
> I'm using the packages from Debian unstable so I reported this to the
> Debian bug tracker first but then thought that it might be better done
> through the mailing list.
>
> We use the setup-storage utility in a standalone manner in our local
> installation and configuration scripts with the rest of FAI. Up until
> 6.2 this worked just fine but now it fails.
>
> This seems to be related to changes in the fai-disk-info script.
>
> With 6.0 I get:
>
> /usr/lib/fai/fai-disk-info
> sda
>
> and with 6.2 I now get:
>
> /usr/lib/fai/fai-disk-info
> bash: set_bootstick: command not found
> bash: once_only: command not found
> bash: all_disks_and_size: command not found
> bash: checkdisk: command not found
>
> At first I thought it was down to not having the fai-client package
> installed (it's not listed as a dependency for fai-setup-storage)
> since it provides the /usr/lib/fai/subroutines. However, installing
> that package hasn't helped.
>
> Any help would be appreciated.
>
> Regards,
>
> Stephen Quinney


Re: Problem with setup-storage

2024-02-07 Diskussionsfäden Thomas Lange
Hi Remy,

it seems you hit bug https://bugs.debian.org/1063146.
I'm preparing a patch and will upload a new FAI version if it's ready.

But this bug should only appear, if you use setup-storage as a
standalone command. Inside the FAI environment everything should work.
It's not clear to me in which kind of environment you have problems.

-- 
regards Thomas


Re: Problem with setup-storage

2024-02-07 Diskussionsfäden pa...@kish.by
Hi Thomas,
Also FAI 6.2 have problem with setup-storage when we use mdadm+lvm
I wrote later about it



> 7 февр. 2024 г., в 11:53, Thomas Lange  написал(а):
> 
> I'm preparing a patch and will upload a new FAI version if it's ready.



Re: Problem with setup-storage

2024-02-07 Diskussionsfäden Rémy Dernat
Hi Thomas,

I will wait for the patch, because, yes, I have this bug.

I do not know exactly what is going on, but I can send you, for
example, some of my logs privately with privatebin. We can keep in
touch on IRC about that.

TYVM,
Best

Le mer. 7 févr. 2024 à 10:01, pa...@kish.by  a écrit :
>
> Hi Thomas,
> Also FAI 6.2 have problem with setup-storage when we use mdadm+lvm
> I wrote later about it
>
>
>
> 7 февр. 2024 г., в 11:53, Thomas Lange  написал(а):
>
> I'm preparing a patch and will upload a new FAI version if it's ready.
>
>


Subject: Re:Re: Problem with setup-storage

2024-02-07 Diskussionsfäden Axel Lodyga

Hy there,
as I struggled with all those Problems the last 24 hours since I’ve updated to 
6.2 I figured some out some stuff:
first of all, the  subroutines seams not to be loaded by the .profile file in 
nfsroot/root/.profile
I changed it from
. /usr/lib/fai/subroutines
To
source /usr/lib/fai/subroutines
That fixed the command not found issue
and regarding the disks are not detected.
At least in my environment it was:
all subs in /dev have group root. So the detection method for group “disk” in 
subroutines->checkdisk() function wont work.
I switched it back to the one, in the comment (line above in the file) wich 
checks for /removeable and its working now.

Hopefully that helps a bit.
--
Mit freundlichen Grüßen / Best regards

Axel Lodyga


Re: Problem with setup-storage

2024-02-07 Diskussionsfäden Thomas Lange
Here's the patch

https://github.com/faiproject/fai/commit/cd33235318279a96267d3377661dbeba93eacac3

-- 
viele Grüße Thomas


Subject: Re:Re: Problem with setup-storage

2024-02-07 Diskussionsfäden Thomas Lange
Hi all,

other people also have this problem (disks under /dev are not
in group disk but root). I wonder if you have checked /etc/fai/NFSROOT
after upgrading to FAI 6.2. Make sure this line is removed and
recreate the nfsroot.

sysvinit-core systemd-sysv-

It was used with FAI 6.0.x because we did not used systemd inside the
nfsroot. FAI 6.2 now ships an /etc/fai/NFSROOT which will install
systemd that's used nowadays. I hope that this is the cause of your
wrong group ownership for /dev.

Concerning setup-storage, I wonder if it is really broken inside the
FAI boot environment. FAI should define the functions needed for
setup-storage before calling setup-storage.

There may be still problems when you log in via ssh into the FAI
environment and call setup-storage. Then the functions needed are not
defined. A patch is already applied and will be available in the next
FAI version. See

https://github.com/faiproject/fai/compare/eb8f779aa4c69157d448..cd33235318279a962

-- 
viele Grüße Thomas