• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Ubuntu 14.04 How to gain permission to change a file.

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

orion456

Member
Joined
May 31, 2004
I am using Ubuntu 14.04 and I accidentally edited the video configuration file with a wrong number and now Ubuntu won't boot.

I have tried using the live disk to gain access to the file and when I try to write the correction it won't let me do so because
I don't have permission. How can I gain permission?


----------------- UPDATE ----------------------------

I finally gained access to the video file from
the live cd by using the following in a terminal:

sudo mount /dev/sda1 /mnt

for i in /sys /proc /run /dev /dev/pts; do sudo mount --bind "$i" "/mnt$i"; done

sudo cp /etc/resolv.conf /mnt/etc/

sudo chroot /mnt

then I could use nautilus to navigate to /etc/X11 and edit the file

I got this info from an internet site describing how to gain access to an HD root from live cd.
 
Last edited:
I am using Ubuntu 14.04 and I accidentally edited the video configuration file with a wrong number and now Ubuntu won't boot.

I have tried using the live disk to gain access to the file and when I try to write the correction it won't let me do so because
I don't have permission. How can I gain permission?

From your description its hard to tell what is going on. What file is causing you problems?

The proper way to use a livecd to fix an environment is to do the following:

A) Boot the live environment

B) Open the terminal

C) mount the proper partition (I will use my drive letters substitute your drive which has the root file system)

Code:
mount /dev/sda5 /mnt
mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys
mount -o bind /dev /mnt/dev
chroot /mnt /bin/bash

D) This will log you in as root to the environment. From here change the problem file with chmod or chown depending on what the problem is
 
couldn't he boot the disk, open terminal, and start nautilus?

If you do that, then you will not have permission to edit files not mounted on the hard drive. You have to mount the hard drive and gain permission to access it.

- - - Updated - - -

From your description its hard to tell what is going on. What file is causing you problems?

There is a video configuration file located in /etc/X11 called xorg.conf and I changed one of the parameters in the file and now Ubuntu won't allow the video card to boot up. It comes up with some message about requiring low res mode and says I have to mount my own keyboard and mouse, which means nothing works at all.

I need to edit the file and change the parameter back to what it was.

I will try your suggestion on Monday. Thanks.
 
Last edited:
If you do that, then you will not have permission to edit files not mounted on the hard drive. You have to mount the hard drive and gain permission to access it.

- - - Updated - - -



There is a video configuration file located in /etc/X11 called xorg.conf and I changed one of the parameters in the file and now Ubuntu won't allow the video card to boot up. It comes up with some message about requiring low res mode and says I have to mount my own keyboard and mouse, which means nothing works at all.

I need to edit the file and change the parameter back to what it was.

I will try your suggestion on Monday. Thanks.

In this case I wouldn't even bother with editing the file by hand (unless you need specific edits). I would just recreate it with nvidia-xconfig

caddi daddi said:
couldn't he boot the disk, open terminal, and start nautilus?

Sometimes this is fine, without knowing the specific file however, it was hard to say. Because the live environment may have different packages, or users, or even UIDs editing directly from the livecd can be more dangerous than helpful. By chrooting into the environment it ensures that:

a) all users and id's are what you expect
b) you are editing the correct file
c) all the programs function as you expect

Using chroot allows you to use any livecd and still have native tools... i.e. I can use an Ubuntu cd to rescue an Arch install because I can chroot into the environment and still have pacman (the package manager) even though the ubuntu livecd doesn't contain it
 
