Why bind to LiveCD /proc before building initramfs ?


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Why bind to LiveCD /proc before building initramfs ?
# 1  
Old 08-07-2017
Blade Why bind to LiveCD /proc before building initramfs ?

Imagine I have an unbootable system where I need to update the kernel image using
Code:
update-initramfs

.

I have seen numerous examples online which show the following

Code:
$ mount -t proc none /mnt/ubuntu/proc
$ mount -o bind /dev /mnt/ubuntu/dev
$ mount -o bind /sys /mnt/ubuntu/sys

After that we chroot into the broken OS and then execute the command to update the initramfs.

My questions are as follows-:
  1. Are we binding the /proc and /dev of the Live CD to the broken system ? Or are we binding the /proc and /dev of the broken system to the live cd ?
  2. If building the initramfs is dependent on the information of the OS for which the initramfs is built then won't it contain erroneous information if we build for the Live CD ? That is use the /proc and /dev of the LiveCD ?

Last edited by rbatte1; 08-07-2017 at 09:47 AM.. Reason: Tidied up numbered list
# 2  
Old 08-07-2017
Quote:
1 Are we binding the /proc and /dev of the Live CD to the broken system ? Or are we binding the /proc and /dev of the broken system to the live cd ?
Neither. The Live CD booted from has no writable media so is useless for doing any real work. So a 'proc' filesystem is created in memory, and system directories on the booted Live CD are mapped (bind) into memory.

Last edited by hicksd8; 08-07-2017 at 10:24 AM..
# 3  
Old 08-07-2017
Quote:
Originally Posted by hicksd8
Neither. The Live CD booted from has no writable media so is useless for doing any real work. So a 'proc' filesystem is created in memory, and system directories on the booted Live CD are mapped (bind) into memory.
Any idea what the answer will be for my second question ? I am really stumped with that one.
# 4  
Old 08-07-2017
Technically, the 'initramfs' on the 'Live CD' should contain ALL common drivers and load modules needed for commonly found hardware and therefore should run on your box (unless you loaded third-party driver(s) at install time). Therefore, once up and running, the O/S recovery function can probe your hardware and check that the required drivers are installed and uncorrupted. The recovery function should/probably/hopefully only check for the really required drivers for your platform.
# 5  
Old 08-07-2017
Quote:
Originally Posted by hicksd8
Technically, the 'initramfs' on the 'Live CD' should contain ALL common drivers and load modules needed for commonly found hardware and therefore should run on your box (unless you loaded third-party driver(s) at install time). Therefore, once up and running, the O/S recovery function can probe your hardware and check that the required drivers are installed and uncorrupted. The recovery function should/probably/hopefully only check for the really required drivers for your platform.
So let me get this straight. What you are saying is that 90% percent of the using the /proc and /dev of the LiveCd will not cause any problems because they are very similar to the original system that I will boot into.

Am I correct in my assumption ?
# 6  
Old 08-08-2017
I think that I understand your question. The 'Live CD' contains all commonly required drivers but those drivers are only loaded if the hardware is actually present. The 'Live CD' is designed so that it can boot on almost all hardware without extra drivers.
# 7  
Old 08-08-2017
Quote:
Originally Posted by sreyan32
Imagine I have an unbootable system where I need to update the kernel image using
Code:
update-initramfs

.

I have seen numerous examples online which show the following

Code:
$ mount -t proc none /mnt/ubuntu/proc
$ mount -o bind /dev /mnt/ubuntu/dev
$ mount -o bind /sys /mnt/ubuntu/sys

After that we chroot into the broken OS and then execute the command to update the initramfs.

My questions are as follows-:
[LIST=1][*]Are we binding the /proc and /dev of the Live CD to the broken system ? Or are we binding the /proc and /dev of the broken system to the live cd ?
Neither. /dev and especially /proc are virtual filesystems, which don't show files but rather imaginary kernel things.

So they're neither livecd, nor your broken system, but something belonging to whatever kernel you're running.

These kernel / device interfaces are pretty hard for a system to do without.

Quote:
If building the initramfs is dependent on the information of the OS for which the initramfs is built then won't it contain erroneous information if we build for the Live CD ? That is use the /proc and /dev of the LiveCD ?
It doesn't so much archive them as use them.
These 2 Users Gave Thanks to Corona688 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Debian

Only have initramfs now...

Long story short, I had a ps3 with both Lenny and Sid repositories. Knowing this is a bad idea and that Lenny is being deprecated I decided I wanted to move everything to Sid. I changed my repos and ran apt-get-update, upgrade, dist-upgrade. Had one warning during the apt-get upgrade that... (0 Replies)
Discussion started by: Azrael
0 Replies

2. UNIX for Dummies Questions & Answers

LiveCD help

hey, I am build an operating system but i cant seem to get it to boot. I am using GRUB as the boot loader, but I'm not sure if I have all the files need, on the CD, to load the operating system. So can anyone tell me what files I need in order for GRUB to load my OS. P.S. The OS is neither... (1 Reply)
Discussion started by: neur0n
1 Replies

3. UNIX for Dummies Questions & Answers

_/proc/stat vs /proc/uptime

Hi, I am trying to calculate the CPU Usage by getting the difference between the idle time reported by /proc/stat at 2 different intervals. Now the 4th entry in the first line of /proc/stat will give me the 'idle time'. But I also came across /proc/uptime that gives me 2 entries : 1st one as the... (0 Replies)
Discussion started by: coderd
0 Replies

4. Linux

initramfs on 2.4 kernel

Is there a patch available to support initramfs on the 2.4 kernel? We can't upgrade to 2.6 for legacy purposes. All I found on google were early references to how initramfs is better than the 2.4 initrd. Thanks much! (0 Replies)
Discussion started by: amoeba
0 Replies

5. Debian

change initramfs by hand?

What's the correct way to change the initramfs file that's used during boot? I know that it's a gzipped cpio archive, but when I gunzip, extract, re-archive (without changing any files), and gzip, then the result is that the system does not boot any more. And I even set the cpio archive type. ... (18 Replies)
Discussion started by: frankie06
18 Replies

6. UNIX for Dummies Questions & Answers

Cannot log on to FreeBSD LiveCD

Hi, I just download FreeBSD LiveCD and burn it to the CDROM (Because I want to learn UNIX). But when I boot the computer from the CDROM, it display the username and password. I type "root" and the password blank. But it does not allow me to login. I try many user name and password that I guest but... (3 Replies)
Discussion started by: 012633023
3 Replies
Login or Register to Ask a Question