Page 1 of 1

[SOLVED] Pendrive with Partitions [SOLVED]

Posted: 06 Jul 2023, 08:11
by inukaze
Hi there, look the first is my native language is spanish, i am latino but not from "Europa Latina" like Spain, France, Italy, Portugal, Rumania, Moldavia, etc . . . well the thing is i had a pendrive with the follow partitions :

USB Pendrive with 14.43 GiB
Partition 1 : exFAT, 11.32 GiB, label : Inukaze
Partition 2 : ext2, 100 MB, label : Inicio (boot on spanish)
Partition 3 : ext3, 3.00 GiB, label GNU_con_Linux (GNU with Linux on spanish, because GNU is the OS and Linux is just the kernel)

i had installed grub from Slackware 14.2 on the Pendrive, and i write manully my own configuration file of grub.

When i boot my porteus from usb, search for it configuration file, and found on /mnt/isoloop
the thing is when this is booted the partition for grub is /dev/sda3, but when porteus found his configuration file and before the modules be loaded, the partition change from /dev/sda3 to for example /dev/sdc3

currently the blkid output of pendrive partition :

Code: Select all

/dev/sdc1: LABEL="Inukaze" UUID="38C0-FCD0" BLOCK_SIZE="512" TYPE="exfat" PARTUUID="29504791-01"
/dev/sdc2: LABEL="Inicio" UUID="a0784a07-12ba-4131-a646-726a70ad6a55" BLOCK_SIZE="1024" TYPE="ext2" PARTUUID="29504791-02"
/dev/sdc3: LABEL="GNU_con_Linux" UUID="23b2374a-ee65-49dc-9abd-562449624a68" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="29504791-03"
currently my grub.cfg content

i am using the entry "PRUEBA -- LXQT [REQ : 256 MB RAM]"
and well i just gonna to make some test like delete my workaround for change root variable value from example (hd0,msdos3) to sda3, i need a better command for mount the third partition no matter if sda3, sdc3, sdz3 for make porteus automount the folders i need to use.

just ignore the entries like "Cambiar Fondo" is just for chage image background, in some point i lost the entry i was make to change the font and save the change.
i just need ideas for had a better form to mount the third partition of usb after porteus found it config file but before try to mount the modules folders

Pendrive with Partitions

Posted: 07 Jul 2023, 09:28
by burdi01
Yes, Grub's partition names are different from Linux's.
If I understand your question correctly the regexp in the following grub.cfg snip should do the trick:

Code: Select all

set default=0
set timeout=10
set menu_color_normal=light-gray/blue
set menu_color_highlight=blue/light-gray
#set menu_color_normal=white/black
#set menu_color_highlight=black/light-gray

regexp --set=hdX '^(.*),' $root

menuentry 'Slackware 15.0 Current' {
   set root=($hdX,7)
   linux /boot/vmlinuz root=/dev/nvme0n1p7 ro pci=noaer
   initrd /boot/initrd.gz
}

menuentry 'Rescue' {
 # To run with less RAM add "boot=live" phrase - media will be in use
 # To override a saved keymap add a "keymap=<keymap>" phrase
 # To boot in text mode add a "consoleboot=yes" phrase
 # To start the network early at boot add a "networksetting=dhcp.eth0" phrase
 # To enable printing issue "/etc/init.d/cups start" in an xterm
   echo Loading ...
   set rescue=boot/rescue-5.10.7b.iso
   loopback loop /$rescue
   linux (loop)/pmagic/bzImage root=/dev/nvme0n1p5 loglevel=0 pci=noaer \
      directory=boot iso_filename=$rescue boot=live \
      cgmanager=no nfs=no bluetooth=no cups=no zfs=no atop=no \
      powermanager=yes
   initrd (loop)/pmagic/initrd.img (loop)/pmagic/fu.img (loop)/pmagic/m.img
}

menuentry '===' { true }

menuentry '[10] Xubuntu 23.04 "Lunar Lobster"' {
   set root=($hdX,10)
   linux /boot/vmlinuz root=/dev/nvme0n1p10 ro pci=noaer
   initrd /boot/initrd.gz
}
nvme0n1 is a nvme m.2 but the same setup should work for a multipartition USB stick.
:D

PS: I would go for the Grub from Slackware 15.0 or even better Current.

Pendrive with Partitions

Posted: 07 Jul 2023, 11:48
by Ed_P
This is one of my nvme0 system's USB grub menus:

Code: Select all

menuentry " Porteus 5.0 USB - AF'" --class slackware   --class icon-porteus  {

     set porteus_parms="volume=33 reboot=cold extramod=/Modules changes=EXIT:/changes/porteussave.dat"

     set bootdrv=$root
     search -f /boot/syslinux/vmlinuz --set=root
     if [ $root != $bootdrv ]; then
        linux  /boot/syslinux/vmlinuz $porteus_parms
        initrd /boot/syslinux/initrd.xz
     else
        echo "----------------------------------------"
        echo USB drive NOT found.
        echo
        sleep -v -i 10
     fi
     set root=$bootdrv
     }
