this post was submitted on 11 Jan 2025
21 points (95.7% liked)

Linux

48954 readers
720 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Hi,

I'm trying to encrypt the root filesystem / of a raspberry pi 4 device running under Devuan rpi ( custom kernel )

I'm following LUKS on Raspberry Pi 2021 guide

That explain step by step how achieve this.

But the guide use initramfs and my distro seem to use initrd

So the question, is: should I migrate to initramfs ? and how check whats is inside my current initrd

or keep-up with initrd but then how insert the necessary to enable LUKS drive to be mounted by it ( initrd ) ?

Thanks.

all 15 comments
sorted by: hot top controversial new old
[–] SpongeB0B@programming.dev 1 points 18 hours ago

Thank you very much all, for your inputs !

I've did

root: file /boot/broadcom/initrd.gz
initrd.gz: Zstandard compressed data ....

root: unmkinitramfs /boot/broadcom/initrd.gz Extracted/
# data where extracted to Extracted/
# but I go few error like:
# cpio: cannot link usr/sbin/vconfig to usr/sbin/watchdog: Operation not permitted

tree -Fan -L 2 Extracted

Extracted//
|-- conf/
|   |-- arch.conf*
|   |-- conf.d/
|   `-- initramfs.conf*
|-- etc/
|   |-- fstab*
|   |-- ld.so.cache*
|   |-- ld.so.conf*
|   |-- ld.so.conf.d/
|   |-- modprobe.d/
|   `-- udev/
|-- init*
|-- run/
|-- scripts/
|   |-- functions*
|   |-- init-bottom/
|   |-- init-top/
|   |-- local*
|   |-- local-bottom/
|   |-- local-premount/
|   `-- nfs*
`-- usr/
    |-- bin/
    |-- lib/
    `-- sbin/

So it tend to confirm that even if the file is named initrd.gz it's actually an initramfs method.... ( damn this is so misleading )

So I guess I can follow preparing-linux from the guide and overwrite the initrd.gz ?

[–] gnuhaut@lemmy.ml 3 points 1 day ago* (last edited 21 hours ago) (1 children)

So, firstly, about the nomenclature: initrd (initial ram disk) and initramfs (initial ram file system) are usually used interchangeably as far as I know. For example, even though my Debian uses initramfs-tools, the generated images are called /boot/initrd.img-*. (Edit: There is a technical difference but an initramfs may be referred to as an initrd (like in this case) due to how similar they are.)

For example, when installing a kernel, apt shows this output on my Debian machine:

linux-image-6.12.6-amd64 (6.12.6-1) wird eingerichtet ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-6.12.6-amd64

What you're talking about is probably the software used to generate this initial ramdisk, which on Debian is done using initramfs-tools (which contains the mkinitramfs command), while on other distros dracut (command: mkinitrd) might be used.

I will say it strikes me as weird that Devuan doesn't use initramfs-tools since it's a Debian derivative. Maybe you are mistaken about this? Possibly no initrd/initramfs is used at all on this specific Pi version of Devuan? IDK.

Edit: See my other comment. I'm wrong. There is an actual technical difference between initrd and initramfs, but I don't think that's actually relevant in this situation. Or rather, both are functionally the same, so it doesn't really matter from the perspective of the user or distro that there's a difference. I will keep the rest of the comment as is, since I do reckon OP's problem is unrelated to this difference, and that probably something else is tripping up OP.

[–] user_naa@lemmy.world 2 points 1 day ago

Yes, seems like Devuan also use update-initramfs (discussion link) as expected. So I think process will be similar to upstream Debian.

[–] user_naa@lemmy.world -1 points 1 day ago (1 children)

AFAIK initramfs is the same thing as initrd. But do you have update-initramfs command available?

[–] ShortN0te@lemmy.ml 2 points 1 day ago (1 children)

Nope, both do the same thing but they are not the same thing.

[–] user_naa@lemmy.world 0 points 1 day ago (1 children)

If so what is the difference?

[–] ShortN0te@lemmy.ml 1 points 1 day ago (2 children)

That they are 2 different tools. Here

[–] user_naa@lemmy.world 1 points 23 hours ago* (last edited 23 hours ago) (1 children)

Also systemd says I am using initrd (on my Fedora machine)

systemd[1]: Running in initrd.

But I have initramfs packed with dracut in /boot folder

/boot/initramfs-6.12.8-200.fc41.x86_64.img
[–] ShortN0te@lemmy.ml 3 points 22 hours ago (2 children)

Initramfs and initrd are 2 different things, the problem where the confusion happens is that initrd is deprecated since a few years.

Now, systemd has implemented an interface called systemd-initrd which basically is initramfs.

I guess here is were the confusion lies. Nowadays everything is initramfs even if it called initrd.

The original initrd differs from initramfs, but it is no longer a thing.

Sorry if i came across a little bit snappy have not had a great week so far.

[–] user_naa@lemmy.world 2 points 7 hours ago

Everything is fine. It's always nice to learn something new. Hope you will have better week!

[–] gnuhaut@lemmy.ml 2 points 21 hours ago* (last edited 21 hours ago) (1 children)

Edit: You are right. I looked it up:

There seems to be an actual technical difference, in the kernel, between an initrd and an initramfs. An initrd is apparently mounted like a normal file system, it's just in RAM instead of a backed by a block device. An initramfs is a tmpfs into which a (usually cpio) archive is extracted into. The initramfs apparently would be preferable generally, because the kernel understands that it's a ramdisk, whereas with an initrd it would go through the block device layer, which would mean it would use more ram: If you read a file from an initrd, the kernel would copy the file to ram (unnecessarily, since it's already in ram) like it would for a filesystem on disk, but for a tmpfs/initramfs, it understands it doesn't need to do that.

From a user's perspective there is no significant functional difference I don't think, and I don't think this relevant to OP's question, that probably has more to do with the userspace tools.

[–] ShortN0te@lemmy.ml 2 points 21 hours ago (1 children)

https://en.m.wikipedia.org/wiki/Initial_ramdisk

In Linux systems, initrd (initial ramdisk) is a scheme for loading a temporary root file system into memory, to be used as part of the Linux startup process. initrd and initramfs (from INITial RAM File System) refer to two different methods of achieving this. Both are commonly used to make preparations before the real root file system can be mounted.

As i said 2 different things, initrd was used to create a ramdisk, a block device. Initramfs basically directly offers a filesystem instead of a block device.

systemd has now a interface called systemd-initrd: https://github.com/systemd/systemd/blob/main/docs/INITRD_INTERFACE.md

initrd was deprecated see here: https://lkml.org/lkml/2020/7/14/1508

[–] gnuhaut@lemmy.ml 2 points 21 hours ago* (last edited 21 hours ago)

Yes, sorry, you are correct. I've edited my other comments.

[–] user_naa@lemmy.world 1 points 1 day ago* (last edited 1 day ago) (1 children)

Based on first result

We can use initrd for Linux kernels 2.4 and lower. Conversely, initramfs is for kernels 2.6 and above.

Since on all modern system initial filesystem is tmpfs sometimes it is confused and initramfs is called initrd (for example: in grub to load initramfs you use initrd command).