Why can't I save a VI file after entering data? [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I am new to linux, when I typed "vi FILE1" I was able to open VI editor. I added some data and I want to save the file and I tried :w but it threw me an error.
"file1" E212: Can't open file for writing
Press ENTER or type command to continue
why I am not able to save it?
The directory in which I am creating file has following permissions:
drwxr-xr-x 4 pentaho pentaho 4096 Mar 12 2013 master
I am logging using root user and password.
Output of mount command :
/dev/sda1 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sdb1 on /etl type ext4 (rw)
/dev/sdc1 on /oracle type ext4 (rw)
/dev/sdd1 on /export type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

You can also get this error if the directory you are trying to save to does not exist. Even the root user will get this error.

When you log in linux with your common user, you are logged with the user you created, but you are not superuser (you do not have all permissions). To execute a program with root priviliges (and therefore have all permissions), you have to add the command sudo. So you should run: $> sudo vi FILE1. This will ask you for the password and then you use vi normally

If you are facing issue in vi, try to create directory manually and edit the file. May be you don't have access to create directory/file.

Related

why "locate" doesn't return all existing files? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I wonder why locate doesn't file all .exe files on my system depsite being up to date:
ebra#him:~$ sudo updatedb
ebra#him:~$ locate *.exe
/home/ebra/a.exe
/home/ebra/Downloads/santa.exe
ebra#him:~$
ebra#him:~$ ls /usr/share/nmap/nselib/data/psexec/nmap_service.exe
/usr/share/nmap/nselib/data/psexec/nmap_service.exe
ebra#him:~$
updatedb.conf:
ebra#him:~$ which updatedb
/usr/bin/updatedb
ebra#him:~$ which locate
/usr/bin/locate
ebra#him:~$ type /usr/bin/updatedb
/usr/bin/updatedb is /usr/bin/updatedb
ebra#him:~$ type /usr/bin/locate
/usr/bin/locate is /usr/bin/locate
ebra#him:~$
ebra#him:~$ cat /etc/updatedb.conf
PRUNE_BIND_MOUNTS="yes"
# PRUNENAMES=".git .bzr .hg .svn"
PRUNEPATHS="/tmp /var/spool /media /var/lib/os-prober /var/lib/ceph /home/.ecryptfs /var/lib/schroot"
PRUNEFS="NFS afs autofs binfmt_misc ceph cgroup cgroup2 cifs coda configfs curlftpfs debugfs devfs devpts devtmpfs ecryptfs ftpfs fuse.ceph fuse.cryfs fuse.encfs fuse.glusterfs fuse.gvfsd-fuse fuse.mfs fuse.rozofs fuse.sshfs fusectl fusesmb hugetlbfs iso9660 lustre lustre_lite mfs mqueue ncpfs nfs nfs4 ocfs ocfs2 proc pstore rpc_pipefs securityfs shfs smbfs sysfs tmpfs tracefs udev udf usbfs"
ebra#him:~$
Since your current (home) directory has a file named a.exe , the shell is expanding *.exe, and you are effectively running the command
$ locate a.exe
Try it either without the asterisk or with an escaped asterisk
$ locate \*.exe

