Acessing to /root folder on BeagleBone (Debian) after /usr directory was deleted - linux

I have had some .cpp programs in root directory of my BeagleBoneBlack (Debian). Due to a studpid accident a /usr directory was deleted on my BeagleBone. It make sense for me now, that I can not access the BeagleBone anymore. What I can do is to boot the BeagleBone from SSD-card, but of course I come in this case to another root directory. Do I still have chance to access my .cpp programs from old root directory? The most funniest thing in the story of my stupidness is that I didn't store .cpp programs somewhere else.
Thank you all in advance!

Yes, boot a regular SD-card image (make sure there is no "flasher" in the image name).
Once booted you can mount the eMMC and access your files. Something like this should do the job:
mount /dev/mmcblk1p2 /media
ls /media/root
Depending on what you have installed on the eMMC it may be a different partition (last digit) like mmcblk1p0 or mmcblk1p1.
You can then get the files from /media/root e.g. via SCP (winSCP if you are on Windows).

Related

system not booting after moving /usr directory

I run a Linux VM on VirtualBox and just made a mistake by moving the contents in /usr to a different partition mounted as /u01. My intention was to free up space for the / file system but realized I should have used cp instead of mv. It's not possible to run any command now. Is there any way I can recover the system?
Fixed by booting with iso image and mounting the root and restored the contents back to original partition.

Linux: Non-Executable Installation File

I've gotten a USB drive in which the installation files of MATLAB are found. I've tried executing the following command but none worked. Something is wrong. The file doesn't seem executable.
This is the file I need to execute:
-rw-r--r-- 1 user user 8360 Jul 19 03:29 install
I do:
sudo sh ./install
and get:
./install: 1: exec: /media/user/DPI/R2019b/bin/glnxa64/install_unix: Permission denied
I tried chmod +x install but it also doesn't work. The file cannot be turned into an executable one.
Is the file corrupt, or do I miss something?
Probably the USB drive is formatted by the manufacturer as FAT32 or similar. This file system doesn't support UNIX permissions.
That means you lose the permission information when you copy the files to a USB drive.
You have several options to fix this:
On a Linux/UNIX system create a .tar archive of the files, copy the archive onto the USB drive and unpack the archive to a UNIX compatible file system on the destination system. (This is a bit more work but allows to use the USB drive also on a Windows system.)
Format the USB drive as a UNIX compatible file system. (This might be the best solution if you plan to use the USB drive with Linux systems only. You can no longer use it on a Windows system except if you install special drivers.)
Copy all the files from the USB drive to a local drive on the destination system, which schould have a UNIX compatible file system, and try to fix the permissions manually. (I don't recommend this solution except if you cannot use the others, e.g. if you no longer have access to the original files.)

Beaglebone Angstrom: how to enable read only root file system

I am developing applications on Beaglebone board with Angstrom Linux distro.
I tend to mount root file system as read only because, it is not robust on readable/writeable configuration across power offs.
Can you make suggestions about how to mount root file system as read only?
What are the steps for mounting root file system read only and then turn it back to readable/writable?
With these step i tend to get a more robust file system.
Regards
You would need to edit the boot arguments that you pass to the kernel to use ro instead of rw for mounting the root file system. For example root=/dev/mmcblk0p1 ro. They are modifiable via the uboot environment variables
On a similar Angstrom-based system, I got the same "must specify the filesystem type" message.
After trying a few different things, I was able to remount root as ro using:
busybox mount -o remount,ro /
I have to admit I'm not certain why calling busybox directly worked when the "mount" command (which is a link to busybox) did not work, but I didn't have time to dig further.

Why does FHS have a usr directory

It appears you can put all you need in /bin so why do we bother with the /usr/bin directory?
/bin is supposed to reside on the root filesystem, whereas /usr may be an alternate filesystem - even network mounted (multiple boxes sharing the same /usr).
This means that any essential basic utilities you need to bring up the system and mount filesystems, including troubleshooting, should live in /bin. Everything non-essential can go in /usr.

Renaming/Mapping Cygwin Folders

Can I safely rename the cygdrive folder? Also, I would like to add other folders at root and map them to folders on windows in the same way as /cygdrive/c maps to my C drive. Is that possible?
Yes, you can. See The Cygwin Mount Table in Cygwin's documentation. I have my documents folder mounted as /doc. These mounts end up in the registry and are retained across reboots etc.
I wouldn't rename cygdrive as I don't know what that would do, but you can map other directories at root to various windows directories using the mount command.

Resources