GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing hellosystem.github.io — Boot process — helloSystem documentation Boot processSpeeding up the boot processAs a desktop-centric system, helloSystem should bring up a graphical desktop as soon as possible, and delay starting up other services such as the network beyond that point. Unfortunately, in the FreeBSD default configuration this is the other way around, and the graphical desktop will only start after the network has been configured, the time has been set using NTP, etc. While it would be possible to change the order of the scripts in Instead, we can disable the services in question so that they don’t get started as part of the normal FreeBSD boot sequence, and start them later in the boot process (after the graphical session has been started) using a custom start script. Note The following instructions are DANGEROUS and can potentially lead to a system that cannot boot into a graphical desktop if things go wrong. This is currently only for developers and experienced users who know how to handle such situations. Future versions of helloSystem may come with this already set up. To do this, create a Boot Environment that you can roll back to in case things go wrong. In defaultroute_carrier_delay="0" defaultroute_delay="0" background_dhclient="YES" Then create the following #!/bin/sh # PROVIDE: late-start # REQUIRE: slim PATH=$PATH:/usr/sbin export PATH . /etc/rc.subr name="late" start_cmd="${name}_start" extra_commands="disable_early_services" disable_early_services_cmd="${name}_disable_early_services" # NOTE: devd needs to stay enabled in early boot # so that we have a working mouse pointer as soon as Xorg is started SERVICES="setup-mouse webcamd vboxservice dsbdriverd netif routing defaultroute avahi-daemon clear-tmp cupsd ntpdate smartd sshd" late_start() { service devd restart # For networking; invokes dhcpd for SERVICE in $SERVICES ; do service "$SERVICE" onestart done } late_disable_early_services() { for SERVICE in $SERVICES ; do service "$SERVICE" disable done } load_rc_config $name run_rc_command "$1" Disable the services in question with $ sudo chmod +x /usr/local/etc/rc.d/late-start $ sudo service late-start disable_early_services Check which services are still enabled, should now be greatly reduced: $ grep -r 'enable="YES"' /etc/rc.conf* /etc/rc.conf:clear_tmp_enable="YES" /etc/rc.conf:dbus_enable="YES" /etc/rc.conf:initgfx_enable="YES" /etc/rc.conf:load_acpi_enable="YES" /etc/rc.conf:slim_enable="YES" /etc/rc.conf:zfs_enable="YES" Reboot. The graphical desktop (including a usable mouse pointer) should appear ~10 seconds faster, but the network will start to work only after ~10 seconds. Note This starts services like sshd; you need to edit the Debugging the Live system boot processAs soon as the screen becomes grey, press “s” to boot in single-user mode. The system will boot to the first stage Live system prompt:
At this point, the Live system has not been made writable yet. Enter exit to contine. The system will boot to the second stage Live system prompt:
At this point, the system has been made partly writable by the Hit the Enter key on your keyboard. Here you can make changes to files like For example, you can $ mv /usr/local/bin/start-hello /usr/local/bin/start-hello.original $ ln -sf /usr/local/bin/xterm /usr/local/bin/start-hello Then enter exit to contine. The system will boot into the graphical desktop. If you have made the above changes, you can run $ sh -x /usr/local/bin/start-hello.original to watch
Here you can see what goes wrong, if anything… and then you can create, e.g., a replacement Live system early boot processNote This section describes helloSystem boot process up to 0.6.0. Starting with version 0.7.0, helloSystem will use a completely different live system boot process. This page needs to be updated accordingly. The ISO contains a compressed Live system filesystem image in uzip format. This filesystem image contains the filesystem used when running the ISO. During the Live system boot process, the image needs to get mounted and needs to get turned into a read-write filesystem so that one can make changes to the running system. FreeBSD does not have a standard way to achieve this, so custom code has to be used. (The ISOs provided by the FreeBSD project do not use a compressed Live system filesystem image, and do not result in a read-write filesystem when being booted.) This is a simplified description of the boot process. There may be additional aspects which still need to be documented.
Troubleshooting the Live system early boot process
Seeing what the system is doing while the graphical boot screen is shownWhile the graphical boot screen is being displayed you can press Ctrl+T to see what it is doing at that moment in time. By keeping Ctrl+T pressed down you can see what is going on over time. By then pressing ScrLk, you can use PgUp and PgDn to scroll around. The following information will be printed to the screen for the most relevant process based on recency and CPU usage (as decided by
Example: Boot in verbose modeIf you would like to observe the details of the boot process, you can start your computer in verbose mode. This allows you to inspect the Live system early boot process and to enter commands manually that would otherwise be executed automatically. Since helloSystem 0.8.1: To boot in verbose mode, press the v key on your keyboard as soon as the screen becomes grey. Before helloSystem 0.8.1:
The computer should boot into a graphical desktop. Boot into verbose single-user modeIf your computer hangs during booting, you can boot into verbose single-user mode. This allows advanced users, administrators, and developers to inspect the Live system early boot process and to enter commands manually that would otherwise be executed automatically. Since helloSystem 0.8.1: To boot in verbose single-user mode, press the s key on your keyboard as soon as the screen becomes grey. Before helloSystem 0.8.1:
The computer should boot into a text console rescue system in which parts of Note Single-user mode on the Live system currently is for developers of the Live system only. If you boot the Live system into single-user mode, then you will be dropped into a shell in the ramdisk, and you are expected to manually enter the commands required for the Live system to continue booting which would otherwise be executed by the ramdisk automatically. Specifically, you need to enter everything below the line “Running in single-user mode” in the file overlays/ramdisk/init.sh (or variants thereof). If you just exit the shell without doing this, then the system will be unable to continue booting. Graphical desktop start process
Troubleshooting the graphical desktop start process
Installed system boot processThe boot process is the regular FreeBSD boot process. Please refer to The FreeBSD Booting Process for more information. Boot MuteSetting Since helloSystem targets a broad audience including non-technical users, the following behavior is intended:
To achieve this, helloSystem uses a combination of the following techniques:
Note Please note that if any errors are displayed on the screen during the boot process, the boot splash may still end early. In this case, the reason for the error message needs to be identified, and the message needs to be silenced. To see boot messages, set Modifying bootloader scriptsThe bootloader executes lua scripts as part of the boot process. This is not documented extensively in the FreeBSD documentation. To work on the lua scripts, it is useful to
Possibly there is also a way to use a lua interpreter on the booted system to work on and debug the lua scripts, but this is currently unknown. The following does not seem to work: % lua54 ./loader.lua
lua54: ./core.lua:447: attempt to index a nil value (global 'loader')
stack traceback:
./core.lua:447: in field 'isSystem386'
./core.lua:56: in local 'recordDefaults'
./core.lua:525: in main chunk
[C]: in function 'require'
./cli.lua:31: in main chunk
[C]: in function 'require'
./loader.lua:36: in main chunk
[C]: in ?
The mount -uw / cd /boot find . -name '*4th*' -exec rm {} \; rm *.rc Removing the misleading files makes it easier to see which code actually gets executed. All the scripting is essentially happening in One can then edit the scripts in It seems that So if we would like to run a “hello world”, we would need to place it at that path.
function core.isMenuSkipped() return string.lower(loader.getenv("beastie_disable") or "") == "yes" end
if not core.isMenuSkipped() then require("menu").run() else -- Load kernel/modules before we go config.loadelf() end Directly above this, there is try_include("local") which seems to suggest that we can hook in our own code there by creating a new file https://github.com/helloSystem/ISO/blob/experimental/overlays/boot/boot/lua/local.lua
This allows us to
The lua environment in the FreeBSD bootloader has some functions starting with
This list was generated on a system on which the FreeBSD source code is installed in grep -r '^lua_' /usr/src/stand/liblua/*.c | cut -d ":" -f 2 | sed -e 's|lua_|loader.|g' | sed -e 's|loader.State \*L||g' | sed -e 's|^|* \`|g' | sed -e 's|)|)\`|g' |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |