Editing a read-only file in Linux

I have had another question:

Trying to get my wireless dongle working. I’ve found a file it says I have to edit, but the file is read-only, and I can’t change the status in Properties. I’m starting to dislike Linux already 🙁

Editing a read-only file in Linux is easy when you know how. Before you do anything else you copy the original file and paste it somewhere safe, like on your desktop, so if anything goes wrong you can restore it.

Editing the file:
As you are wanting to end up with a file containing an altered load of code there are two ways of doing it:

  1. The first way is to get superuser permissions to alter the original, then save the changes.
  2. The second is the longer way. Good if you are nervous about getting something wrong.

The first way
Open a terminal (should be in your list of programmes, will look like old fashioned computer display with a command prompt). The next thing is to open the read-only file from a command in the terminal.

Paste in terminal: gksu gedit /usr/local/share/applications/defaults.list [or your file location]

You can get the location by right-clicking on the file and selecting ‘copy’ then paste it in the terminal. Use right-click ‘paste’ as short-cuts won’t work.
gksu is the super user command, could have used sudo.
gedit is the editor for the document, if your machine uses a different editor put the name of it there instead of gedit.
/usr/local/share/applications/defaults.list is just an example, you put the location of your file there.

You alter the file as you want using gedit. Then save it, while you have superuser or ‘root’ authority over it.

Second way
Open the read-only file and paste the contents into a blank gedit. Or open the read-only file and save it to your desktop. Close the read-only one and open the one on your desktop. You will have permissions to alter it. Change what you want then save changes.

Next you want to replace the old one with your altered one.

Paste in terminal after the command prompt:  gksu nautilus /usr/local/share/applications/ [or the folder where your file is]

That command would open the file browser but with superuser authority. It will take you to the folder containing your old file. You drag your new file there to replace the old one. Must have the same name as the old one.

If you are not using Ubuntu the file browser may be a different one, but Nautilus is common to many different flavours of Linux. If yours is different put in the name of your file browser.

For someone new to Linux I have good news. A good way to find answers to you Linux questions is to google your question mentioning your version of Linux. As Linux is open source you find all sorts of help out there. People like me stick the answers in websites and blogs.

Can Windows Install after Linux

A friend has asked me a question:

I’ve just bought a new computer. I can use my university’s site licence for Windows, so I bought a computer that didn’t have Windows pre-installed. It has Linux. The computer shop have told me that to have both OS’s, I needed to have installed Windows first, so I now need to re-format the hard drive and install Windows, then install Linux. Is this definitely correct, or is it possible to install Windows after Linux?

The following is my answer. If any techie people have a better answer that is not techie to do I would be interested, so would my friend.

Your chap is almost correct. He is if you do not want to get complicated. The reason is that if you install Linux first, Windows will then write over the Linux boot loader (the bit that loads the operating system, the OS). It is designed to do this as it always wants to wipe out any competing OS.

One solution that some people use is to install a third party boot loader then it is possible to install many different operating systems on the machine. It is not complicated but you will have to Google for the how-to. Might not be easy after the Linux install. It is a long time since I mucked about with boot loaders.

The simple and usual way is to install Windows first then Linux. This is what your chap will have been thinking about. You do not need to reformat if the Windows installation disk sees all of your hard drive (Windows can often NOT see the file format used by Linux so it may think most of your disk has disappeared), try it and see. Be warned, Windows has now started to put too many partitions on computers to hinder easy installation of Linux alongside (I heard the CEO threw a chair through a window at the mention of Linux before W7 came out). This may become a problem after you install Windows. See http://themorningflight.com/gadgets/setting-up-ubuntu-on-samsung-nc10/ for instructions on dealing with the extra partitions.

If the above does not work, do the following (this will wipe you existing Linux system for now – yes there are other techie ways of doing it that are tidier, but they can be complicated):

Put in a live Linux cd and boot from that. Use the partition manager (Gparted) to divide the HDD, and make a space big enough for Windows. Make the file system in that partition NTFS.

