Create directory "/dotenv" on MacOs, Read-only file system - node.js

I tried to create a directory under root (the directory when I open terminal)
sudo mkdir /dotenv
But the system says:
mkdir: /dotenv: Read-only file system
My OS is Catalina 10.15.2
Is there any way to create the dir? I need to run a node.js server locally which requires .env file in the /dotenv dir

You'll need to use mkdir dotenv if you are at your profile root (which it appears you are). That was the only way I could get it to work (I am on Catalina 10.15.3).
Using mkdir /dotenv (notice the /) I got the same error as you.
If you really want to, you can disable the read-only file system in Catalina by following these steps (which are also listed below).
Problem because of Read-only file system in mac os catalina
Boot you mac system into recovery mode. (by bootup system with holding CMD+R).
Open terminal (Present in "Utilities" in the top left menu).
Just run command
csrutil disable
Restart your system and Bootup normally
Before doing any activity open terminal and run command.
sudo mount -uw /
Once this all done you can do write in root location

Require the result in command: csrutil status
If result is enabled, you need to restart machine and press command + R, open the terminal in the recovery, so input csrutil diabled.
Restart, and check the status: csrutil status.
Here are two methods:
you are root.
sudo mount -uw /
so, you could mkdir or touch new file.
If you still can't read or write any, you maybe try this:
cd ~ # cd home directory
sudo vim /etc/synthetic.conf # create new file if this doesn't exist
In the conf files, add new line
dotenv /User/xx/dotenv # Notice: the space between this two strings is tab
Restart, and you will find a link named /dotenv in the root.

Related

How to install minishift in a customized directory in linux

While trying to start minishift, it automatically updates the cache in the home directory.
/home/abc/.minishift/cache/.....
However I want minishift to use a custom directory instead of the default home directory as I am running out of space
Can this be achieved by changing any parameters during ./minishift start
Tried codeready containers too, but it copies in the default home directory..
FATA Failed to copy embedded 'crc_libvirt_4.5.1.crcbundle' from /opt/data/crc-linux-1.13.0-amd64/crc to /home/abc/.crc/cache/crc_libvirt_4.5.1.crcbundle: write /home/abc/.crc/cache/crc_libvirt_4.5.1.crcbundle: no space left on device
I found the answer to this :
export MINISHIFT_HOME=/opt/softwares/
echo 'export MINISHIFT_HOME=/opt/softwares/' >> ~/.bashrc
This helped in solving the redirecting the installation from home to customized directory.
Similar for crc installation as well.
As noted, you should use Code Ready Containers (CRC) and not minishift. This is a known issue and is being tracked here: code-ready/crc/issues/817.
The current workaround seems to be to create the directory where you want it to be and then create a symlink to ~/.crc:
mkdir -p /opt/crc
ln -s /opt/crc/ ~/.crc

How can I make the directory writable, permanently, without having to run the command again?

I have a problem with making /dao permanently writable. I use this command:
chmod -R 777 /opt/project/newproject/target/scala-2.11/classes/dao
I am using Play-Framework. But when I run activator, the command delete the directory "dao" and create a new one.
I am working with Debian and trying start a bash file in Jenkins to create the Project on a Server

Ubuntu 13.10 , Golang build and run, the terminal display error bash: ./filename : Permission denied

I am trying to run Go's executable file after using command go build instead of typing go run filename.go.
I typed go build in the directory where the Golang source file resides. After the executable file had been created, I typed ./filename to run it. Then the terminal displayed a line :
bash : ./filename : Permission denied
I had tried to change the permission of the filename by typing :
chmod u+x filename
But this action doesn't give any effects. The permission denied error still occurs whenever I type ./filename.
Is there another way to build a Golang applications from source code, and then run it from executable file?
All things done well if I do this task in Windows command prompt, after typing go build, the filename.exe is created and there is no any problem when I run it by typing ./filename.exe.
NTFS and FAT have different permission models than Unix. This especially means that there is no executable flag on such a file system. Calling chmod a+x FILE is a no-op. Linux emulates classical Unix permissions on NTFS file systems by setting a mask for each file that contains the would-be permissions.
To fix these problemss, either move executables to a different file system or change the mount flags to use a permission mask that enables the executable-flag (for all files).

