Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Let's try to install everything then.
You said that 'If a package is already installed, the apt-get will tell you that'.
I think it's important to save that information. That way, I could use this new list and remove all these packages from p2install.txt. This new list would be all the packages that have really be installed, and this way it would be easy to undo everything. Don't you think ?
If you agree, then how to save this information ?
Of course it doesn't work, just like I told you a couple of times why it wouldn't work.
If you would have been able to run the command:
Code:
dpkg --get-selections>myselections.txt
on the previous (crashed) install, then you would have something to compare to originalselections.txt because it originated from the same source.
Got it?
Quote:
You said that 'If a package is already installed, the apt-get will tell you that'.
I think it's important to save that information. That way, I could use this new list and remove all these packages from p2install.txt. This new list would be all the packages that have really be installed, and this way it would be easy to undo everything. Don't you think ?
If you agree, then how to save this information ?
There's no need for that since you basically already know by looking at the originalselections.txt file. That contains a list of all the packages installed. For example if your first line in p2install.txt is amsn, then apt-get will install it will all necessary dependencies like amsn-data and some more. If it were already installed, apt-get would do nothing and move on to the next line.
The only thing you need to do, is run the script to install all packages listed in the p2install.txt file as explained in a previous post. Once it's finished then run this command again:
Code:
dpkg --get-selections>originalselections.txt
In doing that you'll save an updated list of your installed packages. Just keep that file in some place safe and you'll be able to reinstall your system a lot easier than you are doing now.
Who cares where it comes from, in the end it's just a file with package names, so I think I should be able to compare them if I wanted to, but it keeps telling me that it's not in sorted order, even though it seems to be, and even though I removed all spaces and 'install' and everything else but the package names.
I think you haven't understood my idea :
I'd like to have the option to undo the installation we're about to make.
I think that if we don't do anything special, it won't be possible. Indeed, the list p2install.txt may contain packages that are already installed, as you said, so if I were to uninstall all the packages that are in that list, I'd remove some packages besides the ones that I would have installed. Am I wrong ?
LOL, you're not getting me on a high horse my friend. You'd be way past your bedtime before you can achieve that.
Preparing for an undo is easy enough if you think a bit logical. You already have the file originalselections.txt which is the state your installed packages are in now and when you finish the installation of the packages listed in p2install.txt you'd have a 'new state'. When you run the command:
Code:
dpkg --get-selections>newstate.txt
you'll have the state with the new packages installed. If you'd like to revert to the previous state you can use the originalselection.txt to achieve that. After a clean install you can use these commands for that:
You cannot just use this method to uninstall packages you are going to install now. The method described with get-selections, set-selections and dselect-upgrade is a way to have a backup of what you have installed in your system so you can reinstall it in an easy way.
If you would like to use this process to uninstall the packages you're going to install then you'll have to find what the differences are between orginalselections.txt and newstate.txt and then for those lines only change the word 'install' to 'deinstall' in newinstall.txt. Then you can use the same process with newinstall.txt to uninstall the referred packages and their dependencies if those are not used by another package.
You'll have to keep track of the version of your get-selections output for yourself though.
Another way you could do it is by using the p2install.txt file, change in the autoinstall.sh script the word 'install' to 'remove' and run the script. That way you would remove all the packages in the list and their dependencies. That's another way, maybe simpler to track, but I haven't tested it this way to remove packages. Normally should work.
I know I don't know how to work with Linux as much as you do, for this is the very reason why I'm using this forum. There's no need to remind it to me in these terms. I'm just trying to learn here. Sorry if my questions/suggestions look too stupid to you.
I made the shell script and run it. A lot of lines appeared.
I don't know if it's relevant, but some of them were :
- Do you want to continue [Y/n]? Abort.
- E:Couldn't find package xx.
There are no stupid questions in my opinion. I got the impression that you were getting a bit over-exited because the compare didn't work the way you want it to. And it seemed to me that you were not really interested in the reason why it didn't work, so that's why I put the high horse answer in my last post. And believe me, I'm here for the same reason as you are, to learn. Pretty soon you'll be sharing what you have learned here with other, to help them out, and that's what LQ is all about. So, just to set things straight, if I have offended you in any way with that then I apologize. I never meant to insult you in any way.
It's normal that a lot of lines have appeared, but they were just output of the apt-running. Normally at this moment the packages that apt-get could find in the repositories have been installed. An easy way to check if the entire file has been processed is to verify if the last package in the p2install.txt file is indeed installed. So, run:
Code:
tail -1 p2install.txt
to find out what that package is (that's -1 <number one>). Next run:
Code:
dpkg -l <packagename>
with <packagename> being the name of the package you got from the tail command.
No package found matching zlib1g-dev.
It's zlib(one)g-dev, but it doesn't matter since I made a copy/paste.
(The font chosen by this forum for the code parts is really annoying when it comes to differenciate L and One. Can I change that in my preferences ?)
So I'm guessing the script didn't work afterall ?
The error(s) you got when running the script don't mean it failed completely. It just means that at least one package wasn't installed correctly but since it was a development library I wouldn't give it much thought. You can check the complete list of what has been installed by checking the log file of apt (/var/log/apt/term.log); it mentions dates and everything so easy to trace what has been installed and what not. Take note of what has not been installed and then we'll have a look at that.
I'm at the office right now, so sometimes you might have to wait for me to reply.
I'm lost. What am I supposed to do exactly?
In term.log, during the last log session, the last line was 'processing triggers for python-support'.
Yet this line was produced when I updated the system after the fresh reinstallation.
There is no line produced in term.log at the timeframe when I run the script.
Run the following command to paginate through the apt log:
Code:
less /var/log/apt/term.log
and see if you find any errors in there. You could also try:
Code:
cat /var/log/apt/term.log | grep -B2 -A2 "Error|error" | less
to shorten the list. Using this command you'll only get the lines that contain the word Error or error and two lines before and after that same line. So the information should be more relevant. It's just to check if there are any other packages with errors.
The second command produced no input.
I'm guessing the first one is the equivalent of gedit /var/log/apt/term.log, so I used gedit which I am more familiar with.
And by the way your command line must be wrong because I found one (and only one) string that has the word 'error' in it, using ctrl+f in gedit : "Installation finished. No error reported."
Also can you look through /var/log/dpkg.log and /var/log/dpkg.log.1 the same way (with gedit) and check if you can find any errors in there? The dpkg log lists status of packages like this:
Code:
2010-03-01 06:36:59 configure smbclient 2:3.2.5-4lenny9 2:3.2.5-4lenny9
2010-03-01 06:36:59 status unpacked smbclient 2:3.2.5-4lenny9
2010-03-01 06:36:59 status half-configured smbclient 2:3.2.5-4lenny9
2010-03-01 06:36:59 status installed smbclient 2:3.2.5-4lenny9
and it might give important information too in order to find out what packages have not been installed.
cat /var/log/apt/term.log | grep "error" works and gives the line I mentioned above (with 'error' in red).
cat /var/log/apt/term.log | grep "Error" gives no output.
On the other hand, the timestamp errors in dpkg.log are in adequation with the time when I run the script you wrote.
The file is quite big so I used sudo cat /var/log/dpkg.log |grep "error" (no Error found), instead of ctrl+f. Here is the result :
install libgpg-error0 <none> 1.6-1ubuntu1
status half-installed libgpg-error0 1.6-1ubuntu1
status unpacked libgpg-error0 1.6-1ubuntu1
status unpacked libgpg-error0 1.6-1ubuntu1 (twice)
configure libgpg-error0 1.6-1ubuntu1 1.61ubuntu1 (1.61ubuntu1 written twice)
status unpacked libgpg-error0 1.6-1ubuntu1
status half-configured libgpg-error0 1.6-1ubuntu1
status installed libgpg-error0 1.6-1ubuntu1
Do you want the timestamps too? 8 seconds occured between the first and last line.
No, I don't need the timestamps. That output looks a bit 'screwed up' to me but definitely something went wrong. Run the following command in a terminal in the directory where the p2install.txt file is located to get a reference to the package from the p2install.txt list:
I probably didn't understand what you meant, because I wrote grep "libgpg" p2install.txt and there was no output. I have never made a cd the whole time, all is in the home directory.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.