Question: Would it be feasible and not overly complicated to add an option to 'crouton' to remove a DE/target along with the update option? Maybe by specifying the target with a '-' sign in front something like:
sudo sh -e ~/Downloads/crouton -n saucy -t -cinnamon -u
And then just reversing/uninstalling the target packages and dependencies?
It would be tricky to remove the packages, as some are pulled in by different targets, and we do not keep track of what each target installs.
On the other hand, we should probably have a way to remove a target from the list, so it does not get run again on update, and the user could manually remove the packages, if desired. The current way to do this is to edit /etc/crouton/targets manually, but we could do something in the installer, along the lines of what you are suggesting.
Okay, I thought there might have been an INSTAll variable declared or something that would list the packages needed for the target but, in looking at the 'cinnamon' target and a few others, I see that's not the case.
I can edit the /.crouton-targets and the /etc/crouton/targets files to remove the target but would it be safe to remove the packages listed on the _install_ line in the target script using apt-get remove ..., like in 'cinnamon' -
install --minimal ubuntu~precise=,cinnamon-control-center \
cinnamon-screensaver nemo
and -
install --minimal cinnamon \
ubuntu~precise+ubuntu~quantal=,ubuntu~raring=nautilus,nemo \
ubuntu~precise=gir1.2-gjsdbus-1.0, \
ubuntu=gnome-icon-theme-full,debian=gnome-icon-theme, \
gnome-themes-standard gnome-session gvfs-backends muffin python-cairo \
python-pam python-pexpect
I'm afraid the answer is _no_ since it looks like it might remove some other necessary packages.
Thanx for your input,
-DennisL
That should be fine, as long as none of these packages are installed by other targets.
Actually, I think the smartest way is to mark all these packages as auto (look into apt-mark auto ...: these packages are removed when nothing depends on them), then update the chroot: it will set packages installed by other targets back to manual, then clean-up what is not needed anymore.
Needs testing, backup you chroot first (but I'm sure you did that already ,-))
That is some great advice & info.
I didn't know about apt-mark auto ... but I'll dig into it and try this out.
Thanx again,
-DennisL
P.S. You can 'close' this if you want as far as I'm concerned - or keep it open if you think others may want to chime in.... ( Kind'a looks like it's just you and me though :-)
apt-mark auto + update is a pretty interesting approach. If we were to implement target uninstall, we'd probably instrument the install command to track the packages installed per target in a file somewhere, then apt-mark auto all of them if the target is uninstalled. We don't want to have to manually script installation.
We do have to ensure that all scripts react sensibly if the packages they depend on are removed, but I think we already do a pretty good job of this.
I did successfully remove both gnome & unity with this method on my raring
chroot. I just grabbed the packages the targets used and applied them to
the 'apt-mark auto ...' command line. I then removed the 'gnome' &
'unity'targets from both '/.crouton-targets'
and '/etc/crouton/targets' and ran 'apt-get autoremove' which didn't seem
to do anything then I ran 'apt-get install -f' and that seemed to trigger
the removals. It probably would have been easier and maybe cleaner to just
exit the chroot and run a crouton update. I'll probably use that method in
the future. I did note that not all the packages seemed to get removed but
that's a good thing I'm sure...
All in all, I think this method will work and maybe worth automating all or
part of it in crouton.
Thanx again for the method and help,
-DennisL
On Thu, Mar 27, 2014 at 6:19 PM, David Schneider
[email protected]:
apt-mark auto + update is a pretty interesting approach. If we were to
implement target uninstall, we'd probably instrument the install command to
track the packages installed per target in a file somewhere, then apt-mark
auto all of them if the target is uninstalled. We don't want to have to
manually script installation.
We do have to ensure that all scripts react sensibly if the packages they
depend on are removed, but I think we already do a pretty good job of this.—
Reply to this email directly or view it on GitHubhttps://github.com/dnschneid/crouton/issues/717#issuecomment-38868147
.
Still seems plausible...I wonder if we could run the target but with install() and whatnot overridden to apt-mark auto...
Hey DennisL
Sorry to bother you, but I needed to remove a target which I recently installed (KDE - wishful thinking). I am not a pro at crouton/ linux. Can you please elaborate on the first step - "just grabbed the packages the targets used and applied them to the 'apt-mark auto ...' command line". I can help you in any way possible, but it seems like something useful to have on the forums.
Thanks a lot in advance!
@nakulbende,
This is part of the 'kde' target:
### Append to prepare.sh:
install --minimal kde-plasma-desktop -- network-manager
So I think you'll just need to do:
sudo apt-mark auto kde-plasma-desktop/.crouton-targets and /etc/crouton/targetsapt-get install -fThe 3rd step _may_ not be necessary but it shouldn't hurt anything.
Thank you for this very helpful thread. Can I check, @DennisLfromGA, when you say "grabbed the packages the targets used and applied them to the 'apt-mark auto ...' command line", where should I look to find the packages that, say, unity used?
(Not to add to unnecessary notifications, so this just to say, thanks @DennisLfromGA , your advice worked a treat.)
@DannyQuah,
All the crouton target files are here: targets
You can click on both unity & unity-desktop and find the install ... line(s) to determine what packages are included with each target.
@Dennis
FYI: When you @Dennis - you notify me. Please don't unless you wan't me attention
@Dennis - My bad, sorry.
I usually sign my posts with 'DennisL' but I evidently left off the 'L' previously.
I just now discovered that 'DennisL' is also flagging the wrong account so I'll cease and desist that too. :/
I'll be sure to sign-off as '@DennisLfromGA' or just '-DennisL' in the future.
Thanx for post, I'm sure 'DennisL' thanks you too. ;)
-DennisL
Don't worry about it. You're not the first, and probably not the last doing that :)
Data point: I tried to remove xiwi to slim down the install to cli-extra,extension on xenial -- because I do use CLI interaction (croutonwebsocket, croutonnotify, croutonurlhandler), but none of the graphics. I took a look at targets/xiwi, cross-checked what it installed with apt-mark showmanual, and ran sudo apt-mark auto xserver-xorg-video-dummy x11-utils xautomation xbindkeys xorg xclip dmz-cursor-theme && sudo apt-get autoremove. I then removed x11, xorg, audio from /.crouton_targets and /etc/crouton/targets. Unmounted, ran an update, and watched it fail:
The following packages have unmet dependencies:
xserver-xorg-video-dummy : Depends: xorg-video-abi-15
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
Failed to complete chroot setup.
The failure is, of course, that I hadn't checked targets/extension, or I would have seen that extension installs xorg and x11, too.
Takeaways:
autoremove last. The order is:/.crouton_targets and /etc/crouton/targets,apt-mark auto the packages you imagine you'll get rid of without said targets,auto to manual,sudo apt-get autoremove.Determining what packages to attempt to remove is the most opaque part of the process. I wonder if the info necessary for that could be reliably determined by doing a dry-run of target installations? The broad logic I imagine for crouton -u -n chroot -t xfce4,-lxde:
auto, so mark them.autoremove or instruct the user to.No idea if this is doable, or doable consistently across installers / releases. I'll try and see how much of this is wishful thinking; suggestions appreciated.
This would be a really welcome change for me. Afterwards, I would finally be able to remove xfce from my encrypted chroot (is there a way to currently do it?).