Unable to mount disk to directory [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I'm getting this error while mounting disk to directory. Please let me know what should I do ?
[root#ip-172-31-39-36 ec2-user]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 8G 0 disk
└─xvda1 202:1 0 8G 0 part /
xvdf 202:80 0 100G 0 disk
[root#ip-172-31-39-36 ec2-user]# mkdir filesystem
[root#ip-172-31-39-36 ec2-user]# mount /dev/xvdf /filesystem
mount: mount point /filesystem does not exist
[root#ip-172-31-39-36 ec2-user]# ls
filesystem
[root#ip-172-31-39-36 ec2-user]# mount /dev/xvdf /filesystem
mount: mount point /filesystem does not exist
You are creating a directory called filesystem in the current directory and not under root. Either of the following fixes should work:
A. Make the filesystem directory under root
[root#ip-172-31-39-36 ec2-user]# mkdir /filesystem
[root#ip-172-31-39-36 ec2-user]# mount /dev/xvdf /filesystem
B. Use the filesystem directory created under the current directory as mount point
[root#ip-172-31-39-36 ec2-user]# mkdir filesystem
[root#ip-172-31-39-36 ec2-user]# mount /dev/xvdf filesystem

File last access time. How to mount root filesystem with atime,norelatime [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I've installed a simple LAMP system based on Debian 7.2.0 (32 bits). On my server I want to know when each of PHP files was used (accessed) by web server. When I check last access times of php files (with command ls -alu), they are wrong.
I've found that it is because of relatime option used for mounting of the root filesystem. I've tried to edit my /etc/fstab and to put norelatime,atime options there but it does not work. My current /etc/fstab is:
UUID=d4bb10f1-1428-4ee4-916c-55e800263c3f / ext4 atime,norelatime,errors=remount-ro 0 1
UUID=6db7a3c7-6ff9-43ac-b959-5175039bb84b none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
After a reboot, when I type mount, I get:
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=127786,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=103240k,mode=755)
/dev/disk/by-uuid/d4bb10f1-1428-4ee4-916c-55e800263c3f on / type ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=352700k)
All the partitions have relatime option. Any help?
http://www.linux-archive.org/fedora-development/120241-why-relatime-immune-remount.html and https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/582799 indicate that this does not work on Fedora or Ubuntu, and presumably the same is true for Debian. To quote from the first linked article:
You have to:
echo 0 > /proc/sys/fs/default_relatime
and then mount/remount with 'atime' and it should work.

Cannot write to mounted (external) HDD [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have tried mounting my external (usb) HDD, but eventhough the permissions match (between the user and the mounted disk) I cannot write, even as root. I tried mounting using pmount and "normal" mount.
System info:
Linux b2 2.6.39.4-4 #1 Fri Aug 19 14:41:59 CEST 2011 ppc GNU/Linux
User info:
zero#b2:~$ id -a
uid=1001(zero) gid=100(users) groups=100(users),46(plugdev)
pmount test:
zero#b2:~$ pmount /dev/sdb1 HDD
zero#b2:~$ mount
...
/dev/sdb1 on /media/HDD type ntfs (rw,noexec,nosuid,nodev,uid=1001,gid=100,umask=077,nls=utf8)
zero#b2:~$ stat /media/HDD/
File: `/media/HDD/'
Size: 4096 Blocks: 8 IO Block: 512 directory
Device: 811h/2065d Inode: 5 Links: 1
Access: (0700/drwx------) Uid: ( 1001/ zero) Gid: ( 100/ users)
zero#b2:~$ touch /media/HDD/testtouch
touch: cannot touch `/media/HDD/testtouch': Permission denied
I also cannot add any new directories.
Interestingly enough I CAN edit and save existing files (but not copy etc.)
test writing to existing file:
root#b2:/home/zero# mount -t ntfs /dev/sdb1 -o umask=022,gid=100,uid=1001 TEST/
root#b2:/home/zero# mount -l
...
/dev/sdb1 on /home/zero/TEST type ntfs (rw,umask=022,gid=100,uid=1001)
zero#b2:~$ cat TEST/test
zero#b2:~$ echo "writing text" > TEST/test
zero#b2:~$ cat TEST/test
writing text
Any ideas?
Read/write access to NTFS filesystems in the Linux kernel. Use ntfs-3g (FUSE) if you need read/write access.
sudo apt-get install ntfs-3g
sudo mount -t ntfs-3g /dev/sdb1 /media/HDD
sudo touch /media/HDD/I_can_write,_my_friends
NTFS-3G homepage:
http://www.tuxera.com/community/ntfs-3g-download/
More or support of NTFS in Debian:
https://wiki.debian.org/NTFS

The /run directory: how to create it at first boot to store runtime data [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I read an article about the /run directory on Linux systems.
http://article.gmane.org/gmane.linux.redhat.fedora.devel/146976
This article states that many Linux distributions have agreed that the /run directory is the only clean solution for early-runtime-dir problem. Previously, they put early runtime data in /dev/.XXX or /var/run. But they are now adopting the /run directory for storing early runtime data.
My question: How do they make this change? To be specific, do they change the code in kernel or boot or initscripts?
Take this article (http://article.gmane.org/gmane.linux.redhat.fedora.devel/146976) for example, what are the possible changes that needed to implement this?
The run directory has no special meaning for the kernel itself be it /run or /var/run. From the kernel's point of view it is just a regular directory. For performance reasons since some time ago it is usually mounted as tmpfs file system. The Fedora distribution creates a symbolic link /var/run pointing to /run for backward compatibility:
mount:
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
ls /var:
lrwxrwxrwx. 1 root root 6 Jun 8 15:33 run -> ../run
So actually all 'old' programs and scripts will work. But as the convention changed the packages are also undergoing the update to reflect this. So, with time the need in the /var/run link will dissappear.
To implement this move of /run the init scripts are changed.
/run is created and mounted (usually as a tmpfs filesystem) by the init system of your Linux distribution. For example systemd or OpenRC. The init system runs before any other program.
The kernel doesn't have anything to do with it.

Resources