Difference between revisions of "Ubuntu - Doing Updates"

From Blue-IT.org Wiki

(Replay the backup)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
= apt and config files =  
 
= apt and config files =  
== /etc/apt/preferences ==
+
=== Pinning an application ===
 +
vim /etc/apt/preferences
  
=== Pinning an application ===
 
 
  Package: firefox
 
  Package: firefox
 
  Pin: version 30*
 
  Pin: version 30*
Line 28: Line 28:
 
     done
 
     done
 
  done
 
  done
 
 
  
 
= dpkg --get-selections =
 
= dpkg --get-selections =
Line 118: Line 116:
  
 
You should be able to login seeing your old desktop environment again.
 
You should be able to login seeing your old desktop environment again.
 +
 +
 +
If you get problems you might have to sync the avaiable packages list:
 +
( https://lists.debian.org/debian-user-german/2014/06/msg00155.html )
 +
 +
sudo apt-get install dctrl-tools
 +
sudo sync-available
  
 
== Troubleshooting ==  
 
== Troubleshooting ==  
Line 126: Line 131:
 
  cd ~
 
  cd ~
 
  rm -rf .pulse
 
  rm -rf .pulse
 +
 +
In newer Ubuntu versions the pulse directory is  in ''~/config''
 +
 +
cd ~/.config
 +
rm -rf .pulse
 +
 +
Or simply restart the pulseaudio server:
 +
 +
pulseaudio -k
  
 
Reboot and sound should appear (if there are no hardware restrictions).
 
Reboot and sound should appear (if there are no hardware restrictions).
 +
 +
=== Updates did not went well ===
 +
Restart the update process
 +
 +
dpkg --configure -all
 +
 +
or
 +
 +
apt-get -f install
  
 
[[Category:Ubuntu]]
 
[[Category:Ubuntu]]
 
[[Category:Backup]]
 
[[Category:Backup]]

Latest revision as of 20:25, 9 March 2020

apt and config files

Pinning an application

vim /etc/apt/preferences
Package: firefox
Pin: version 30*
Pin-Priority: 1000

Package: firefox-locale-de
Pin: version 30*
Pin-Priority: 1000

Using ppa on the cli

Find out, which ppa a package belongs to:

apt-cache policy PACKAGE_NAME

Getting all ppas:

#! /bin/sh 
# listppa Script to get all the PPA installed on a system ready to share for reininstall
# http://askubuntu.com/questions/148932/how-can-i-get-a-list-of-all-repositories-and-ppas-from-the-command-line
for APT in `find /etc/apt/ -name \*.list`; do
    grep -o "^deb http://ppa.launchpad.net/[a-z0-9\-]\+/[a-z0-9.\-]\+" $APT | while read ENTRY ; do
        USER=`echo $ENTRY | cut -d/ -f4`
        PPA=`echo $ENTRY | cut -d/ -f5`
        echo sudo apt-add-repository ppa:$USER/$PPA
    done
done

dpkg --get-selections

The Problems

A system upgrade via update manager is not working or not intended. Several ppa archives are installed. A complete new installation is needed.

Be warned: I am not responsible for any damage on you system or dataloss. I only can confirm, that I am doing ubuntu updates (formerly debian updates) with this method without any problems since years.

In any case

  1. Backup or keep your home directory!!!
  2. Be sure which ppa's you did install and if they are avaiable for your new distribution
  3. Remember your Username and Password (don't change this)
  4. Be sure you are connected to the internet

The best is to keep your home data on a seperate partition. Then you only have to select this partition during a new install and NOT (!!!) to format it.

In case you need a new install of the whole hard disk, this is very easy. Mount an external backup drive or insert a dvd. Save the following files onto that media.

1. Save Package informations

sudo dpkg --get-selections > ~/Desktop/myselections

Save this file to your backup media!

2. Save Data

Logout !!!

Switch to a terminal screen via Strg+Alt+F1 and login with your normal username!

Home

Then enter the following commands:

cd /home
tar cjvf ~/Desktop/${USER}.tar.bz ${USER}

This creates a file called "yourUserName.tar.bz" on your Desktop.

Switch back to the graphical login screen with Strg+Alt+F7 (sometimes F8) and login.

Evolution

If you are using evolution email, it is a good idea to backup now your data with the evolution backup procedure which also generates a backup file!

Other Data

Remember other data that is not stored in the home directory

  1. databases (e.g. for mythtv)
  2. programs or scripts in /usr/local/bin
  3. special customized scripts in /etc (e.g. in /etc/modprobe.d, /etc/rc.local, ...)

...

Now burn your backup files (don't forget the myselections file) from your desktop to a CD/DVD and/or - dependent to the size - to a backup drive. Be careful!!! Better save your data twice. A CD or DVD could be defective. The securest way is a backup onto an external hard drive.

3. Install your new ubuntu

You can savely install your new ubuntu using and erasing (!) the whole partition using your old (!) username an password.

4. Recover

After you installed your new ubuntu (you can savely use the whole partition) do the same as above.

Copy back your backupfiles

Login to your new ubuntu with the same (!) username you used before. Establish an internet connection via the network manager.

Be sure you reenabled all your ppa archives. The easiest way is to to it in a terminal whith

sudo apt-add-repository ppa:YOUR_PPA/SUBDIR
sudo apt-get update

Copy the backup bakcup files from your backup media

  1. myselections
  2. yourUserName.tar.bz
  3. evt. evolution.tar.gz

to your desktop.

Now Logout.

Replay the backup

Switch to a terminal screen via Strg+Alt+F1 and login with your normal username!

Then enter the following commands:

cd /home
mv ${USER} ${USER}.save
tar xjvf ~/Desktop/${USER}.tar.bz

cd ${USER}/Desktop
sudo dpkg --set-selections < myselections
sudo apt-get dselect-upgrade

The last command could take a lot of time depending to your sources and internet connection.

Switch back to the graphical login screen with Strg+Alt+F7 (sometimes F8) and login with your username / password.

You should be able to login seeing your old desktop environment again.


If you get problems you might have to sync the avaiable packages list: ( https://lists.debian.org/debian-user-german/2014/06/msg00155.html )

sudo apt-get install dctrl-tools
sudo sync-available

Troubleshooting

Pulseaudio

Sometimes your audio might not work.

Deletion of the following folders / files might (!) help.

cd ~
rm -rf .pulse

In newer Ubuntu versions the pulse directory is in ~/config

cd ~/.config
rm -rf .pulse

Or simply restart the pulseaudio server:

pulseaudio -k

Reboot and sound should appear (if there are no hardware restrictions).

Updates did not went well

Restart the update process

dpkg --configure -all

or

apt-get -f install