Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #73215

Re: recommended way to find out whether one is "within" the initramfs?

From Christoph Anton Mitterer <calestyo@scientia.net>
Newsgroups linux.debian.kernel
Subject Re: recommended way to find out whether one is "within" the initramfs?
Date 2021-10-07 02:00 +0200
Message-ID <D5oZj-60n-1@gated-at.bofh.it> (permalink)
References <D5huP-1sM-27@gated-at.bofh.it> <D5iqS-22h-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hey Romain.

Thanks for your ideas:

On Wed, 2021-10-06 at 18:49 +0200, Romain Perier wrote:
> Quickly, few ideas (perhaps not the perfect ones):
> 1. Check for what is currently mounted as "/" ? (which technically
> should differ between initramfs or real rootfs)

That sounds like a pretty nice idea.
I guess for the iniramfs it would be always:
  none / rootfs
?
Or maybe the "none" could be anything in theory.


> 2. Check if your binaries are running inside a klibc or busybox
> context (both are supported via an initramfs) ?
> 3. Check if systemd is running ? (so you have started userspace
> processes part of your real rootfs)
> 

These two seem IMO a bit less "stable"... people might not use systemd
(at least in derivates) and checking for the binaries sounds a bit
ugly.



So maybe I do a combination and check for several indicators:
/scripts, /conf/initramfs.conf (which seems to be always there, update-
initramfs fails if the main initramfs.conf is missing or empty) and the
fs-type of the / fs.


Thanks,
Chris.

Back to linux.debian.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

recommended way to find out whether one is "within" the initramfs? Christoph Anton Mitterer <calestyo@scientia.net> - 2021-10-06 18:00 +0200
  Re: recommended way to find out whether one is "within" the initramfs? Romain Perier <romain.perier@gmail.com> - 2021-10-06 19:00 +0200
    Re: recommended way to find out whether one is "within" the  initramfs? Christoph Anton Mitterer <calestyo@scientia.net> - 2021-10-07 02:00 +0200
      Re: recommended way to find out whether one is "within" the initramfs? Romain Perier <romain.perier@gmail.com> - 2021-10-07 12:40 +0200

csiph-web