How to access share folder in virtualbox. Host Win7, Guest Fedora 16?

I'm a newbie in linux. I installed Fedora 16 OS as guest in virtualbox on Window 7. Now, I want to access share folder from Fedora. Here is something I did:
Install guest addtion [OK]
Make share folder link to virtualbox [OK]. Share folder path in Window 7: D:\share_folder_vm
In terminal program in fedora, I just run some commands:
[hoangphi#localhost ~]$ su
Password:
[root#localhost hoangphi]# cd Desktop/
[root#localhost Desktop]# mkdir share_folder
[root#localhost Desktop]# sudo mount -t vboxsf D:\share_folder_vm \share_folder
/sbin/mount.vboxsf: mounting failed with the error: Protocol error
[root#localhost Desktop]#
I got this message: /sbin/mount.vboxsf: mounting failed with the error: Protocol error
share_folder_vm is the folder in Win7 Host and share_folder is the folder in Fedora Guest.
My question: How can I fix this problem?
Install Oracle Guest Additions:
[host-hotkey (usually right Ctrl)] + [d],
Then:
sudo /media/VBOXADDITIONS_4.*/VBoxLinuxAdditions.run
You can now enjoy:
A guest that can run at native screen resolution
Ability to share files between host and guest
Share the clipboard (allowing you to copy and paste between host and guest).
To share folders set them up to be shared. Consider the permissions. Note that the host file permissions are transient. IOW if you can't write to file on host, the guest can't either.
After setting up the file to be shared create a destination if you don't have one:
mkdir -p ~/destination
Now mount it under the name you configured it with:
sudo mount -t vboxsf myFileName ~/destination
As an extra tip you can really exploit this feature to do things like:
- Use guest subversion client to create repository to mounted directory (you won't have a full svn client but the repo can be used in an IDE on the host).
- I personally use my guest to download and unpack binaries like Tomcat to a targeted mount. Yes you can use Linux to install things on Windows!
To unmount all shares:
sudo umount -f -a -t vboxsf
This thread has some great tips. However....
#GirishB's answer isn't correct - sorry. Jartender's is best.
Also, every post in here seems to assume you're logging in to the Linux guest as root, except for #tomoguisuru. Yuck! Don't use root, use a separate user account and "sudo" when you need root privileges. Then this user (or any other user who needs the shared folder) should have membership in the vboxsf group, and #tomoguisuru's command is perfect, even terser than what I use.
Forget running mount yourself. Set up the shared folder to auto mount and you'll find the shared folder - it's under /media in my OEL (RH and Centos probably the same). If it's not there, just run "mount" with no arguments and look for the mounted directory of type vboxsf.
For accessing a shared folder, YOU have to have "Oracle VM extension pack" installed.
Look at the bottom of this link, you can download it from there.
http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html
I just figured. You need to add a shared folder using VirtualBox before you access it with the guest.
Click "Device" in the menu bar--->Shared File--->add a directory and name it
then in the guest terminal, use:
sudo mount -t vboxsf myFileName ~/destination
Dont directly refer to the host directory
There's a simpler way I found when running Linux Mint.
Ensure you install the Guest Additions from the command line and that you have the folder(s) shared with "automount" and "make permanent" settings selected within "Shared Folders" tab of the Machine Settings
Launch the User management application from Application/Settings/System Setting/ menu selection (requires sudo) from within the Mint menu
In the "Privileges and Groups" tab, check the box next to the "vboxsf" group, and then apply and ok your way back out.
Any user within the vboxsf group has full access to any shared folders on each boot with no manual mounting or unmounting
I usually do the following in addition to the above just to have quick access
Open the Dolphin file manager and navigate to /media/
Right-Click on the shared folder and click "Add to Places"
You probably need to change your mount command from:
[root#localhost Desktop]# sudo mount -t vboxsf D:\share_folder_vm \share_folder
to:
[root#localhost Desktop]# sudo mount -t vboxsf share_name \share_folder
where share_name is the "Name" of the share in the VirtualBox -> Shared Folders -> Folder List list box. The argument you have ("D:\share_folder_vm") is the "Path" of the share on the host, not the "Name".
May be this can help other guys:
I had the same problem, and after looking with Google I found that can be because of the permissions of the folder... So, you need first to add permissions...
$ chmod 777 share_folder
Then run again
$ sudo mount -t vboxsf D:\share_folder_vm \share_folder
Check the answers here: Error mounting VirtualBox shared folders in an Ubuntu guest...
VirtualBox version has many uncompatibilities with Linux version, so it's hard to install by using "Guest Addition CD image". For linux distributions it's frequently have a good companion Guest Addition package(equivalent functions to the CD image) which can be installed by:
sudo apt-get install virtualbox-guest-dkms
After that, on the window menu of the Guest, go to Devices->Shared Folders Settings->Shared Folders and add a host window folder to Machine Folders(Mark Auto-mount option) then you can see the shared folder in the Files of Guest Linux.
There is a really simple tuturial here : http://my-wd-local.wikidot.com/otherapp:configure-virtualbox-shared-folders-in-a-windows-ho
telling to do:
sudo mkdir /mnt/vbox_share
sudo mount.vboxsf nameAddesAsShared /mnt/vbox_share
These are the steps to share a folder from Windows to Linux Virtual Box
Step 1 : Install Virtual Box Extension Pack from this link
Step 2: Install Oracle Guest Additions:
By pressing -> Right Ctrl and d together
Run the command
sudo /media/VBOXADDITIONS_4.*/VBoxLinuxAdditions.run
Step 3 : Create Shared Folder by Clicking Settings in Vbox
Then Shared Folders -> + and give a name to the folder (e.g. VB_Share)
Select the Shared Folder path on Windows (e.g. D:\VBox_Share)
Step 4: Create a folder in named VB_share in home\user-name (e.g. home\satish\VB_share) and share
mkdir VB_Share
chmod 777 VB_share
Step 5: Run the following command
sudo mount –t vboxsf vBox_Share VB_Share

Can oprofile be made to use a directory other than /root/.oprofile?

We're trying to use oprofile to track down performance problems on a server cluster. However, the servers in question have a read-only file system, where /var/tmp is the only writeable directory.
OProfile wants to create two directories whenever it runs: /root/.oprofile and /var/lib/oprofile, but it can't, because the filesystem is read-only. I can use the --session-dir command line option to make it write its logs to elsewhere than /var/lib, but I can't find any such option to make it use some other directory than /root/.oprofile.
The filesystem is read-only because it is on nonwriteable media, not because of permissions -- ie, not even superuser can write to those directories. We can cook a new ROM image of the filesystem (which is how we installed oprofile, obviously), but there is no way for a runtime program to write to /root, whether it is superuser or not.
I tried creating a symlink in the ROM that points /root/.oprofile -> /var/tmp/oprofile, but apparently oprofile doesn't see this symlink as a directory, and fails when run:
redacted#redacted:~$ sudo opcontrol --no-vmlinux --start --session-dir=/var/tmp/oprofile/foo
mkdir: cannot create directory `/root/.oprofile': File exists
Couldn't mkdir -p /root/.oprofile
We must run our profilers on this particular system, because the performance issues we're trying to investigate don't manifest if we build and run the app on a development server. We can't just run our tests on a programmer's workstation and profile the app there, because the problem doesn't happen there.
Is there some way to configure oprofile so that it doesn't use /root ?
I guess it should be as simple as overriding the HOME environment variable:
HOME=/tmp/fakehome sudo -E opcontrol --no-vmlinux --start --session-dir=/var/tmp/oprofile/foo
If that doesn't work out, you could have a look at
unionfs
aufs
to create a writable overlay. You might even just mount tmpfs on /root,or something simple like that.
It turns out that this directory is hardcoded into the opcontrol bash script:
# location for daemon setup information
SETUP_DIR="/root/.oprofile"
SETUP_FILE="$SETUP_DIR/daemonrc"
Editing those lines seemed to get it working, more or less.

Resources