mount kernel filesystems if run as pid1 #18
Conversation
* Mount devfs, sysfs and procfs * (optional and early draft): Basic fileio helper * depends on walkdir crate * only use syslog logger if not run as pid1 * Syslog requires unix sockets /dev/log or /var/run/syslog. * These sockets need to be set up first by auraed if we want to use them. Suggesting a discussion first.
In order to contribute to an Aurae project you must sign and agree to the CLA. |
@cla-bot check |
In order to contribute to an Aurae project you must sign and agree to the CLA. |
Rechecking your CLA permissions. Remember to add your GitHub username to the .clabot file. You can run |
@cla-bot check |
In order to contribute to an Aurae project you must sign and agree to the CLA. |
Rechecking your CLA permissions. Remember to add your GitHub username to the .clabot file. You can run |
In order to contribute to an Aurae project you must sign and agree to the CLA. |
@cla-bot check |
Rechecking your CLA permissions. Remember to add your GitHub username to the .clabot file. You can run |
src/system/init.rs
Outdated
@@ -0,0 +1,93 @@ | |||
use log::*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add the header please?
src/system/init.rs
Outdated
// To Discuss (TODO): | ||
// The "syslog" logger requires unix sockets. | ||
// Syslog assumes that either /dev/log or /var/run/syslog are available [1]. | ||
// We need to discuss if there is a use case to log via unix sockets, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general the project should support the ability to log to a unix socket, however this is a fine starting point for right now.
Opened #24 to track the work.
src/system/mod.rs
Outdated
std::process::id() | ||
} | ||
|
||
pub fn print_logo() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I love the logo! I already tweeted it! https://twitter.com/krisnova/status/1575274332665815044
Can we break this into 2 functions?
pub fn banner() -> String {
format!("...")
}
and a 2nd function that prints the output of the first?
pub fn print_logo() -> String {
println!("{}", banner())
}
I plan on using the banner in other places in the program eventually :)
src/system/init.rs
Outdated
|
||
mount_vfs("none", "/dev", "devtmpfs"); | ||
mount_vfs("none", "/sys", "sysfs"); | ||
mount_vfs("proc", "/proc", "proc"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds a bit crazy, however I have a use case for a system where procfs
is NOT mounted.
Is it possible to add a compile time flag or similar to run auraed
in an extremely risky experimental mode where procfs
is not mounted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! Will add a simple and fast solution to this PR. Maybe it makes sense to have the mount points configurable? Opened an issue here to discuss and track #25
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a noprocfs
kernel parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I was too optimistic that I can add this fast and simple. Added my comment to the discussion on discord.
I think this requires a second PR
src/system/fileio.rs
Outdated
@@ -0,0 +1,31 @@ | |||
use std::fs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggestion is to go ahead and merge this whenever you feel confident @Vincinator
You should be able to merge now. I will rebase #17 on top of your work, and I encourage you to iterate as you see best. If you would like to pick up more features in subsequent PRs please continue to work however is best for you.
Non blocker however I am wondering about the name |
My vote goes to naming it |
@kris-nova this PR is ready to be merged from my point of view |
6f1de32
to
35ecbc0
Compare
Note for myself. Configuration to remove |
Hi aurae community,
This PR adds first steps to make auraed boot as pid1, mainly mounting the kernel filesystems (devfs, procfs and sysfs), but also some minor fixes to make auraed boot without kernel panic.
hack/hack.mk
forzsh
users/var/run/syslog
)/dev
,/sys
or/proc
/sys/class/net/
to see available network interfacesToDo:
How to test
Steps to run auraed as pid in a qemu vm are documented in the hack/README.md. Copy pasted them here:
Links
[1] https://docs.rs/syslog/latest/src/syslog/lib.rs.html#232-243