IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
Now I don't have to unpack (or loop mount) ISO to boot via HTTP.
Also I can boot directly from any ALT mirror, like this:
automatic=method:http,network:dhcp,server:mirror.yandex.ru,directory=/altlinux/images/p9/simply/aarch64/slinux-live-9.1.1-aarch64.iso
Closes: #40710
* Use `unsigned long` to store the file size
* Return an error if the file size can not be found
* Avoid loading files >= 4GB on 32-bit systems
Related: #40710
- Find out stage2 size at the run time instead of relying on
the `ramdisk_size` parameter. As a result `ramdisk_size`
parameter is not required any more.
Closes: #40629
- No need to compute `ramdisk_size` in advance
- No need to pass `ramdisk_size` to the kernel => simpler ISO
remastering (and network boot setup)
- If the swap is enabled rarely used parts of the loaded image
can be paged out
Closes: #40629
- while loop terminates on read error **without** resetting
`seems_ok` to 0, thus read errors won't be noticed
- no check if bytes_read matches the expected image size
- ram_fd is leaked on write error
- short writes are treated as errors (when in fact they are
perfectly fine)
Therefore:
- Handle *all* read errors, not just the very first one
- If the image size is known in advance verify if we actually
read the whole image
- close `ram_fd` in error code paths
- Handle short writes properly
Closes: #40803
- Try older SMB/CIFS protocol versions if mounting a CIFS share failed
- Redirect propagator logs to ttyprintk (kernel log buffer) so they
can be easily inspected with dmesg.
* An old server might not support the (cifs.ko) default protocol version
* Crypto modules required for new(er) protocol versions might be missing
in initramfs
Related: #40554
- A complete boot log (both early userspace and kernel) is preserved
and can be obtained via `dmesg`
- Messages are ordered and timestamped, so the log is more clear
Example:
[ 5.616453] [U] * /sbin/mount.cifs //10.42.0.4/dist/slinux-9.1-x86_64.iso /image -oguest,vers=1.0
[ 5.616932] CIFS: Attempting to mount //10.42.0.4/dist/slinux-9.1-x86_64.iso
[ 5.616940] CIFS: VFS: Use of the less secure dialect vers=1.0 is not recommended unless required for access to very old servers
[ 5.621647] CIFS: VFS: Could not allocate crypto cmac(aes)
[ 5.623263] CIFS: VFS: Could not allocate crypto cmac(aes)
[ 5.626645] [U] mount error(20): Not a directory
[ 5.626649] [U] Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
[ 5.626747] [U] * assuming ISO image, Samba path://10.42.0.4/dist
[ 5.626749] [U] * mounting //10.42.0.4/dist on /image as type cifs
[ 5.626753] [U] * cifsmount: attempting to mount //10.42.0.4/dist with default protocol version
[ 5.626758] [U] * /sbin/mount.cifs //10.42.0.4/dist /image -oguest
[ 5.627299] CIFS: Attempting to mount //10.42.0.4/dist
[ 5.629106] CIFS: VFS: Could not allocate crypto cmac(aes)
[ 5.631290] CIFS: VFS: Could not allocate crypto cmac(aes)
[ 5.638261] CIFS: VFS: \\10.42.0.4 generate_key: crypto alloc failed
[ 5.638264] CIFS: VFS: \\10.42.0.4 Send error in SessSetup = -2
[ 5.638275] CIFS: VFS: cifs_mount failed w/return code = -2
[ 5.638294] [U] mount error(2): No such file or directory
[ 5.638296] [U] Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)
[ 5.638376] [U] * cifsmount: failed, retrying with vers=1.0
[ 5.638383] [U] * /sbin/mount.cifs //10.42.0.4/dist /image -oguest,vers=1.0
[ 5.639582] CIFS: Attempting to mount //10.42.0.4/dist
[ 5.639590] CIFS: VFS: Use of the less secure dialect vers=1.0 is not recommended unless required for access to very old servers
[ 5.649559] [U] * assuming ISO image, path:/image/slinux-9.1-x86_64.iso
Related: #40554
So it's easier to debug a failed boot.
While at it avoid closing stdin, since a printf might inject
unexpected input into a wrong place (a socket with FD 0).
Redirect stdin from /dev/null instead.
While at it improved error handling a bit (fork, waitpid can fail)
nfsmount: same here
Related: #40554
Also skip interfaces which can't be brought up for some reason
(i.e. missing firmware). Thus the system can boot automatically
when exactly one interface has a carrier.
Closes: #40616
LOOP_SET_FD, LOOP_SET_STATUS ioctls trigger a `change` event with
loopback device in question. udev handles those events with
(builtin) blkid command. Probing a device with blkid takes a while,
so init might try to mount the loopback device in question while
`blkid` is still running. As a result init and udev block each other.
Eventually (after 3 minutes or whatever udev event timeout is)
`blkid` gets killed and boot proceeds. However such long delays are
very annoying. Therefore run `udev_settle` after each loop related
ioctl to avoid the concurrent access to the same loopback device.
Closes: #40687
- mkmodpack: include leading directories for firmware files
The kernel needs leading directories in the cpio archive when
creating rootfs. Otherwise, the files will not be copied.
- Add support 'fuid' automatic mode option for method cdrom
- Fix potential memory overflow in welcome string
- Set PREFIX to "/" for nfs and cifs methods due its mounted to image root
stage1.c:354:41: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size 117 [-Wformat-truncation=]
snprintf(buf, sizeof(buf), "Welcome to %s", version);
^~ ~~~~~~~
In file included from /usr/include/stdio.h:862,
from stage1.c:30:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 12 and 139 bytes into a destination of size 128
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The installed system can have several devices with the same structure.
The automatic 'fuid' option can be used to detach one from the other to find the
partition where our stage2 image is stored, launched from stage1 (in this case
propagator). This option works automatically with the cdrom method:
- automatic=method:cdrom,fuid:PATH_TO_UNIQ_UID_FILENAME
- mkmodpack: warn about incorrect patterns
Kernel modules may be needed to access rootfs.
Such modules must be present in the initramfs.
The mkmodpack script finds modules by given patterns.
If the pattern is specified incorrectly, the module
will not be found and booting will become impossible.
Need to warn about module patterns that do not match with anything.
Kernel modules may be needed to access rootfs.
Such modules must be present in the initramfs.
The mkmodpack script finds modules by given patterns.
If the pattern is specified incorrectly, the module
will not be found and booting will become impossible.
Need to warn about module patterns
that do not match with anything.
The pattern can match the name of a module built into
the kernel as given by modprobe.
However, modprobe can fix some incorrect patterns.
These patterns should also be reported.
- fix hangs until http socket not closed on server side (closes: #37150)
- tools.c: break reading cycle if we actually loaded program into memory
- url.c, network.c: disable keep-alive and close http socket after downloading
- dhcp.c: Remove temporary default route properly (altbug:#34347).
- dhcp.c: Provide DHCP vendor class identifier in requests (altbug:#34320).
This behaviour can be reverted with a kernel command line parameter.
DHCP is implemented in propagator in a rather lazy way:
to dynamically configure a network interface, say `eno1',
instead of slinging raw Ethernet frames around like everyone else,
it sets up a (temporary) default null route through that interface
and throws UDP messages with actual bootp payload.
`ip' utility describes such a route as `default dev eno1 scope link'
The idea behind this presumably was to avoid generating IP and UDP
headers manually while the null route is sufficient to send a couple of
link-wide (maybe broadcast) messages and generic enough to work anywhere.
To this date propagator didn't bother to remove that route,
so *in some networks* it had persisted even after the initramfs
(and propagator itself) was long gone, and in other networks did not,
having been luckily replaced by the default route to DHCP gateway.
In the cases where it did the real problem showed itself
after the real userspace (for example, in a live distro)
eventually tried to reconfigure the network (because why not?).
The pesky null route was most often left untouched by the DHCP client
(ALT live distros mostly use dhcpcd), managing to squeeze its way
up the routing table and effectively preventing the host
from network access beyond a router.
If the NFS root is behind a couple routers, any attempt to access
the file system gets stuck — the system keeps tirelessly looking for
the NFS host via ARP.
Some obsolete DHCP implementations in specialized network hardware
(Cisco, we're looking at you) discard DHCP messages from a client
attempting to reconfigure itself and providing a different vendor class
identifier the second time — much like a network-booting system.
To cope with that, propagator will not send a vendor class identifier
if `dhcp-send-vendor-id:off' is specified as part of its "automatic"
parameters on the kernel command line.
Feel free to use any boolean value: yes/no, true/false, on/off.
The default behaviour is "yes".
- New udev control logic imported from make-initrd scripts.
- Udev-trigger replaced to udev-settle() in hardware wait loops.
- All udev control code moved from init.c to new udev.c module.
- Lazy initialization mode support added for work in cooperate
with make-initrd: this is experimental future, turned off by
default, and also required patched make-initrd-propagator.
- disk.c, cdrom.c: 15 attempts with udev-settle() calls.
- network.c: bridge up algorithm reviewed, fixed memory leaks.
- network.c: 15 attempts to select and wait network interface;
- probing.c, probing.h, dhcp.c: small fixes, now black list used.
- modules_descr.h, stage1.c: deprecated header, unused code removed.
- dhcp.c: fix potentially destructive typo (closes: #34322),
thanks to Arseny Maslennikov <arseny@altlinux.org>.
- Workaround race conditions during disks detection (closes: #30315).
- Workaround race conditions during bridging up network interfaces,
see: https://bugzilla.altlinux.org/show_bug.cgi?id=34347 and
https://lists.altlinux.org/pipermail/sysadmins/2018-April/date.html
(about "No network Devices found" error message).
- Multiple small code improvements, fixes for avoid memory leaks
and suppress compiler warnings.
This change also suppress a compiler warning:
network.c:307:18: warning: '%d' directive writing between
1 and 11 bytes into a region of size 3 [-Wformat-overflow=]