Newest Ubuntu box -> Magnificence - GNU/Linux

Users browsing this thread:
venam
Administrators
(This is part of the podcast discussion extension)

You've been given the newest Ubuntu box with all the possible bloat
pre-installed (as in Unity, compiz, etc..). Your job is to turn it into
the magnificent rice machine within the time lapse of a week. How do you
proceed? (Hardmode: You only have remote access and you can't erase the
precious information from the drive)


This podcast was a simple talk between z3bra and I.
I went through my research and he commented on it.


Disclaimer: I did not test anything mentioned, it's a bunch of speculations.
I do not take responsibility for anything bad that might happen to you by
trying them.


-------------


To attack this challenge I divided it in 2 parts.
The first focusing on stripping down the box to a bare minimum, removing the
unnecessary, and the second being the ricing part, which is easy for us once the
box is stripped down.

Part 1:

* Remove useless packages with their installed dependencies

Go to `/usr/share/applications` and un-install everything. Yes, literally
everything that is in that directory.

To do that you'll have to find the program that is called by the desktop file.
It's after the `exec=`.


Code:
`grep -i exec *.desktop | awk -F. '{print $1}'`

Then simply `apt-get purge` them.


* Remove unity


Unity is a pain to any ricer. It messes up anything that is not Unity related.

Quote:> I was using Ubuntu at work because of the ease of use
> However I still wanted by bit of rice
> I installed ratpoison on the machine but...
> It kept having problems, IDK why, Unity is a mess with other WMs running
> I added the entry to lightDM and it still would give me problems!
< Yeah, I know
< I'm also using Ubuntu at work because it comes with everything pre-installed.
< Then I also wanted my grain of rice.
< I installed 2bwm but when you switch from TTY to TTY Unity breaks your things
< You startx and suddenly the sound is gone.
< That's ok, might just be a Unity+pulseaudio problem
< Then I'm using gmrun as a program starter but IDK why it kept being super slow to start
< I think Unity was catching everything Gnome related.

So, you can't run anything along Unity, it'll break.

This long line will save you:
Code:
sudo apt-get purge unity unity-2d unity-2d-panel unity-2d-spread unity-asset-pool unity-services unity-lens-files unity-lens-music unity-lens-applications gir1.2-unity-5.0 unity-common indicator-sound indicator-power indicator-appmenu libindicator7 indicator-application indicator-datetime indicator-messages libnux-2.0-0 nux-tools libunity-misc4 unity-2d-common

Don't forget to add users to the audio group or just uninstall pulseaudio.

There's another fix (untested):

Code:
mkdir ~/.pulse
echo autospawn=no > ~/.pulse/client.conf
pulseaudio -k


* Remove and un-install daemons that are useless

Ubuntu comes with a plethora of daemons.
We don't want most of them.

To list them you can use:

Code:
service -status-all

Or
Code:
rcconf

Then you purge them.

The service command is a wrapper for the init system of
Debian based distros.
Thus, it worked for SysV, Upstart and now systemd.
Indeed, on Ubuntu 15, it changed from Upstart to systemd.


* Remove the splash screen and login manager


To do that edit `/etc/default/grub`, and remove the "quiet splash". After this run `sudo update-grub2`.

To remove lightDM, edit `/etc/X11/default-display-manager` then uninstall it.


* Clean up the rest


There might still be a lot of program on the machine that aren't used.
To get a list of them we use the Debian package manager:
Code:
dpkg —get-selections
We purge them, as usual and then we run:
Code:
apt-get autoremove

To remove the packages that were installed as dependencies and are not needed
anymore.

* /etc/skel/

Make sure new users won't suffer. There might be things that are deployed when
they are created.


* A Nice Headless Box

At this point you should have a nice headless box, we cleaned it up.

I was wondering with Ubuntu 15 if a stripped down box wouldn't be equivalent to
a Debian box.

What's the difference anyway.

I did a mini-research and found this thread.


Quote:Debian uses SystemV style init, and inittab;
Ubuntu uses Upstart
Debian has root account enabled by default, but can be configured to use sudo;
Ubuntu uses sudo and has no root account enabled
Debian has a release cycle not predefined;
Ubuntu has a release cycle of six months (two years for LTS)
Debian has a rolling unstable release, called sid;
Ubuntu has nothing similar
Debian has a testing release that is destined to become the next stable;
Ubuntu has a development release, initially based on sid that becomes the stable
Debian uses gnome2/metacity by default;
Ubuntu uses gnome2/compiz+unity by default;
Debian is released for several architectures (more than every other distro);
Ubuntu essentially only for x86, ARM and amd64
Debian has also removed nonfree firmware from its kernel starting from squeeze, so it's harder to install on some machines.

Quote:Most of Ubuntu's packages are just recompiled from Debian, so the software defaults (like the Apache web server configuration) are identical. I have two servers, one running Ubuntu Server 11.04 and one running Debian 6.0 and there hasn't been a single instance where I couldn't just copy a configuration file between them and have it work correctly.

Well, well, since Ubuntu 15 and Debian Jessie are now both running systemd that
doesn't leave much of a difference.

Systemd has brought a weird "unity" to the Linux game. (Pun intended).

We wondered about the difference in hierarchy, but weren't sure about it.
Considering their relation, they are mainly compatible. Obviously because Ubuntu is Debian based.


* Sources And Package Managers

You can't escape the init system but you can escape other things.

The box being stripped to a bare minimum you could try changing the sources,
/etc/apt/sources.list, to point to other compatible repos.

You might try Jessie or Linux Mint. (This really needs to be tested).

If you are still not satisfied with APT you can try another package manager.

You leave APT for the bare minimum that you currently have and use the new
package manager for the rest.

Possible candidates are:

pkgsrc on Linux

here's a quick guide.

Alpine's apk
Void's xbps



Part 2:

The ricing part, the easy part.

I would personally use Ricerous as a reference to not forget anything.

There's not much to talk about here, we do that all the time with distros that let you start from scratch such as Debian, Arch, Crux, etc..


--------------

Another way?


There might be another way to rice the box without having to stick to Ubuntu
and strip it down.
You can install another distribution from a running OS, copy the files
to it, and then without rebooting switch to the other to erase and resize the new partition.


This is a bit extreme and complicated.


Ubuntu is running you install some static packages and tools.
You build the kernel image that you want to boot to.
You boot from RAMFS which has assess to ssh and your harddrive.
Once you have that you can resize the partition and install the other distro.

There's a wiki link of the Alpine distro discussing the topic.

Other interesting options:
ksplice
Quote:Ksplice is an open-source[2][3] extension of the Linux kernel that allows security patches to be applied to a running kernel without the need for reboots, avoiding downtimes and improving availability (a technique broadly referred to as dynamic software updating).
kexec
Quote:In computing, kexec (abbreviated from kernel execution, and derived from the Unix/Linux kernel call exec) is a mechanism of the Linux kernel that allows "live" booting of a new kernel "over" the currently running kernel.


Overall it was a great podcast!
(°∀°)b