Open BoQsc opened 4 years ago
Research Grub "try ubuntu" menu item in grub.cfg and isolinux and make sure to replace Ubiquity with "try ubuntu" persistent.
E:\isolinux\txt.cfg
file=/cdrom/preseed/ubuntu.seed initrd=/casper/initrd quiet splash
E:\boot\grub\grub.cfg Paste like this:
Remember to add fsck.mode=skip
to stop the need of fsck every boot time
Sometimes when the Linux USB is shutdown by simply clicking shutdown button.
The Linux operating system does not shutdown and become stuck with this error:
[sdb] tag#0 access beyond end of device
[sdb] tag#0 access beyond end of device
Probably happens when reached the memory last bit of the device's storage memory, or the device is empty and inaccesible.
http://manpages.ubuntu.com/manpages/bionic/man7/casper.7.html#:~:text=noprompt
https://forums.linuxmint.com/viewtopic.php?t=282437
Adding to the script before shutdown might help decrease shutdown time for Ubuntu live.
https://superuser.com/questions/1121465/how-do-i-edit-a-linux-iso-on-windows-using-command-line
Download: http://fy.chalmers.se/~appro/linux/DVD+RW/tools/win32/
https://mailing.comp.cdwrite.narkive.com/vJYHiiAs/growisofs-m-option-do-not-remove-old-files
https://stackoverflow.com/questions/10868613/detect-usb-and-copy-to-usb-drive-using-batch-script
fsutil fsinfo volumeInfo E:
fsutil volume diskfree E:
fsutil volume dismount E:
fsutil volume queryLabel E:
fsutil volume setLabel E: test
Note: setting inside autorun.inf of USB flash drive will override setLabel
;label = Ubuntu 20.04 LTS amd64
fsutil volume list
fsutil volume diskfree \?\Volume{97bd7694-b600-487f-a866-7694c80b6ead}\
fsutil fsinfo volumeInfo \?\Volume{97bd7694-b600-487f-a866-7694c80b6ead}\
@ECHO OFF
SETLOCAL EnableDelayedExpansion
:loop
CALL :spinner
SET /A "count=0"
FOR /F "tokens=1*" %%A in ('fsutil fsinfo drives') DO (
FOR %%C IN (%%B) DO (
IF EXIST %%C\boot\grub (
for /F delims^=^"^ tokens^=4 %%D in ('fsutil volume queryLabel %%C') do (
SET /A "count=!count!+1"
SET "selection[!count!]=%%C"
ECHO ▒▒[!count!.]▒▒▒[ %%C ]▒▒[ %%D ]
)
)
)
)
ECHO ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
CHOICE /C 1234567890 /N /T 1 /D 0 /M "Pasirinkite laikmena:"
echo !selection[%ERRORLEVEL%]! sdf
GOTO :loop
:spinner
chcp 65001 >NUL
set mSpinner=%mSpinner%.
if %mSpinner%'==....' (set mSpinner=.)
cls
echo █▀ ▀█
echo Aptinkamos USB laikmenos%mSpinner%
echo █▄ ▄█
goto :EOF
:spinners
set mSpinner=%mSpinner%.
if %mSpinner%'==....' (set mSpinner=.)
cls
ECHO Aptiktos USB laikmenos
echo Installation in progress%mSpinner%
ping 127.0.0.1 -n 2 >nul
goto :EOF
pause
.\syslinux.cfg
points to .\isolinux\isolinux.cfg
# D-I config version 2.0
# search path for the c32 support libraries (libcom32, libutil etc.)
path
include menu.cfg
default vesamenu.c32
#prompt 0
#timeout 50
#ui gfxboot bootlogo
Commenting out in .\isolinux\isolinux.cfg
.\isolinux\txt.cfg
default live
label live
menu label ^Try Ubuntu without installing
kernel /casper/vmlinuz
append file=/cdrom/preseed/ubuntu.seed initrd=/casper/initrd quiet splash ---
label live-nomodeset
menu label ^Try Ubuntu without installing (safe graphics)
kernel /casper/vmlinuz
append file=/cdrom/preseed/ubuntu.seed initrd=/casper/initrd quiet splash nomodeset ---
label live-install
menu label ^Install Ubuntu
kernel /casper/vmlinuz
append file=/cdrom/preseed/ubuntu.seed only-ubiquity initrd=/casper/initrd quiet splash ---
label live-install-nomodeset
menu label ^Install Ubuntu (safe graphics)
kernel /casper/vmlinuz
append file=/cdrom/preseed/ubuntu.seed only-ubiquity initrd=/casper/initrd quiet splash nomodeset ---
label memtest
menu label Test ^memory
kernel /install/mt86plus
label hd
menu label ^Boot from first hard disk
localboot 0x80
isolinux.cfg
# D-I config version 2.0
# search path for the c32 support libraries (libcom32, libutil etc.)
path
include menu.cfg
default live
#default vesamenu.c32
#prompt 0
#timeout 50
#ui gfxboot bootlogo
@ECHO OFF
@setlocal enableextensions enabledelayedexpansion
SET "RANDOM_FILENAME=%RANDOM%_find_replace.txt"
FOR /F "delims=*" %%A IN (E:\isolinux\isolinux.cfg) DO (
SET "line=%%A"
ECHO.!line! | FINDSTR /C:"default vesamenu.c32" 1>NUL
IF ERRORLEVEL 1 (
ECHO !line! >> "%TEMP%\%RANDOM_FILENAME%"
) ELSE (
IF "!line:~0,1!" == "#" (
ECHO was commented
ECHO !line:~1! >> "%TEMP%\%RANDOM_FILENAME%"
CALL :restore
) Else (
ECHO default live >> "%TEMP%\%RANDOM_FILENAME%"
ECHO !line! >> "%TEMP%\%RANDOM_FILENAME%"
)
)
)
PAUSE
:restore
FOR /F "delims=*" %%A IN (%TEMP%\%RANDOM_FILENAME%) DO (
SET "line=%%A"
ECHO.!line! | FINDSTR /C:"default live" 1>NUL
IF ERRORLEVEL 1 (
ECHO !line! >> "%TEMP%\edited-%RANDOM_FILENAME%"
) ELSE (
IF "!line:~0,1!" == "#" (
ECHO !line! >> "%TEMP%\edited-%RANDOM_FILENAME%"
)
)
)
GOTO :EOF
"Just boot to Linux"
@ECHO OFF
@setlocal enableextensions enabledelayedexpansion
SET "RANDOM_FILENAME=%RANDOM%_find_replace.txt"
FOR /F "delims=*" %%A IN (E:\isolinux\isolinux.cfg) DO (
SET "line=%%A"
ECHO.!line! | FINDSTR /C:"default vesamenu.c32" 1>NUL
IF ERRORLEVEL 1 (
ECHO !line! >> "%TEMP%\!RANDOM_FILENAME!"
ECHO writing
) ELSE (
IF "!line:~0,1!" == "#" (
ECHO was commented
ECHO !line:~1! >> "%TEMP%\!RANDOM_FILENAME!"
CALL :restore
ECHO started
) Else (
ECHO default live >> "%TEMP%\!RANDOM_FILENAME!"
ECHO !line! >> "%TEMP%\!RANDOM_FILENAME!"
)
)
)
ECHO end
PAUSE
:restore
FOR /F "delims=*" %%B IN (%TEMP%\%RANDOM_FILENAME%) DO (
SET "line=%%B"
ECHO.!line! | FINDSTR /C:"default live" 1>NUL
IF ERRORLEVEL 1 (
ECHO !line! >> "%TEMP%\edited-%RANDOM_FILENAME%"
) ELSE (
IF "!line:~0,1!" == "#" (
ECHO !line! >> "%TEMP%\edited-%RANDOM_FILENAME%"
)
)
)
SET "RANDOM_FILENAME=edited-%RANDOM_FILENAME%"
echo %RANDOM_FILENAME%
GOTO :EOF
"File in progress"
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
for /f "delims=" %%A in (E:\isolinux\txt.cfg) do (
SET "line=%%A"
SET ""
SET s=!s:quiet=quiet haha!
echo !s!
)
pause
https://stackoverflow.com/questions/2772456/string-replacement-in-batch-file/2773504#2773504
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
SET "substitue=quiet"
SET "word=quiethaha"
for /f "delims=" %%a in (E:\isolinux\txt.cfg) do (
SET "line=%%a"
CALL SET "line=%%line:%substitue%=%word%%%"
echo !line!
)
pause
wmic diskdrive where "MediaType='Removable Media'" get index,model
@setlocal enableextensions enabledelayedexpansion
@ECHO OFF
CALL :Find_and_comment "default vesamenu.c32" in_file "E:\isolinux\isolinux.cfg"
ECHO -------
CALL :Insert_line "default live" in_file "E:\isolinux\isolinux.cfg" at_position 3
ECHO -------
CALL :Find_and_remove "default live" in_file "E:\isolinux\isolinux.cfg"
ECHO -------
CALL :Find_and_uncomment "default vesamenu.c32" in_file "E:\isolinux\isolinux.cfg"
pause
EXIT
:Find_and_comment
SET "FIND_STRING=%1"
SET "SOURCE_FILE=%3"
SET "RANDOM_FILE_NAME=%RANDOM%_find_replace.txt"
SET "line="
FOR /F "USEBACKQ delims=*" %%A IN (%SOURCE_FILE%) DO (
SET "line=%%A"
ECHO !line! | FINDSTR /C:!FIND_STRING! 1>NUL
IF ERRORLEVEL 1 (
ECHO !line!
) ELSE (
IF NOT "!line:~0,1!" == "#" (
ECHO #!line!
) ELSE (
ECHO !line!
)
)
)
GOTO :EOF
EXIT
:Insert_line
SET "STRING_TO_INSERT=%1"
Set STRING_TO_INSERT=%STRING_TO_INSERT:"=%
SET "SOURCE_FILE=%3"
SET "INSERT_AT_POSITION=%5"
SET "RANDOM_FILE_NAME=%RANDOM%_find_replace.txt"
SET /A "count=0"
SET "line="
FOR /F "USEBACKQ delims=*" %%C IN (%SOURCE_FILE%) DO (
SET "line=%%C"
SET /A "count=!count! +1"
IF !count! EQU %INSERT_AT_POSITION% (
ECHO !count! %STRING_TO_INSERT%
)
ECHO !count! !line!
)
GOTO :EOF
EXIT
:Find_and_remove
SET "LINE_TO_REMOVE=%1"
SET LINE_TO_REMOVE=%LINE_TO_REMOVE:"=%
SET "SOURCE_FILE=%3"
SET "RANDOM_FILE_NAME=%RANDOM%_find_replace.txt"
SET /A "count=0"
SET "line="
FOR /F "USEBACKQ delims=*" %%D IN (%SOURCE_FILE%) DO (
SET "line=%%D"
ECHO !line! | FINDSTR /B /C:"!LINE_TO_REMOVE!" 1>NUL
IF ERRORLEVEL 1 (
ECHO !line!
) ELSE (
IF NOT "!line:~0,1!" == "#" (
REM Do nothing
)
)
)
GOTO :EOF
EXIT
:Find_and_uncomment
SET "FIND_STRING=%1"
SET "SOURCE_FILE=%3"
SET "RANDOM_FILE_NAME=%RANDOM%_find_replace.txt"
SET "line="
FOR /F "USEBACKQ delims=*" %%A IN (%SOURCE_FILE%) DO (
SET "line=%%A"
ECHO !line! | FINDSTR /C:!FIND_STRING! 1>NUL
IF ERRORLEVEL 1 (
ECHO !line!
) ELSE (
IF "!line:~0,1!" == "#" (
ECHO !line:~1!
)
)
)
GOTO :EOF
@ECHO OFF
DEL line.txt
FOR /F "delims=*" %%A IN (I:\isolinux\txt.cfg) DO (
echo %%A >> "line.txt"
FIND "label live " "line.txt" > nul
IF ERRORLEVEL 1 (
echo no
echo %%A
) ELSE (
echo yes
echo %%A
FIND "append" "line.txt" > nul
IF ERRORLEVEL 1 (
REM
) ELSE (
echo found
)
)
)
pause
@setlocal enableextensions enabledelayedexpansion
@ECHO OFF
CALL :Find_and_comment "label live" in_file "I:\isolinux\txt.cfg"
pause
:Find_and_comment
SET "FIND_STRING=%1"
SET "SOURCE_FILE=%3"
SET "RANDOM_FILE_NAME=%RANDOM%_find_replace.txt"
SET "line="
FOR /F "USEBACKQ delims=*" %%A IN (%SOURCE_FILE%) DO (
SET "line=%%A"
IF NOT "!found!" == "true" (
ECHO !line! | FINDSTR /C:!FIND_STRING! 1>NUL
IF ERRORLEVEL 1 (
ECHO !line!
) ELSE (
SET "found=true"
IF NOT "!line:~0,1!" == "#" (
ECHO #!line!
) ELSE (
ECHO !line!
)
)
) ELSE (
ECHO !line! | FINDSTR /C:append 1>NUL
IF ERRORLEVEL 1 (
ECHO !line!
) ELSE (
IF NOT "!line:~0,1!" == "#" (
ECHO #!line!
) ELSE (
ECHO !line!
)
)
)
)
GOTO :EOF
https://bugs.launchpad.net/ubuntu/+source/casper/+bug/158976
For Non UEFI systems
Rufus use \isolinux
\stdmenu.cfg - TAB request or else boots to Ubiquity
Boot to: "try Ubuntu" for persistent USB instead of Ubiquity
For UEFI systems
Disable Disk Files Check
Tutor and explanation.
Google Query I searched with
Set timeout to 0