If you have Porteus installed on your harddrive adding a unique dummy file to the USB drive and searching for that instead of vmlinuz works also. :happy62:

[SOLVED] Pendrive with Partitions [SOLVED]

Posted: 09 Jul 2023, 04:10
by inukaze
Solution

grub.cfg current

Code: Select all

search --set root -u a0784a07-12ba-4131-a646-726a70ad6a55
set prefix=($root)/grub
set have_grubenv=true
load_env
set timeout=60
menuentry_id_option=""
export menuentry_id_option
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}
font=ter-u20b
if loadfont $font ; then
	set gfxmode=640x480
	load_video
	insmod gfxterm
	insmod gettext
fi
terminal_output gfxterm
search --set root -u a0784a07-12ba-4131-a646-726a70ad6a55
set locale_dir=($root)/locale
set lang=es
insmod part_msdos
insmod ext2
insmod gfxterm
insmod gettext
insmod png
if [ -z "$bg" ]; then
background_image "/grub/images/Tux_640x480.png"
else
background_image "${prefix}/images/${bg}"
fi
if [ "$bg" = "Tux_640x480.png" ]; then
	set menu_color_normal="light-cyan/black"
	set menu_color_highlight="light-green/black"
	set color_normal="light-cyan/black"
else
	set menu_color_normal=light-green/black
	set menu_color_highlight=light-cyan/black
fi

#Establecer Colores de la tipografia del menu GRUB :
set menu_color_normal="white/black"
set menu_color_highlight="light-green/black"
set color_normal="white/black"
#Establecer Colores de la tipografia del menu GRUB.

