You are not logged in.

#1 2019-01-29 19:34:47

blochl
Member
Registered: 2018-08-31
Posts: 77

[Solved] Get netctl, wifi-menu in initramfs

Hi,

I'm building an initramfs that one can boot into and get a command line. I know that mkinitcpio has the net hook, for adding the necessary modules for a network device. However, according to the mkinitcpio wiki, it is implemented only for busybox init, and not for systemd init.
The final goal is to have the wifi-menu command in the initramfs, to enable choosing and configuring (temporary, obviously) a WiFi network while in the initramfs. How would you suggest going about this?

Last edited by blochl (2019-02-05 14:33:06)

Offline

#2 2019-01-29 21:59:03

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: [Solved] Get netctl, wifi-menu in initramfs

Revisit the wiki you linked.
Try to understand what the net hook *actually* provides.
The see the section about adding binaries and files.

Offline

#3 2019-01-30 09:33:12

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,919

Re: [Solved] Get netctl, wifi-menu in initramfs

Biochi, I have the impression you want some kind of rescue environment and think an initramfs can provide that..

If so, check what an initramfs is supposed to achieve to determine whether its suitable for what you want.
https://wiki.archlinux.org/index.php/Ar … #initramfs is  a good start.

Last edited by Lone_Wolf (2019-01-30 09:33:33)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#4 2019-01-30 10:25:41

blochl
Member
Registered: 2018-08-31
Posts: 77

Re: [Solved] Get netctl, wifi-menu in initramfs

Thanks for your answers.

But still, I can't imagine how to incorporate a working wifi-menu in the initramfs. Can't be just "BINARIES=(wifi-menu)" can it?

Lone_Wolf wrote:

check what an initramfs is supposed to achieve to determine whether its suitable for what you want.

"The purpose of the initramfs is to bootstrap the system to the point where it can access the root filesystem" (from the wiki). My root filesystem happens to be on a remote server, and it needs to be downloaded to disk upon boot. Yes, strange scenario, I know, but still, it is what it is. smile

Offline

#5 2019-01-30 11:45:41

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,919

Re: [Solved] Get netctl, wifi-menu in initramfs

Not that strange, this sounds like a thin client setup possibly using Pre-boot Execution Environment or PXE .

https://wiki.archlinux.org/index.php/PXE focuses on booting using archiso and assumes a wired connection, but should give you an idea how archlinux can be used with a PXE boot.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#6 2019-01-30 13:52:30

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: [Solved] Get netctl, wifi-menu in initramfs

wifi-menu is  a script and will likely require more files to function properly, but yes - that's how you'd do it.
To be sure, this isn't a NFS remote boot, is it? (In which case the "net" hook would indeed be appropriate and I'd ask why you don't want to use the busybox init)

Offline

#7 2019-01-30 13:52:39

blochl
Member
Registered: 2018-08-31
Posts: 77

Re: [Solved] Get netctl, wifi-menu in initramfs

Lone_Wolf wrote:

Not that strange, this sounds like a thin client setup possibly using Pre-boot Execution Environment or PXE .

Thanks for the suggestion!! Indeed iPXE looks great for this (didn't think about it before) but it has to have a wired connection. It does support wireless, but it looks like it supports only a very limited range of wireless cards (the ones I have are not recognized by it).
So it's back to incorporating netctl/wifi-menu into initramfs. sad

Offline

#8 2019-01-30 14:00:16

blochl
Member
Registered: 2018-08-31
Posts: 77

Re: [Solved] Get netctl, wifi-menu in initramfs

seth wrote:

wifi-menu is  a script and will likely require more files to function properly, but yes - that's how you'd do it.
To be sure, this isn't a NFS remote boot, is it? (In which case the "net" hook would indeed be appropriate and I'd ask why you don't want to use the busybox init)

Thanks!
Will try different combinations...

Nope, it's not an NFS boot, it's not a boot from the network, but rather a download of the rootfs from the network to the local drive, and then boot from it.

I'd be glad to use busybox init, but I guess that systemd is needed for netctl, and thus for wifi-menu, to work. Is it?

Offline

#9 2019-01-31 10:33:41

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,919

Re: [Solved] Get netctl, wifi-menu in initramfs

netctl has a hard dependency on systemd (having it installed is not enough, systemd needs to be running as PID 1 ) .

I think your desired boot process goes something like this :

- boot a minimal system A
- establish wireless connection
- download rootfs for full system B
- reboot to B

Currently you're trying to make A in an initramfs environment.

I think you're better off by creating a minimal arch installation with only the packages needed and automate the reboot .
If this minimal arch only needs to work on specific hardware you could even get rid of the initramfs by creating a custom kernel with every module needed built-in .

In other words :
initramfs purpose and limitations make it hard to achieve what you want.
A custom boot environment seems a better approach.

Last edited by Lone_Wolf (2019-01-31 11:07:49)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#10 2019-01-31 11:04:33

blochl
Member
Registered: 2018-08-31
Posts: 77

Re: [Solved] Get netctl, wifi-menu in initramfs

Lone_Wolf wrote:

netctl has a hard dependency on systemd (having it installed is not enough, systemd needs to be running as PID 1 ) .

I think your desired boot process goes something like this :

- boot a minimal system A
- establish wireless connection
- download rootfs for full system B
- reboot to B

Currently you're trying to make A in an initramfs environment.

I think you're better off by creating a minimal arch installation with only the packages needed and automate the reboot .
If this minimal arch only needs to work on specific hardware you could even get rid of the initramfs by creating a custom kernel with every module needed built-in .

In other words :
initramfs purpose and limitations make it hard to achieve what you want.
A custom boot environment seems a better approach.

- The kernel module for your wireless card/dongle needs to be active

- the wireless

Yes, my desired boot process is exactly as you described. The only problem is that the place I have for this minimal OS is <40MB. So that's why I want to make it all in the initramfs. But if I choose systemd based initramfs, systemd will run as PID 1, no? Trying that right now...

Offline

#11 2019-02-05 14:31:20

blochl
Member
Registered: 2018-08-31
Posts: 77

Re: [Solved] Get netctl, wifi-menu in initramfs

OK, I solved my problem in the following way:

(No systemd, no netctl, and no net hook needed)

* Add "stty", "iw", "wpa_supplicant", "wpa_passphrase", and "dhcpcd" to "BINARIES". (Some of these may be redundant for the general case)
* Add the needed drivers for the network cards in "MODULES". (In the near future I will just change the "base" or the "udev" hooks to include some general set of network card drivers)
* Include some shell scripts (also in "BINARIES") which do what I want to be done - configure the network, wired/wireless, ask for the wireless password, etc...

Very simple, actually!

Thanks for your help!

Last edited by blochl (2019-02-05 14:32:01)

Offline

Board footer

Powered by FluxBB