When you boot the system normally, if you access the console (directly, when x throws it's error, you could try cntl+alt+fX (depends on distro, Ubuntu should have the GUI on F7, therefore, accessing the built in terminal should be any from F1-F5, iirc F6 is the console output from boot/starting X). Then you need to use the following:

sudo chmod

I do not know what the default permissions of the file is, but one method of setting permissions is using the following:

chmod xyz

X,y,z are numbers, 0-7 that map to the following:

https://en.m.wikipedia.org/wiki/Chmod

Basically, set the permissions according the table under sytax in the link. This is assuming you know what the permissions were/should be, and the where the file should be.
 
When you boot the system normally, if you access the console (directly, when x throws it's error, you could try cntl+alt+fX (depends on distro, Ubuntu should have the GUI on F7, therefore, accessing the built in terminal should be any from F1-F5, iirc F6 is the console output from boot/starting X). Then you need to use the following:

sudo chmod

I do not know what the default permissions of the file is, but one method of setting permissions is using the following:

chmod xyz

X,y,z are numbers, 0-7 that map to the following:

https://en.m.wikipedia.org/wiki/Chmod

Basically, set the permissions according the table under sytax in the link. This is assuming you know what the permissions were/should be, and the where the file should be.

Alternately if you can get into the build terminal (good term, I didnt know what to call it Unbuntu press either f7 or f1) you can simply edit the file with nano or vi
Code:
sudo nano [i]path/to/file[/i]

Code:
sudo vi [i]path/to/file[/i]

these should take you to a text editor that will allow you to make the neccessary changes. If you get stuck on how to use nano or vi check the man page or google as they arent very intuitive. They work though :)
 
The main problem on booting into the hard drive Ubuntu is that I have no keyboard or mouse controls. It says something like I have to mount my own keyboard and mouse. Unless of course its just kidding about that and f7 actually will work.
 
Last edited:
SSH enabled?

I considered that direction as well, but I dont think you can use SSH until the OS loads (for instance you could ssh fromt he live CD to the existing OS) but I didnt know for sure so I didnt say.

OP: your keyboard and mouse might work, and it might be kidding. try hitting f7 when the time comes and let us know. I know for a fact that computers lie from time to time :) Also have you had any luck with the method in post #5 ? This is by far the most likely to work for you
 
It should be control alt F1 to get to console, control alt f7 should be GUI in Ubuntu. Even if GUI fails to load (what it sounds like is the major problem), console and ssh should work. This assumes SSH is enabled, which I believe it is not by default on most installs/distros.
 
I finally gained access to the video file from
the live cd by using the following in a terminal:

sudo mount /dev/sda1 /mnt

for i in /sys /proc /run /dev /dev/pts; do sudo mount --bind "$i" "/mnt$i"; done

sudo cp /etc/resolv.conf /mnt/etc/

sudo chroot /mnt

then I could use nautilus to navigate to /etc/X11 and edit the file

I got this info from an internet site describing how to gain access to an HD root from live cd.

Thanks for all your suggestions.!
 
I'm glad you got it solved. I'd you would do a favor and post where you read that? I don't understand why you would copy the resolv.conf to /mnt/etc? Isn't that only responsible for setting where your dns servers are?

Anyway, I am glad you got it solved though! :clap:
 
I'm glad you got it solved. I'd you would do a favor and post where you read that? I don't understand why you would copy the resolv.conf to /mnt/etc? Isn't that only responsible for setting where your dns servers are?

Anyway, I am glad you got it solved though! :clap:

Unfortunately my browser history disappears each time I had to reboot the live cd and I couldn't find the site again when I went to look for it. I have no idea what any of that script actually does or why it is needed so I can't help you at all.
 
I finally gained access to the video file from
the live cd by using the following in a terminal:

sudo mount /dev/sda1 /mnt

for i in /sys /proc /run /dev /dev/pts; do sudo mount --bind "$i" "/mnt$i"; done

sudo cp /etc/resolv.conf /mnt/etc/

sudo chroot /mnt

then I could use nautilus to navigate to /etc/X11 and edit the file

I got this info from an internet site describing how to gain access to an HD root from live cd.

Thanks for all your suggestions.!



Well I am a little sad you got this somewhere else as this is pretty much exactly what I advised on 03-26-16. Anyways the important thing is you got it sorted

- - - Updated - - -

I'm glad you got it solved. I'd you would do a favor and post where you read that? I don't understand why you would copy the resolv.conf to /mnt/etc? Isn't that only responsible for setting where your dns servers are?

you are correct its for DNS only and is not required for this
 
Well I am a little sad you got this somewhere else as this is pretty much exactly what I advised on 03-26-16. Anyways the important thing is you got it sorted

Sorry to make you sad, I went with the longer version since more is always better......right?
 
Back