### Configuracion Grafica : INICIO ###
function gfxmode {
    set gfxpayload="${1}"
    if [ "${1}" = "keep" ]; then
        set vt_handoff=vt.handoff=7
    else
        set vt_handoff=
    fi
}
if [ "${recordfail}" != 1 ]; then
  if [ -e ${prefix}/gfxblacklist.txt ]; then
    if hwmatch ${prefix}/gfxblacklist.txt 3; then
      if [ ${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
export linux_gfx_mode
### Configuracion Grafica : FIN ###

submenu 'Porteus 5.0 [64 Bits]' {
	if background_image "${prefix}/images/Porteus_640x480.png" ; then
  		set menu_color_normal="white/black"
  		set menu_color_highlight="light-green/black"
  		set color_normal="white/black"
	else
		set menu_color_normal="light-cyan/black"
		set menu_color_highlight="light-green/black"
		set color_normal="light-cyan/black"
	fi
		menuentry "Regresar al menú principal" {
			configfile ${prefix}/grub.cfg
		}
menuentry 'LXQT [REQ : 256 MB RAM]' --class slackware --class icon-porteus {
	load_video
	insmod part_msdos
	insmod linux
	insmod gzio
	insmod ext2
    search --set=root --fs-uuid 23b2374a-ee65-49dc-9abd-562449624a68 --hint hd0,msdos3
	UUID="23b2374a-ee65-49dc-0abd-562449624a68"
    echo "UUID = ($UUID)"
	echo "Raiz = ($root)"
	echo "Iniciando Porteus 5.0 [64 Bits] - LXQT"
	set isofile="/Porteus/Porteus-LXQT-v5.0-x86_64.iso"
	export $isofile
	parametros="from=${isofile} kbd=es tz=localtime locale=es_VE.utf8 changes=EXIT:/Porteus/Cambios/LXQT extramod=/Porteus/Modulos root=/dev/ram0 copy2ram"
	loopback loop ($root)${isofile}
	linux (loop)/boot/syslinux/vmlinuz $parametros
	echo "Cargando en la Memoria de Acceso Aleatorio..."
	initrd (loop)/boot/syslinux/initrd.xz
	}
			menuentry "Regresar al menú principal" {
			configfile ${prefix}/grub.cfg
		}

}

submenu "Cambiar Fondo" {
insmod regexp
insmod png
echo "Obteniendo lista de archivo de : \"($prefix)/grub/images\". Espera, por favor..."
for file in /grub/images/*; do
		if ! test -f "$file"; then continue; fi
		if [ "$file" == "/grub/images/${bg}" ]; then continue; fi
		regexp -s filename "/grub/images/(.*)" "$file"
		if [ -z "$havefile" ]; then set havefile="1"; fi
		menuentry "${filename}" {
			bg="$1"
			background_image "${prefix}/images/${bg}"
			save_env bg
			#configfile ${prefix}/grub.cfg
		}
	done
	if [ -z "$havefile" ]; then
		echo "Por favor, coloque todos sus Fondos PNG, JPG & JPEG en la carpeta \"${prefix}/images\"."
	else
		unset havefile
		menuentry "Regresar al menú principal" {
			configfile ${prefix}/grub.cfg
		}
	fi
	unset filename
}

submenu 'Antiguas Entradas (Solo quedan a modo de Ejemplo) [64 Bits]' {

		menuentry "Regresar al menú principal" {
			configfile ${prefix}/grub.cfg
		}

menuentry 'Slacko 64 - Puppy Linux 7.0' {
        insmod part_msdos
		insmod ext2
        insmod gzio

		#el "UUID=33fbd5e1-3b92-4e34-bb28-8583270c644f"
		#era de la particion "6" con etiqueta "PuppySlacko"
		search --set root -u 33fbd5e1-3b92-4e34-bb28-8583270c644f
		#Puppy va a buscar siempre sus archivos "vmlinuz" e "initrd.gz" en la particion
		#que se le especifique como "raiz"

		#Luego buscara los archivos restantes de la distro para iniciarla :
        search.fs_uuid 33fbd5e1-3b92-4e34-bb28-8583270c644f
        set gfxpayload=keep
        linux     /vmlinuz pfix=copy,fsck pmedia=usb psubdir=/
        initrd    /initrd.gz
}
menuentry 'Debian 8.0 - Nicolas ISO Personalizada (64 Bits)' {
	load_video
        insmod gzio
        insmod ext2
        insmod part_msdos
        insmod loopback
	insmod iso9660
	search --set root -u 23b2374a-ee65-49dc-9abd-562449624a68
	set isofile="Debian8Nicolas.iso"
	set gfxpayload=keep
	loopback loop (hd0,msdos7)/$isofile
	echo	'Cargando Linux 3.16.0-6-amd64...'
        linux   (loop)/boot/vmlinuz-3.16.0-6-amd64 boot=live iso-scan/filename=$isofile noprompt noeject
		echo	'Cargando imagen de memoria inicial...'
        initrd  (loop)/boot/initrd.img-3.16.0-6-amd64
}
		menuentry "Regresar al menú principal" {
			configfile ${prefix}/grub.cfg
		}
		
}



if [ "$grub_platform" = "efi" ]; then
menuentry 'Iniciar desde el siguiente volumen' {
        exit 1
}


menuentry 'UEFI - Configurar Firmware' {
        fwsetup
}
else

menuentry 'Probar Memoria RAM' {
        linux16 /boot/memtest86+.bin
}
fi
Notes diferences with old version

grub.cfg, line 2
old

Code: Select all

set prefix=$(root)/grub
current

Code: Select all

set prefix=($root)/grub
grub.cfg, line 30
old

Code: Select all

set locale_dir=$(root)/locale
current

Code: Select all

set locale_dir=($root)/locale
with the old i see the follow error during grub boot :

Code: Select all

error: $
error: syntax error
error: incorrect command
error: syntax error
error: file /locale/es.mo.gz not found
and i just remove my workaround because is not really necesary

[SOLVED] Pendrive with Partitions [SOLVED]

Posted: 16 Aug 2023, 17:03
by inukaze
Update 16 August 2023
-------------------------------

i had backup all content on a diferent hard drive, on 3 folders for make backups of each partition i had on pendrive
after i make all conent backup, i delete table patitions for pendrive and make new three partitions

Code: Select all

parted -l
Model: Verbatim STORE N GO (scsi)
Disk /dev/sdc: 15,5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Numero Inicio Fin Tamaño Typo Sistema de ficheros Banderas
1 1049kB 8349MB 8348MB primary ntfs
2 8349MB 8621MB 273MB primary ext2 arranque
3 8621MB 15,5GB 6868MB primary ext3

Code: Select all

fdisk -l /dev/sdc
Disco /dev/sdc: 14,43 GiB, 15489564672 bytes, 30253056 sectores
Modelo de disco: STORE N GO
Unidades: sectores de 1 * 512 = 512 bytes
Tamaño de sector (lógico/físico): 512 bytes / 512 bytes
Tamaño de E/S (mínimo/óptimo): 512 bytes / 512 bytes
Tipo de etiqueta de disco: dos
Identificador del disco: 0x2af862f0

Disposit. Inicio Comienzo Final Sectores Tamaño Id Tipo
/dev/sdc1 2048 16306175 16304128 7,8G 7 HPFS/NTFS/exFAT
/dev/sdc2 * 16306176 16838655 532480 260M 83 Linux
/dev/sdc3 16838656 30253055 13414400 6,4G 83 Linux
Notice i change the first partition from exfat to ntfs, just i can't format directly on exfat using gparted of Slackware64 14.2
on Slackware64 14.2 i try to use mkfs.exfat but the partition make unusable, and becuase of that i decide format on ntfs.

The first for me was copy boot partition data to my partition labeled "Inicio" (boot) after of that
first i must install grub on usb root device.

Code: Select all

grub-install --removable --recheck --boot-directory=/media/Inicio /dev/sdc
second i must edit the grub.cfg but first i must know which are the new uuid :

Code: Select all

blkid | grep sdc
/dev/sdc2: LABEL="Inicio" UUID="db288d5b-878e-46cb-a4ed-7003484981e2" BLOCK_SIZE="1024" TYPE="ext2" PARTUUID="2af862f0-02"
/dev/sdc3: LABEL="Lignux" UUID="187367fe-2cf8-4317-84fb-294bb88a877d" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="2af862f0-03"
/dev/sdc1: LABEL="Inukaze" BLOCK_SIZE="512" UUID="5C3D93A53E6C5477" TYPE="ntfs" PARTUUID="2af862f0-01"
well my current grub.cfg
The differences was
old "Inicio" uuid "a0784a07-12ba-4131-a646-726a70ad6a55"
was changed by "db288d5b-878e-46cb-a4ed-7003484981e2"
The new "Inicio" uuid

old "GNU_con_Linux" uuid "23b2374a-ee65-49dc-9abd-562449624a68"
was changed by "187367fe-2cf8-4317-84fb-294bb88a877d"
The new "Lignux" uuid

Because i lost symbolic links on the partition "Lignux" when i backup to another hdd and restore the data to pendrive partitions i must re-created them, but before

i had download the modules :

libuv -> http://ftp.osuosl.org/pub/slackware/sla ... 6_64-1.txz
bind -> http://ftp.osuosl.org/pub/slackware/sla ... ck15.0.txz

the bind module requiere libuv for work, i just convert both and activate first the libuv after bind, for i can use rndc without trouble

Code: Select all

cd "/mnt/sdc3/Porteus/Modulos"
ln -sf "../Modulos-xzm/Official/bind-9.16.42-x86_64-1_slack15.0.xzm"
ln -sf "../Modulos-xzm/Porteus/idioma-esp/es-core_locales.xzm"
ln -sf "../Modulos-xzm/Porteus/idioma-esp/es-lxqt_locales.xzm"
ln -sf "../Modulos-xzm/Porteus/idioma-esp/es_VE-locales-files.xzm"
ln -sf "../Modulos-xzm/Salix/exFAT/exfat-utils-1.3.0-x86_64-1salix15.0.xzm"
ln -sf "../Modulos-xzm/Official/exfatprogs-1.1.3-x86_64-1.xzm"
ln -sf "../Modulos-xzm/Salix/exFAT/fuse-exfat-1.3.0-x86_64-2salix15.0.xzm"
ln -sf "../Modulos-xzm/Porteus/idioma-esp/glibc-i18n-2.33-x86_64-5.xzm"
ln -sf "../Modulos-xzm/Official/gpm-1.20.7-x86_64-9.xzm"
ln -sf "../Modulos-xzm/Official/ntp-4.2.8p17-x86_64-1_slack15.0.xzm"
after of that i must update my /etc/rc.d/rc.local of Porteus partition Update of -> viewtopic.php?p=94894#p94894 and this include the solution for the problem i had with bind9 on ->viewtopic.php?p=95212#p95212

after i had activate libuv & bind i can create the named user & group

Code: Select all

su -c "groupadd named ; useradd -c "BIND Owner" -g named -s /bin/false -u 20 named ; install -d ; ldconfig" root
Ok going with my /etc/rc.d/rc.local :
Well i had 2 Games (and multiples emulators) on my "Lignux" partition, but i want re-create "Link" on "Desktop" every startup,becuase if i use on anothers pc's or if i connect more hdd, the pendrive should be moved from sdc to another sdX, i prefer make symbolic links to mount points using /media/"Label" for be more consistent.

well i had "Mupen64Plus" (N64 Emulator), "Tibia" (MMORPG Native), "Gravity Circuit" (Run & Gun Native)
for each i make a script called "Crear_Enlace.geb" ("GEB" = Guion En Bash, Spanish words, if i translate to english be "SIB" = Script In Bash)

Mupen64Plus - Crear_Enlace.geb
Tibia - Crear_Enlace.geb
Gravity Circuit - Crear_Enlace.geb
i need a script inside the home to use with autostart applications, i create a file "$HOME/.reparar-enlaces.sh" with the follow content
i make another file script "$HOME/.tumblerd-control.sh"
Well now the autostart apps :
and finally i must block a lot of suspices sites using /etc/hosts
my /etc/hosts file had the follow content :

[SOLVED] Pendrive with Partitions [SOLVED]

Posted: 02 Oct 2023, 13:54
by inukaze
i should remember this site, when i need search Slackware packages -> https://slackware.nl/slakfinder/index.php