Close the machine down and boot up with the Windows installation disk in. Install Windows – it will put itself on the NTFS partition you created. It will create the boot system it needs.

When Windows installation is all finished you can install the Linux of your choice using an installation cd that you can download and burn. You could put the original Linux brand back on, or another (as you know I use Ubuntu, but Fedora is very good too). This Linux installation will install the boot loader that will give you an option of Windows or Linux when you start up.

A duel-boot system is ideal. The Windows side for using specialist software, the Linux side for a clean, secure (no viruses) and fast every day use.

Help With My Computer Faults

Just had a friendly call from a lady in a call centre overseas.

She kindly offered to fix some problems on my computer. She said that she was calling from the support centre for my computer and if I switched it on she would guide me through the setting on WINDOWS!!!!!! and fix the known issues for me.

I asked how she know my computer ran on Windows. She said it was because they had all the details of the computers that their support centre supported.

When I told her my computers run on Linux she was not put off at first as she obviously did not know what Linux is.

She got the idea eventually and continued her search for a sucker elswhere.

Ubuntu 10.10 Around the Corner

The new Ubuntu comes out soon. 10.10, also known as Maverick Meerkat.

The next version of Ubuntu is coming soon

I am using Ubuntu 10.04, Lucid Lynx (with Long Term Support until April 2013), and am very happy with it. It works great on my desktop machines and on my Samsung netbook. Ubuntu 10.04 boots fast and leaves Windows 7 snoozing. Reports are that 10.00 boots even faster.

See the excellent review at ITworld if you want to see more.

Is it time you took the plunge?

Ubuntu 10.04 and NC10 Backight

If you are still Googling for answers about the lost backlight control on your Samsung NC10 after upgrading to Lucid (Ubuntu 10.04), I have the solution.

First add ppa:voria/ppa to your Software Source list. This will add more software into your Software Centre. The quick way to do it is to open a Terminal. Then paste in the following and press ‘Enter’.

sudo add-apt-repository ppa:voria/ppa

Enter your password when asked for it.

Next go to your Ubuntu Software Centre, under ‘Applications’. Just put Samsung in the search box and you will see ’samsung-backlight driver’, click ‘install’.

Missing Address Bar

Since updating my Ubuntu to 10.04 I have been a bit miffed that Nautilus seems to have lost the normal address window (I think the correct name is the location bar)

Now I have found out the short-cut. You can switch to a text bar by using Ctrl + L. To go back to a button style bar, just press the escape key.

You can also go directly to the Nautilus bar in text-mode by pressing the “/” key and then typing the location.

Ubuntu 10.04 on the NC10

If you were looking for instructions on how to install Ubuntu on the Samsung NC10 netbook (or similar) you can go to my previous post, just put ‘NC10’ in the search box in the right sidebar.

Upgrading my netbook from 9.10 (karmic) to 10.04 ‘Lucid Linux’ was simple. and largely trouble free.

In my previous post I explained that after installation you need to add a new software source, otherwise known as a repository. This is a simple task and it will mean that the NC10 will apolitically install, and keep updated, the extras that it needs to work the blue function keys.

To upgrade the first thing to do is to do a normal software update by going into System > Administration and choosing ‘Update software’. When the update is complete you will see a box at the top of the update window telling you that an upgrade is available. Click on that and you are away. The whole process will take a few hours depending on you broadband speed so be prepared to be able to get on with something else when it works away.

If you upgraded like me you will see that the software source you had for you NC10 has now been disabled. This is because that old one will not work for ‘Lucid Linux’ the new Ubuntu. You will need to add ppa:voria/ppa to your Software Source list.

As I write this the ppa:voria/ppa has almost completed the fixes but not quite. My NC10 works well as it is though. I think it is only the back-light control and am waiting for now.

The quickest way to update to update your netbook is by doing a clean install of Linux. The process is quick compared to the sort of update I mention above. The reason the above update is so slow is that once the new software is downloaded it takes a long time to install due to the slowness of the netbook processor, one of the few times it is noticeable.