I am trying to build a custom ISO, using ubuntu-builder
. I've taken a 12.40 mini remix ISO as a starting point. Here is my specific example - however, I'm interested in principle how the process goes (so I can apply that to other DE/WM).
when I run a new ISO, built directly from the mini remix starting ISO, all is as expected - I can run the new ISO in a virtual machine, and the boot process terminates with text-only prompt for the live ubuntu
user.
Now, I try to install LXDE (there is an entry for it in ubuntu-builder
, apparently it installs lxde-core
and X dependencies; and I manually have to install lxterminal
, and as icons are missing, probably lxde-icon-theme
as well). I have to also manually install xinit
, so I have startx
. But this, by itself, doesn't do much: if I boot this customized ISO in a virtual machine, the exact same thing happens as with the "original" ISO - boot process completes with a text mode prompt for ubuntu
live user.
If I now type startx
at this prompt, then LXDE starts (running startlxde
at this prompt will complain about X), such that when you start lxterminal
from that desktop, it is started under the live ubuntu
user.
In LiveCDCustomization - Boot init, it is mentioned:
Boot init
You have to edit the files in edit/usr/share/initramfs-tools/scripts/casper-bottom/* For example you can change the hostname or the livecd user.
... but I don't exactly understand what is exactly being ran by what there. The ubuntu-builder
unpacks these files under /home/ubuntu-builder/FileSystem/usr/share/initramfs-tools/scripts/casper-bottom/
- but as far as I can see, most of these just run some inline sed
commands, I cannot see much executive commands there?
Still, I tried to copy one of the scripts there as a new script, 51startx
, which in the executable section has:
log_begin_msg "$DESCRIPTION"
chroot /root startx
chroot /root startlxde
log_end_msg
This does absolutely nothing - again, after boot, I get the usual text prompt ubuntu@ubuntu:~$
.
Then I found Modify: Startx automatically, add apt, etc - backtrack-linux.org:
To have a graphical login, just install gdm and run it in startup:
aptitude update aptitude install gdmThen, edit /etc/rc.local, and add a line BEFORE "exit 0" like this:
service gdm startThis is not the best way, but run! . This must work running "update-rc.d gdm defaults", but this way fail.
And indeed - I added:
startx
startlxde
... to /etc/rc.local
- and this indeed does boot, and start LXDE automatically - however, when I run lxterminal
, it is under user root
- not under the live user ubuntu
!
So, what should I do, so that I can start (any) X and/or any desktop environment automatically at boot under the live ubuntu
user?
Note that in this case, I would not like to use an additional desktop manager (e.g. gdm
) nor a corresponding greeter - but it would be good to know, if a solution for automatically starting up X would also work for a desktop manager or a greeter.
OK, I think I got somewhere - but still don't quite get it, so a proper answer would be appreciated :)
But, basically: the boot process starts, somewhere in there the
init
process run, and the kernel loads - but also, some startup scripts run. These scripts are part ofinitramfs
, from within the booting kernel they are referred to as/scripts/...
- however, in the unpacked file system ofubuntu-builder
they would be in./FileSystem/usr/share/initramfs-tools/scripts/
. Eventually - in a typical install - this would end up with loading the given Display Manager (DM), which "presents the user with a login screen which prompts for a username and password"; where apparently one design of such a screen in a DM is known as a greeter. Once the login has been performed in the DM greeter, then control is passed onto the Desktop Environment/Window Manager (DE/WM). I'm still not clear who/what starts the DM in the first place; but if it is started, I guess the DM afterwards is the starter of the DE/WM (depending on login authentication and settings). Or:I still cannot tell the difference between the DE and WM properly, but for example,
LXDE
is apparently a DE (as per the name); and typically it is used withopenbox
as a WM. So, in other words, what I want here is to skip the DM, and go directly to DE/WM as the liveubuntu
user.Back to the boot scripts - particularly, the
init-bottom
andcasper-bottom
are visible in the boot log messages - which are also available in the file/var/log/boot.log
, once the ISO finishes booting and we can useless
. Particularly interesting are these scripts:So, the
autologin
script basically counts on a Display Manager (DM) being already installed (in the CD image) - and simply searches for possible config files thereof, and replaces inplace usingsed
, such that the particular DM performs an automatic login, once it is started (by whatever usually starts it). On the other hand, theadduser
script creates the live userubuntu
from scratch during boot - and as such, there are no files we could apriori edit and store on the CD image.The good thing, however, is that these scripts definitely run before
/etc/rc.local
runs, which runs before thebash
terminal is ultimately started at end of boot. So what I've done, is used the/etc/rc.local
file to "inject" anX
startup sequence in~/.bashrc
of theubuntu
user:So, in brief:
.Xauthority
will not help here; the failure will be "X: user not authorized to run the X server, aborting.
"startx
into.bashrc
will not help here; the failure (after a long black screen) will be "Server is already active for display 0
"startx
within anif [ ... ]
check will succeed (but I don't understand why would a simpleif []
make a difference?)!In my case, that
startx
command starts bothLXDE
andopenbox
, so both the DE and the WM (how and why, I still don't understand). So all looks good now - except for icons, and that I have no shutdown, suspend, hibernate and reboot options. But at least the immediate problem in my OP is solved. However, I'd still appreciate a more proper description of what goes on here.Below are some links/quotes which I found useful: