Ubuntu – Are the two ubuntu installs on separate partitions sharing the same apt-get data

aptpackage-managementpartitioning

I have two ubuntu installs on two separate partitions, one Unity and one Gnome-Shell. They both use a common encrypted /home partition. That sort of setup has worked well for me in the past, but for some reason I'm getting a lot of package management problems lately. When I use Software Center on my Unity parition, it shows that I have installed the gnome3 ppa, which is only installed on my other partition. Are these two partitions sharing the same apt-get data now? That can't be right. If so, how can I fix this?

Best Answer

I suppose that you can solve your problem moving the following directories

~/.config/software-center
~/.cache/software-center

somewhere out of your home.

You have two alternatives:

  • continue on both installations with the present content of such dirs;
  • start with an empty content.

In my opinion the second alternative is recommended, as it will have the same effect of starting Software Center for the first time.

Now close Software Center, if it is running, and do a preventive backup of such directories, in case something will go wrong.

First Alternative

So, to begin with the first alternative, do the following.

Login on the first installation and do:

# Create a local copy of 'software-center' dirs
sudo mkdir -p /usr/local/software-center/{.config,.cache}
sudo chown -R $USER:$USER /usr/local/software-center
cp -a ~/.config/software-center /usr/local/software-center/.config/
cp -a ~/.cache/software-center /usr/local/software-center/.cache/

Login on the second installation and do:

# Same as before
# Create a local copy of 'software-center' dirs
sudo mkdir -p /usr/local/software-center/{.config,.cache}
sudo chown -R $USER:$USER /usr/local/software-center
cp -a ~/.config/software-center /usr/local/software-center/.config/
cp -a ~/.cache/software-center /usr/local/software-center/.cache/

The following commands, operating on the HOME, should be executed only on one of the two installations, and they will have effects on both installations.

# Remove the original common copy
rm -r ~/.config/software-center
rm -r ~/.cache/software-center

# Link local copy to where 'software-center' expect to find dirs
ln -s /usr/local/software-center/.config/software-center ~/.config/software-center
ln -s /usr/local/software-center/.cache/software-center ~/.cache/software-center

Now the two installations points to different versions of the dirs.

Second Alternative

Regarding the second alternative, you can substitute the four cp commands with two mkdir, one for each installation:

mkdir /usr/local/software-center/{.config,.cache}/software-center

all other commands could rest the same.

I choosed /usr/local/software-center as the base dir for the local copies, but you can choose every dir you want, as long as it do not belongs to home.

Related Question