37

There are several possibilities, all depending on the exact parameters of your situation right now. I'm going to assume Linux in the following examples where applicable, but similar functionality exists on other platforms in most cases. You might be able to get the dynamic loader to run an executable for you. Assuming cat is dynamically-linked, your ...


31

That entirely depends on what services you want to have on your device. Programs You can make Linux boot directly into a shell. It isn't very useful in production — who'd just want to have a shell sitting there — but it's useful as an intervention mechanism when you have an interactive bootloader: pass init=/bin/sh to the kernel command line. All Linux ...


18

When the boot loader calls the kernel it passes it a parameter called root. So once the kernel finished initializing it will continue by mounting the given root partition to / and then calling /sbin/init (unless this has been overriden by other parameters). Then the init process starts the rest of the system by loading all services that are defined to be ...


16

According to The Open Group's published standard, the only required directories are: / /dev, which contains console, null, and tty /tmp, guaranteed writable but not necessarily preserved. The Linux Foundation maintains a Filesystem Hierarchy Standard (FHS) which extends this to include the directories you will typically see on a Linux system: /bin: ...


13

In 10.1 Directory Structure and Files, POSIX lists directories which must exist. But it specifies no limit on the number of other directories which can exist at the root-level of a filesystem. For that matter, it does not appear to place limits on the size of other directories. POSIX's attention in this area is focused on commonality rather than ...


12

First of all the hassle with encrypted root and early userspace is typically already handled by your distribution (as far as i know Fedora, Debian, Ubuntu and OpenSUSE support encrypted root out of the box). That means you don't have to care for the setup itself. One reason for encrypting / is just to be sure you don't leak any information at all. Think ...


12

/tmp can be considered as a typical directory in most cases. You can recreate it, give it to root (chown root:root /tmp) and set 1777 permissions on it so that everyone can use it (chmod 1777 /tmp). This operation will be even more important if your /tmp is on a separate partition (which makes it a mount point). By the way, since many programs rely on ...


11

Different modules behave differently when you provide the same option multiple times. I know you can say console= multiple times, and you get multiple consoles (we use it for machines with main consoles on both their framebuffers and serial port). However, you can only have one root partition, so root= almost certainly overwrites the previous value seen, ...


11

