I remembered another reason, edited to add as 1B + clarified why I'm sticking to Porteus' "unmarked ESP."
[Solved] The generic Linux installer is incompatible with Ubuntu + fixing LILO/exFAT
- ncmprhnsbl
- DEV Team
- Posts: 3941
- Joined: 20 Mar 2012, 03:42
- Distribution: v5.0-64bit
- Location: australia
- Contact:
The generic Linux installer is incompatible with Ubuntu
try this one, some quoting added , untested here, because my device names are names not sentences :p
Porteus-installer-for-Linux.com md5sum: 10b8580d87f929a829f30fa5c9f2a26b
i noticed there's a variable: $USER_PWD the makeself exports at extraction that is the launch directory, so i just added PWD="$USER_PWD" to the installer.com script and so no arg passing needed.
there's no plans to change the default bootloader any time soon, i was just pointing out that there's many ways to boot porteus that people are free to use and the docs could/should reflect that.
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44
[update:LILO/exfat] The generic Linux installer is incompatible with Ubuntu
lolncmprhnsbl wrote: ↑21 Feb 2024, 02:10try this one, some quoting added , untested here, because my device names are names not sentences :p
me too normally, i'm just probing edge cases.
All working now.
No need to change anything!
Thank you for working on this.
I'm struggling because I feel guilty if I leave ignoring errors (like I have a responsibility to say something), even if they don't currently have an effect. (pathological perfectionism)
You can ignore the rest of this message.
-------------------------------
- Your defined targetdir is being ignored here. For example, if I replace it with targetdir="/tmp2blablabla", it still extracts to /tmp/..., because the MakeSelf logic actually ignores the targetdir and extracts to /tmp unless it's "." or (edit: if keep="y" such as when) re-assigned by the user with --target. Seems like a MakeSelf bug.
- A warning about /tmp getting deleted.
It warns that "/tmp will be removed after extraction", but it doesn't seem to be. Probably a wrong message.
Code: Select all
bash Porteus-installer-for-Linux.com --info
- Unquoted rm -rf $bin on installer.com line 10, so in theory this could happen:
Code: Select all
$ mkdir /home/bob/myfiles $ touch /home/bob/myfiles/super_important_stuff $ bash Porteus-installer-for-Linux.com --target "/home/bob/myfiles 2" ... Installer needs roots privileges to run # Then this happens: rm -rf /home/bob/myfiles 2/... # super_important_stuff got deleted
- But $bin was used uninitialized there, so rm -rf just deletes air.
- $bin is also used uninitialized on line 34, so failing to cleanup.
OK I'm done
It's fine the way it is.
Thank you again
:bricks_falling_on_head:
Last edited by jjr on 22 Feb 2024, 21:12, edited 1 time in total.
- ncmprhnsbl
- DEV Team
- Posts: 3941
- Joined: 20 Mar 2012, 03:42
- Distribution: v5.0-64bit
- Location: australia
- Contact:
[Solved] The generic Linux installer is incompatible with Ubuntu
apparently i didn't ..
Porteus-installer-for-Linux.com md5sum: 2acc0428f66ce7bcd2a002d1493bd490 (all the previous links are the same file)
- updated my makeself.sh to the latest for good measure
- removed the rm -rf $bin s because as you say they're not needed, makeself handles this itself
- removed setting PWD=$USER_PWD and used $USER_PWD directly in the two instances it's called
Code: Select all
Identification: Porteus Installer
Target directory: build
Uncompressed size: 512 KB
Compression: gzip
Encryption: n
Date of packaging: Wed Feb 21 16:01:58 AEST 2024
Built with Makeself version 2.5.0
Build command was: ./makeself.sh \
"build" \
"Porteus-installer-for-Linux.com" \
"Porteus Installer" \
"./.porteus_installer/installer.com"
Script run after extraction:
./.porteus_installer/installer.com
build will be removed after extraction
and if a --target (.ie an extraction point) is specified, as you say, if it isn't "." , it's ignored.. but info will then put that as the "Target directory"
"build will be removed after extraction" seems meaningless, or just plain wrong if it's meant to refer to the extraction point.
so yeah, seems like a bug, harmless or i'm doing it wrong
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44
[Solved] The generic Linux installer is incompatible with Ubuntu
Checked √ncmprhnsbl wrote: ↑21 Feb 2024, 06:47md5sum: 2acc0428f66ce7bcd2a002d1493bd490 (all the previous links are the same file)
> targetdir="build"
Yeah, that fixes the info report.
But not sure I'd rely on MakeSelf ignoring the targetdir, since if they change that behavior, their fix will break the installer now (i.e. extracting to "boot/build" = owner/perm issues on FAT).
I would just put targetdir="/tmp/porteus_temp", myself.
Their cleanup was different when targetdir was "." (including at one point erroring trying to remove "." )
Man, I give up trying to understand their semantics... nyf
[update:LILO/exfat] The generic Linux installer is incompatible with Ubuntu
So sorry to bother you.
One major regression, plus something odd.
1. This issue affects only the LILO part of installer.com, which gets used if Porteus is located on an exFAT drive.
You caught something, I totally missed:
Code: Select all
# would have installed extlinux to user's system drive ("df -P /tmp" -> /dev/sda3)
"$bin"/$extlinux -i "$IPT"/syslinux >/dev/null 2>&1
Code: Select all
"$bin"/$extlinux -i "$USER_PWD"/syslinux >/dev/null 2>&1
It's probably also installing LILO to the user's system drive too (if that's where /tmp is located)
2. MakeSelf apparently has a 'copy' mode (not currently user-accessible??), where USER_PWD gets borked (see line ~560):
Code: Select all
cd "$TMPROOT"
export USER_PWD="$tmpdir"
exec "$SCRIPT_COPY" --phase2 -- $initargs
(Very very confused as to why they are doing this...)
---------------
edit: If 'copy' mode is never touched, then I think these definitions should work:
Code: Select all
IPT="$USER_PWD"
bin="$PWD/.porteus_installer"
[update:LILO/exfat] The generic Linux installer is incompatible with Ubuntu
critical edit at end above
-------------------------------------
Also a key difference between the official Porteus installer and @ncmprhnsbl's's update threw me off, and I said something misleading earlier.
..
-------------------------------------
Also a key difference between the official Porteus installer and @ncmprhnsbl's's update threw me off, and I said something misleading earlier.
- Official Porteus has keep="y" in the Makeself script, which honors the targetdir but doesn't clean up. Requires the rm -rf "$bin" ...
- @ncmprhnsbl's uploads have keep="n" in the Makeself script, which ignores the targetdir but cleans up.
..
- ncmprhnsbl
- DEV Team
- Posts: 3941
- Joined: 20 Mar 2012, 03:42
- Distribution: v5.0-64bit
- Location: australia
- Contact:
[update:LILO/exfat] The generic Linux installer is incompatible with Ubuntu
good catch ..
Porteus-installer-for-Linux.com md5sum: 6775063fd7eff3030e8285dfaabb886a (all the previous links are the same file)
now fixed, hopefully
i rearranged the whole section defining things:
Code: Select all
IPT="$USER_PWD"
PWD="$(pwd)"
bin="$PWD/.porteus_installer"
extlinux_conf="$IPT/syslinux/porteus.cfg"
lilo_menu="$IPT/syslinux/lilo.menu"
log="/tmp/debug.txt"
PRT=$(df -P "$IPT" | grep -o '^/dev/[^ ]\+')
MPT=$(grep "^$PRT" /proc/mounts | cut -d' ' -f2)
DEV=/dev/$(lsblk -ndo pkname "$PRT")
PRTN=$(echo ${PRT#"$DEV"} | sed 's/[^0-9]*//g')
FS=$(grep -w "$PRT" /proc/mounts | head -n1 | cut -d" " -f3)
also: replaced all `` with $() and added some [ ] to a couple if/then sections that appear to be tests...
don't appear to broken anything for basic operation, at least.
so yeah, --copy is a build time arg, so it shouldn't come into play..
for reference, my current [build command is:
Code: Select all
./makeself.sh build Porteus-installer-for-Linux.com 'Porteus Installer' './.porteus_installer/installer.com'
Code: Select all
./makeself.sh <directory_containing_.porteus_installer_tree> <name_of_makeself_archive> <label> <script_executed_on_extraction>
well, the breakage would only occur on building with a new version makeself with changed behavior and should become apparent at that time..
if i get keen i'll open an issue on their github querying the meaning of it..
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44
- Ed_P
- Contributor
- Posts: 8374
- Joined: 06 Feb 2013, 22:12
- Distribution: Cinnamon 5.01 ISO
- Location: Western NY, USA
[update:LILO/exfat] The generic Linux installer is incompatible with Ubuntu
Will we be seeing a Porteus Update for this fix and the save-session one in the near future?
Ed
[update:LILO/exfat] The generic Linux installer is incompatible with Ubuntu
I like this
Maybe the thought behind it is: "If you aren't keep="y"'ing the files, then why should you care where it extracts? No place can be better than /tmp."
But I can think of cases where targetdir still matters, and it's not clear, self-documenting code..
Last edited by jjr on 23 Feb 2024, 06:43, edited 1 time in total.
[update:LILO/exfat] The generic Linux installer is incompatible with Ubuntu
OK, I got Porteus to fully boot from exFAT on LILO, but it required a few more fixes.ncmprhnsbl wrote: ↑23 Feb 2024, 02:43Porteus-installer-for-Linux.com md5sum: 6775063fd7eff3030e8285dfaabb886a (all the previous links are the same file)
Considering FAT and NTFS, having exFAT as a real option is nice.
This is now outside the scope of the OP. Maybe I should make a new thread for searchers. But I would feel like that 'guy who leaves the room while talking and expects you to follow him'.
LILO Issue #1: Suppressed interactivity
So I run the installer on an exFAT drive, enter 'ok' and it freezes. I hit enter again, and it exits and nothing was done to the drive.
This is because lilo.com was giving a warning for the exFAT volume and prompting for confirmation, but the user cannot see the prompt, because it is >/dev/null.
I would remove ">/dev/null 2>&1" from this line to allow the interactivity:
Code: Select all
"$bin"/lilo.com -P ignore -C "$lilo_menu" -S "$IPT"/syslinux -m "$IPT"/syslinux/lilo.map >/dev/null 2>&1
LILO Issue #2: Wrong default mode
If you bypass the warning it is giving, it corrupts the drive, because the default install mode is apparently wrong.
Once you remove the >/dev/null, you see this:
Code: Select all
Warning: /media/josh/Porteus/boot/syslinux/lilo.menu should be owned by root
Warning: /dev/sdd1 is not on the first disk
Warning: partition type 0x07 on device 0x0831 is a dangerous place for
a boot sector. A DOS/Windows system may be rendered unbootable.
The backup copy of this boot sector should be retained.
Proceed? [N/y]
This is the installer.com's default mode of installing to the partition boot sector instead of to the MBR.
If you enter "y" and force it to proceed, it corrupts the drive (no longer mountable). See #3 below for easy fix.
LILO Issue #3: Three bad if's
To workaround issue #2 (above), installer.com was designed to let the user override the mode with -f (undocumented I guess):
Code: Select all
if [ $(echo $* | grep -Eqo "\-f( |\$)") ]; then
LILO=MBR
else
You can test this in a shell:
Code: Select all
[ $(echo "hi" | grep -q "hi") ] && echo "this will never print"
[ $(echo "bye" | grep -q "hi") ] && echo "this will never print"
Code: Select all
if echo $* | grep -Eqo "\-f( |\$)"; then
LILO=MBR
else
Code: Select all
if [ $(echo "$FS" | grep -q xfs) ]; then
Code: Select all
if echo "$FS" | grep -q xfs; then
Code: Select all
echo "Installing Porteus to $PRT"
if [ ! $(echo $* | grep -Eqo "\-a( |\$)") ]; then
Code: Select all
echo "Installing Porteus to $PRT"
if ! echo $* | grep -Eqo "\-a( |\$)"; then
At this point, you can now get LILO to install by running:
Code: Select all
sudo bash Porteus-installer-for-Linux.com -- -f
Code: Select all
if echo $* | grep -Eqo "\-f( |\$)" || echo "$FS" | grep -q exfat; then
LILO Issue #4: Spaces again
LILO fails loading the config if there are spaces in the volume label (through $IPT).
To fix this, you can edit the template "boot/syslinux/lilo.conf", changing all occurrences of this:
Code: Select all
image=DO_NOT_CHANGE/vmlinuz
initrd=DO_NOT_CHANGE/initrd.xz
Code: Select all
image="DO_NOT_CHANGE/vmlinuz"
initrd="DO_NOT_CHANGE/initrd.xz"
RESULT
Applying all 4 fixes, the script successfully installed Porteus to an MBR/exFAT volume with spaces in the label, and it boots to desktop.
Last edited by jjr on 23 Feb 2024, 19:46, edited 2 times in total.
[update:LILO/exfat] The generic Linux installer is incompatible with Ubuntu
Ah, this applies only to @ncmprhnsbl's upload.
In the official version, those 2 conditionals are different and they actually work. (The `` was also passing grep's exit code to if.)
You could enclose the pipes in $() or () if you wanted, just not in [$()].
edit: there's a 3rd broken if in the upload - edited main post.
edit 2: the 4th affected condition if [ ! $(which $1) ] does work with brackets, because the ! can be used to test for an empty string -- and it's testing the stdout of which, instead of its exit code.
- ncmprhnsbl
- DEV Team
- Posts: 3941
- Joined: 20 Mar 2012, 03:42
- Distribution: v5.0-64bit
- Location: australia
- Contact:
[update:LILO/exfat] The generic Linux installer is incompatible with Ubuntu
heh, i made the fatal error of thinking i knew what i was doing.. :p ..here's an update i hopefully havn't broken some other way..
Porteus-installer-for-Linux.com md5sum: d2f6c6e01d4319c4999fc3d553d4aafe (all the previous links are the same file)
done, and this:
Code: Select all
if echo $* | grep -Eqo "\-f( |\$)" || echo "$FS" | grep -q exfat; then
also: ran shellcheck over it and adjusted as per it's suggestions, so everything that can be double quoted is now double quoted, and [test1] && [test2] used instead of [test1 -a test2] (not a big deal, but why not?)
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44
[update:LILO/exfat] The generic Linux installer is incompatible with Ubuntu
I don't know how Shellcheck misses this (it does!),
but this isn't valid-- it prints a shell error (which gets quickly hidden by clear later) and will never execute the inner block, thus allowing non-root to run:
Code: Select all
if $(whoami) != root; then
! by itself can be used outside of brackets, because it has 2 meanings
System shells are the most jerry-rigged languages, always curveballs. (you too, PowerShell.)
Anyway, do:
Code: Select all
if [ $(whoami) != root ]; then
I didn't see any other errors, and both bootloaders are working now.
Last edited by jjr on 24 Feb 2024, 00:34, edited 3 times in total.