Hi!

I would just like to know is there a way you can overwrite the main.c file in the kernel folder(dir /usr/src/kernel/main.c) in MINIX 3. I want to change some code in the file(I know the risks involved) but the problem is I can't save it. I've tried logging in as 'bin' and 'root' and still the same issue.

Is there another way of doing this?

Thanks-and any help will be appreciated! :D

Dani AI

Generated

If you cannot save a file even when logged in as root, the usual cause is that the system is running from the Minix installer image (CD/ISO) or the root tree is mounted read‑only. That makes the /usr tree effectively non‑writable until you install Minix onto a writable disk or virtual disk. This is the common behaviour described in the Minix installation docs. (minix3.org)

Quick, repeatable checks you can run from the Minix shell (these show whether the device is read‑only and what the file permissions are):

whoami
mount
ls -l /usr/src/kernel/main.c
cat /etc/fstab

Look for a mount line showing the root or /usr mounted “ro” or pointing at a CD/ISO device; inspect the ls -l output for owner and mode. The standard mount flags and the chmod/ls workflow are covered in the mount and chmod documentation. (manpages.debian.org)

If mount shows the tree on a CD/ISO (or you deliberately booted from the ISO in VirtualBox), create and install to a writable virtual hard disk and boot the installed system instead of the live image. In VirtualBox this means adding/creating a virtual hard disk and installing Minix from the ISO; do not run only the ISO session if you need to edit source files. (virtualbox.org)

Once you can write to /usr/src, edit main.c and then rebuild/install the system so your kernel changes take effect. From the source tree you typically do:

su
cd /usr/src
make build
cd /usr/src/releasetools
make hdboot

Follow the Minix build/rebuild guide and read /usr/src/docs/UPDATING if the build needs extra steps. Always backup sources/configs before changing kernel code. (wiki.minix3.org)

(Notes: — your “vi + root” tests are exactly the right diagnostic steps; — checking permissions is useful, but if root can’t write the problem is almost always a read‑only mount or live ISO environment.)

Recommended Answers

All 2 Replies

What are you using for an editor? Have you modified the file and directory permissions so you can save a new version of the file?

I'm using the VI editor. I'm not sure how to modify the permissions but I'll take a look into it thanks!

After struggling like this I took an alternative root and reinstalled+redownloaded minix and the virtualbox which seemed to fix the problem for now. Hopefully it stays like this

But Thanks for the feedback!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.