New answer (2015-03-22) (Note: This answer is simpler than previous, but not more secure. My first answer is stronger because you could keep files read-only by fs mount options before permission flags. So forcing to write a files without permission to write won't work at all.) Yes, under Debian, there is a package: fsprotect (homepage). It use aufs (by ...


10

/etc, /var, and /tmp come to mind. All can potentially have sensitive contents. All can be given separate volumes, but it's common for each of these to be on the same filesystem as the root directory. Maybe you've moved one or more off into their own volumes, but have you moved them all? /etc contains: hashed passwords; possibly multiple sorts, such as /...


10

Mounting or remounting a filesystem is done using the mount(2) syscall. When remounting, this takes the target location (the mountpoint), the flags to be used in the mount operation, and any extra data used for the specific filesystem involved. When remounting read-only, the flags used are MS_RDONLY and MS_REMOUNT; you're also supposed to provide any other ...


9

This is a system with SELinux, so you should certainly keep .autorelabel. Delete null and 1. The .autorelabel file is used most often when switching from a disabled (permissive) SELinux to an enabled (enforcing) SELinux configuration. It can also be used to correct mistakes made with SELinux when the mistakes were not made a permanent part of the SELinux ...


8

Yes, see for instance how to boot a VM with the FS of the host: Add the 9p modules to the host initramfs (that's the easiest way albeit not the cleanest, to have an initrd with the needed modules): printf '%s\n' 9p 9pnet 9pnet_virtio | sudo tee -a /etc/initramfs-tools/modules sudo update-initramfs -u qemu -kernel "/boot/vmlinuz-$(uname -r)" \ -initrd "/...


8

To understand what every file is responsible for you should understand how MPU starts up. As I understood from your qestion you use NXP (Freescale) i.MX microprocessor family. It includes small ROM loader, which will make basic system setup (interfaces to memory, clock tree etc.), search for media to boot from (based on burned OTP bits or GPIO), find ...


8

There is no limitation to the number of entries in a directory, either in POSIX or in typical Unix implementations. There may be an indirect limit for the number of subdirectories, which is the maximum hard link count (each subdirectory's .. entry is a hard link to the directory); that's 216 for many common filesystems, which limits a directory to 65533 ...


7

It's pretty straight forward, although we should distinguish between "driver" and "module". A driver may or may not be a module. If it is not, then it is built into the kernel loaded by the bootloader. If it is a module, then it is in a filesystem hierarchy rooted at /lib/modules/[kernel-release].1 Note that it is possible to boot a kernel together with ...


7

The official reference for this on Linux is the Filesystem Hierarchy Standard. Distributions mostly follow the FHS (currently at version 3.0), but can occasionally deviate. Other Unix variants have many similarities but again can deviate. There is also a good summary on Wikipedia. I'll summarize the role of each directory that is found on typical Linux ...


6

It is given at boot time by your bootloader, for example Grub. To see with which arguments your kernel was started, do this: $ cat /proc/cmdline For me, this ouputs: BOOT_IMAGE=/vmlinuz-3.5.0-13-generic root=/dev/mapper/crypt-precise--root ro So the initrd/initramfs will try to mount my /dev/mapper/crypt-precise--root (encrypted LVM) logical volume as /....


6

SquashFS is a read-only file system. https://en.wikipedia.org/wiki/SquashFS You could create a new filesystem and copy the contents of the squashfs to that. To do that, you need to: Backup your data from the old filesystem Start from a Live-CD/USB Make a new Filesystem on /dev/mtdblock3 Copy your data to the new filesystem Instead of booting from a Live-...


5

You should be able to log in as root, because usually a percentage of the partition's size is reserved in order to always enable root login for rescue operations and such. See this U&L Q&A: Reserved space for root on a filesystem - why? What you won't be able to do, however, is log in as a regular user from your display manager then switch to root ...


5

All you need is one statically linked executable, placed on the filesystem, in isolation. You do not need any other files. That executable is the init process. It can be busybox. That gives you a shell and a host of other utilities, all in itself. You can go to a fully functioning system just by executing commands manually in busybox to mount the root ...


5

The problem appears to be that rEFInd isn't automatically creating the refind_linux.conf file in the /boot directory. From step 4 of the "EFI Stub Loader Support Technical Details" from the rEFInd documentation: rEFInd looks for a file called refind_linux.conf in the same directory as the kernel file. It consists of a series of lines, each of which ...


5

It may be that Endless OS is not the right tool to be able to accomplish what you want. From the Endless OS Developer page, Endless OS Not your typical Linux distribution. We don’t use rpm, apt, or any other packaging system. We use a read-only root file system managed by OSTree with application bundles overlaid on top. We have a different target ...


4

Linux provide many partitioning tools to re-size or shrink the partition that also without any data loss,It is possible to resize a partition using Gparted in a easy and a convenient way.As its a opensource and free download. To modify the partition with Gparted, it has to be downloaded then burned into a blank CD. This CD will be used as a bootable CD in ...


4

In case somebody has the same problem: All I needed was to move the mount point of the host file system to a place outside the root file system in the shutdown script (that's fine, because it runs in a tmpfs pivot root) before any unmounting takes place: mount --move /oldroot/run/initramfs/host /host This allows /oldroot to unmount cleanly. The host file ...


4

Another reason is preventing tampering the filesystem. Once encrypted, it is much more complicated to do anything that could bite you on the next boot, e.g. placing a rootkit on your filesystem (be it by booting a live CD or moving the hdd to another machine temporarily). Your kernel (and initrd) are still vulnerable, but that can be alleviated by using ...


4

If you do not need any shell utilities, a statically linked mksh binary (e.g. against klibc – 130K on Linux/i386) will do. You need a /linuxrc or /init or /sbin/init script that just calls mksh -l -T!/dev/tty1 in a loop: #!/bin/mksh while true; do /bin/mksh -l -T!/dev/tty1 done The -T!$tty option is a recent addition to mksh that tells it to spawn a ...


4

As the kernel documentation states, /dev/nfs is not a real device but only a hint to the kernel to use NFS as rootfs. You'll also have to tell the kernel where to find this root through the nfsroot parameter or a properly set up DHCP daemon. For the latter one to work you'll also have to either configure your kernel to auto-configure its network ...


4

The directory /tmp must have the permissions 1777 = rwxrwxrwt, i.e. everybody can read, write and access files in the directory, and (t = sticky bit) files may only be deleted by their owner. A lot of things will stop working if this isn't the case, sometimes in bizarre ways. sudo mkdir -m 1777 /tmp or sudo mkdir /tmp && sudo chmod 1777 /tmp /tmp ...


Only top voted, non community-wiki answers of a minimum length are eligible