LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-26-2023, 12:03 PM   #1
cocsx
LQ Newbie
 
Registered: Apr 2023
Posts: 4

Rep: Reputation: 0
I want to create a minimal ISO with dependencies for running Docker.


I started compiling the kernel from linux from scratch, after that, with busybox (after i added the binaries like dockerd, containerd, ..., all iptables ecc) i created a simple initramfs.

I added the docker static binaries and they works, but they need deps like iptables and git, so next thing i did is compiling iptables and placing it inside the busybox folder.

(I did compiled iptables with --enable-static flag but it didn't work, the library is not static)

After all this i made an ISO file and started it with qemu, the system work i can access the shell but when i call iptables the system gives me this error:
"sh: iptables not found".

If you have any ideas of what is the problem could you help me, thanks in advance.

Last edited by cocsx; 04-26-2023 at 12:05 PM.
 
Old 04-26-2023, 03:11 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,667

Rep: Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710
Quote:
Originally Posted by cocsx View Post
I started compiling the kernel from linux from scratch, after that, with busybox (after i added the binaries like dockerd, containerd, ..., all iptables ecc) i created a simple initramfs.

I added the docker static binaries and they works, but they need deps like iptables and git, so next thing i did is compiling iptables and placing it inside the busybox folder.

(I did compiled iptables with --enable-static flag but it didn't work, the library is not static)

After all this i made an ISO file and started it with qemu, the system work i can access the shell but when i call iptables the system gives me this error:
"sh: iptables not found".

If you have any ideas of what is the problem could you help me, thanks in advance.
Did you verify that the library is in the library path?

Did you verify that the executable is in the executable path ($PATH)?

Did you read the build and install instructions in the iptable source package?
 
Old 04-26-2023, 03:30 PM   #3
cocsx
LQ Newbie
 
Registered: Apr 2023
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by wpeckham View Post
Did you verify that the library is in the library path?

Did you verify that the executable is in the executable path ($PATH)?

Did you read the build and install instructions in the iptable source package?
Yeah i verified that the library was in the path. The system give me the error even if a call the executable directly like "/usr/sbin/iptables" and yes i read the instructions but im very little experienced.

Do you know if i can build and how i can build iptables statically???
 
Old 04-26-2023, 04:17 PM   #4
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,667

Rep: Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710
Quote:
Originally Posted by cocsx View Post
Yeah i verified that the library was in the path. The system give me the error even if a call the executable directly like "/usr/sbin/iptables" and yes i read the instructions but im very little experienced.

Do you know if i can build and how i can build iptables statically???
It is a bit non-trivial.
My take would be to start with Debian network install and go from there, but only because I am LAZY!

You might want to read up on how the Linux From Scratch builds are done.

Modern iptables uses a kernel module, and the kernel module and runtime must pretty much match (or at least agree close enough). This might be as simple as: did you compile that module and install it, and did you start it before the iptables call?

If you need a firewall, you must consider that it WILL have to tie into the kernel networking structure at some point. There may be a different tool that would serve that works in a different way, but it may be less efficient.
 
Old 04-26-2023, 04:45 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,996

Rep: Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628Reputation: 3628
User permission for iptables like in whoami.

Making a live media like that will be quite a task. How do you manage storage? Fuse or something like aufs?
 
Old 04-27-2023, 02:12 AM   #6
cocsx
LQ Newbie
 
Registered: Apr 2023
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jefro View Post
User permission for iptables like in whoami.

Making a live media like that will be quite a task. How do you manage storage? Fuse or something like aufs?
The permission are right.

The only thing it has to do is running docker with a specific kernel version.

Simply i create an iso with the command "grub-mkrescue -o myiso.iso iso/", the iso folder has this file structure:
iso
├── boot
│** ├── bzImage
│** └── initramfs
└── grub
└── grub

The initramfs is created using busybox like in this tutorial https://medium.com/@kiky.tokamuro/cr...s-5cca9b524b5a.
(To busybox i only added the binaries that i need, like docker and iptables (which does not work)).

Im asking if i can create a static binary for iptables
 
Old 04-27-2023, 02:21 AM   #7
cocsx
LQ Newbie
 
Registered: Apr 2023
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by wpeckham View Post
It is a bit non-trivial.
My take would be to start with Debian network install and go from there, but only because I am LAZY!
I could use a starting point like Debian network install but im doing this only for learning purpose and i want to do it from scratch.

Quote:
Originally Posted by wpeckham View Post
You might want to read up on how the Linux From Scratch builds are done.

Modern iptables uses a kernel module, and the kernel module and runtime must pretty much match (or at least agree close enough). This might be as simple as: did you compile that module and install it, and did you start it before the iptables call?
In theory i did compile the module when i compiled the kernel and made the kernel have that module loaded from default.

Maybe im wrong can you tell me what the module name is?? They should be the one i listed down here right?[*] Networking support ---> [CONFIG_NET]
Networking Options --->[*] Network packet filtering framework (Netfilter) ---> [CONFIG_NETFILTER][*] Advanced netfilter configuration [CONFIG_NETFILTER_ADVANCED]
Core Netfilter Configuration --->
<*> Netfilter connection tracking support [CONFIG_NF_CONNTRACK]
<*> Netfilter Xtables support (required for ip_tables) [CONFIG_NETFILTER_XTABLES]
<*> LOG target support [CONFIG_NETFILTER_XT_TARGET_LOG]
IP: Netfilter Configuration --->
<*> IP tables support (required for filtering/masq/NAT) [CONFIG_IP_NF_IPTABLES]
(I want the iso to be as small as possible)
 
Old 04-27-2023, 12:50 PM   #8
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,667

Rep: Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710
Quote:
Originally Posted by cocsx View Post
I could use a starting point like Debian network install but im doing this only for learning purpose and i want to do it from scratch.



In theory i did compile the module when i compiled the kernel and made the kernel have that module loaded from default.

Maybe im wrong can you tell me what the module name is?? They should be the one i listed down here right?[*] Networking support ---> [CONFIG_NET]
Networking Options --->[*] Network packet filtering framework (Netfilter) ---> [CONFIG_NETFILTER][*] Advanced netfilter configuration [CONFIG_NETFILTER_ADVANCED]
Core Netfilter Configuration --->
<*> Netfilter connection tracking support [CONFIG_NF_CONNTRACK]
<*> Netfilter Xtables support (required for ip_tables) [CONFIG_NETFILTER_XTABLES]
<*> LOG target support [CONFIG_NETFILTER_XT_TARGET_LOG]
IP: Netfilter Configuration --->
<*> IP tables support (required for filtering/masq/NAT) [CONFIG_IP_NF_IPTABLES]
(I want the iso to be as small as possible)
Cannot answer that. I built a lot of kernels, but stopped at about 2.4 and things have changed a LOT since then! My hope is that someone who builds kernels often will chime in with current information.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Difference between docker.io, docker-cd, and Docker Desktop LXer Syndicated Linux News 0 08-15-2022 05:39 PM
[SOLVED] Docker on -Current error: "Is docker daemon running?" Tsuga Slackware 6 01-05-2022 11:11 AM
LXer: Create & manage docker hosts with Docker Machine on VirtualBox LXer Syndicated Linux News 0 11-28-2017 02:33 AM
LXer: Red Hat partners with Docker to create Linux/Docker software stack LXer Syndicated Linux News 0 03-12-2015 05:54 PM
Does anyone Know how to open either .iso.rz or these .iso.xdelta,.iso.bz2,.iso.lzma?? maximalred Debian 5 06-09-2004 06:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 11:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration