You are not logged in.
I have an old, early 2000s pc (pentium 4), which ran an old version of ubuntu for years, and did so quite well until a few days ago, when the old ATA disk finally broke down. I figured I could install a 32 bit version of arch linux on a 32GB usb stick, following the instructions on the wiki (https://wiki.archlinux.org/index.php/In … _a_USB_key), and basically use that to resurrect the machine. I did something like that before, with a slightly more modern machine, and it worked great, but this time, the situation is a bit different:
Being so old, the machine's BIOS doesn't support the usual "USB HDD" boot option. It only supports "USB FDD" and "USB ZIP".
There is some mention on the arch wiki about using mkdiskimage to format a usb drive so it can boot via "USB ZIP" (https://wiki.archlinux.org/index.php/US … -ZIP_drive), but that's on a page for creating an "installer usb", not a persistent installation ... But ok, I assumed that if you could make a live usb that can boot via "USB ZIP", you should be able to do the same with a persistent arch installation, and I also found some additional resources that seemed to support that (http://cheesehead-techblog.blogspot.com … -bios.html).
So, on my host machine, which is already running arch, I started preparing the usb stick (/dev/sdc) by first running:
sudo mkdiskimage -Mz4 -i usb-zip-boot /dev/sdc 200 64 32
That gave me a vfat partition, which (I assume) can be made bootable via USB ZIP:
[goran@arch shm]$ sudo fdisk -l /dev/sdc
[sudo] password for goran:
Disk /dev/sdc: 29.3 GiB, 31406948352 bytes, 61341696 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
/dev/sdc4 * 32 409599 409568 200M 6 FAT16
Next, I created a partition for linux, which used all the remaining space:
Device Boot Start End Sectors Size Id Type
/dev/sdc1 409600 61341695 60932096 29.1G 83 Linux
/dev/sdc4 * 32 409599 409568 200M 6 FAT16
I made that partition ext4:
sudo mkfs.ext4 -O "^has_journal" /dev/sdc1
With that done, I followed the wiki instructions from here: https://wiki.archlinux.org/index.php/In … le_systems
When I got to installing the syslinux bootloader, I couldn't just follow the instructions on the wiki (https://wiki.archlinux.org/index.php/Sy … on_on_BIOS), because it seems they assume that the filesystem is ext4, but I need to install on a vfat "zip compatible" filesystem that was created with mkdiskimage, so this is what I did:
Created a syslinux.cfg:
Default USB-Stick
display syslinux.msg
F1 syslinux.f1
prompt 40
timeout 30
Label USB-Stick
kernel vmlinuz-linux
append initrd=initramfs-linux.img root=UUID=5bb1a37e-f7a1-483c-a0c2-1c01332fa26e
And then:
sudo mkdir sdc4_mnt/syslinux
sudo mv syslinux.cfg sdc4_mnt/syslinux
sudo cp /usr/lib/syslinux/bios/*.c32 sdc4_mnt/syslinux
sudo umount sdc4_mnt
sudo syslinux --directory syslinux --install /dev/sdc4
sudo dd bs=440 count=1 if=/usr/lib/syslinux/bios/mbr.bin of=/dev/sdc
So, at this point, I thought I had it done. I made sure that the target machine bios was set to boot from "USB ZIP", and then I plugged in my newly prepared stick, and tried to boot. As you probably guessed, since I'm posting here, it didn't work. Even worse, I get absolutely no errors that would help me narrow down the cause of the problem. The only thing I get is a black background with an underscore that keeps jumping around horizontally, at the very bottom of the screen.
I thought that maybe I needed to use "altmbr.bin" instead, so I tried:
su
printf '\x4' | cat /usr/lib/syslinux/bios/altmbr.bin - | dd bs=440 count=1 iflag=fullblock of=/dev/sdc
But that didn't work either - Results are the same.
So, I don't really know where to go from here. I would appreciate any guidance anyone here could give me, on how I could get this to work.
Also, another thing to mention (assuming I shouldn't just make a different post):
Before I ran the correct command to install altmbr.bin on the proper disk, I accidentally ran this:
su
printf '\x4' | cat /usr/lib/syslinux/bios/altmbr.bin - | dd bs=440 count=1 iflag=fullblock of=/dev/sda
Note that I failed to change /dev/sda to /dev/sdc. I assume that means I messed up the MBR on my host machine, and I'll need to fix that somehow before the next restart? My primary machine runs grub, so I guess I would have to reinstall grub completely, or is there a more focused method to just fix those 440 bytes?
Any guidence on that issue would also be appreciated.
Thanks (just for reading, if nothing else).
Offline
I cannot really help with this. Is there any chance the system can do a PXE boot over the network? https://wiki.archlinux.org/index.php/PXE
If so, it would be a more straightforward solution.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
There appears to be an option in the bios to boot from an "INT18 Device", so I guess that's possible, but I don't think it would be a solution for me, because I need the machine to be able to boot independently.
The core problem at this point is that I can't even get the bootloader menu to show up. So, while there are many details involved in getting a persistent arch install to run from a usb stick, we can basically ignore all the high-level aspects of it (for now), and just focus on getting a working bootloader.
Also, when you said that you can't really help with this, does that include my other issue, where I (probably) messed up grub on my host machine?
Offline
Does the machine have a floppy or CD drive you can boot from?
If so just burn a copy of plop boot manager and use it to chainload a standard Arch installation on the USB stick.
Offline
CD drive is broken. There is a floppy disk drive, but I don't have any floppy disks, and even if I did, I don't have a working computer with a floppy disk drive that could be used to make the plop floppy.
Offline
Before I ran the correct command to install altmbr.bin on the proper disk, I accidentally ran this:
su printf '\x4' | cat /usr/lib/syslinux/bios/altmbr.bin - | dd bs=440 count=1 iflag=fullblock of=/dev/sda
Note that I failed to change /dev/sda to /dev/sdc. I assume that means I messed up the MBR on my host machine, and I'll need to fix that somehow before the next restart? My primary machine runs grub, so I guess I would have to reinstall grub completely, or is there a more focused method to just fix those 440 bytes?
I don't know of a simpler way. Just run `grub-install' with appropriate arguments.
Regarding the aforementioned issue, maybe the following is of help:
http://www.syslinux.org/doc/usbkey.txt
Offline
Just to mention: there is no 32 bit version of Arch Linux. 32 bit was dropped.
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
I don't know of a simpler way. Just run `grub-install' with appropriate arguments.
Ok, thanks.
Regarding the aforementioned issue, maybe the following is of help:
http://www.syslinux.org/doc/usbkey.txt
That's basically an outline of what I did.
Just to mention: there is no 32 bit version of Arch Linux. 32 bit was dropped.
I ran `linux32 pacstrap`, and that seemed to fetch all the right stuff (i686), so I'm not sure what you mean by that.
Offline
You have about 3 days before all the i686 packages are removed from the repos. x86_64 will continue to be supported.
https://www.archlinux.org/news/phasing- … 6-support/
Last edited by circleface (2017-10-29 02:39:50)
Offline
Ok, I guess I'll use some other 32-bit distro. However, even if I were to use some other distribution, I still need a way to actually make it boot on the target machine, and right now, I don't have an easy vector, because I can't seem to boot from usb.
Interestingly, even though the hard drive on the target machine is broken, those disk errors only show up when I actually select to start linux from grub. Grub itself manages to load, so I tried to see if grub is actually able to recognize the usb stick as a valid disk (via the grub command line):
grub> root ( # then I hit tab, to get:
Possible disks are: fd0 fd1 hd0
So grub views the usb stick as an "fd1" floppy disk drive, which led me to believe that if I were to simply put the floppy image of small 32-bit os (like MenuetOS) on the usb stick, the system would be able to boot that, just as if the data was on an actual floppy disk:
Make the usb on host machine:
[goran@arch shm]$ sudo dd if=M32-086.IMG of=/dev/sdc
[sudo] password for goran:
2880+0 records in
2880+0 records out
1474560 bytes (1.5 MB, 1.4 MiB) copied, 1.23291 s, 1.2 MB/s
Try to boot from grub, on target machine:
grub> root (fd1)
Filesystem type is fat, using whole disk
grub> chainloader +1
grub> boot
Starting MenuetOS
# 30 seconds later:
KERNEL MNT ?
Better than a black screen, but I'm still stuck at that error, and there's not really a whole lot I can find about it online. There was one post on the Menuet forums that said it basically means "Can't read from diskette", but nothing about why that would be the case.
Interestingly, doing this:
grub> root (fd1)
Filesystem type is fat, using whole disk
grub> find / # then I hit tab, to get
Possible files are: ☰ ♥@ └☻-α☻/.1 a.◆gÇ ☺!▶♥í◀♣a.▶ü ┴↕-β↕/☺‼.1± ☺" ┬"-Γ/☻#.1"# a"$cb$eb.$gé ☺#0♥c0♣c.0
So, it recognizes the disk, and recognizes the file system, but it can't seem to see the file names on it properly. I assume that the dd command I used above, to put the floppy image on the usb stick, is correct? Or is there something extra that I need to do in order to have the system recognize the filenames properly?
I know this is a pretty niche thing at this point, and that I'm probably asking too much, but if anyone has any ideas, I would really appreciate it.
Offline
Ultimately, I wrote a custom bootloader to copy the plop image from a usb stick onto a floppy disk, and then I used that floppy to boot from usb, which worked fine.
In the unlikely case that anyone would need something like this (or if anyone is just interested), here it is:
; bootloader.asm
;
; Assuming it's in the same directory as 'plpbt.img', you can build it with:
; 'nasm -f bin bootloader.asm -o bootloader.asm.bin'
; And then you can load it on a usb drive with:
; 'dd if=bootloader.asm.bin of=/dev/sdX'
BITS 16
; BIOS parameter block. Needed because BIOS assumes its presence,
; and it will actually try to modify it, resulting in code corruption
jmp start
nop
resb 8 + 25
start:
jmp 0x0000:start_16 ; In case bootloader is at 0x07C0:0x0000
;; --
start_16:
; Set up 4K stack after this bootloader
; [Remember: Effective Address = Segment*16 + Offset]
mov ax, 0x07C0 ; Set 'ax' equal to the location of this bootloader divided by 16
add ax, 0x20 ; Skip over the size of the bootloader divided by 16
add ax, 0x20 ; And go up another 512 bytes (divided by 16), to leave room for a loaded sector
mov ss, ax ; Set 'ss' to this location (the beginning of our stack region)
mov sp, 4096 ; Set 'ss:sp' to the top of our 4K stack
; Set data segment to where we're loaded so we can implicitly access all 64K from here
mov ax, 0x07C0 ; Set 'ax' equal to the location of this bootloader divided by 16
mov ds, ax ; Set 'ds' to the this location
; Set extra segment, since it's used by disk loading ops
mov ax, 0x07C0
mov es, ax
; === START ===
mov si, str_start
call println
mov [disk_id], dl ; dx will be overwritten, so we save for later
; reset floppy drive
mov ah, 0
mov dl, 1
int 0x13
.loop:
mov ax, [lba]
cmp ax, 2881
je .end
; Convert LBA address to CHS usb address
mov ax, [lba]
mov dx, 0
mov bx, 18
div bx
mov [cylinder], ax
mov ax, 0
mov [head], ax
mov ax, [lba]
mov dx, 0
mov bx, 18
div bx
add dx, 1
mov [sector], dx
; Load sector from main disk, into the space just after the bootloader
mov ch, [cylinder]
mov dh, [head]
mov cl, [sector]
mov dl, [disk_id]; load previously saved disk_id
mov ah, 2 ; read
mov al, 1 ; number of sectors
mov bx, after_boot_loader ; buffer
int 0x13
cmp ah, 0
jne .read_error
; Print the (C:H:S) address of retrieved sector,
mov al, '('
mov ah, 0x0E
int 0x10
mov ax, [cylinder]
call printi
mov al, ':'
mov ah, 0x0E
int 0x10
mov ax, [head]
call printi
mov al, ':'
mov ah, 0x0E
int 0x10
mov ax, [sector]
call printi
mov al, ')'
mov ah, 0x0E
int 0x10
mov al, ' '
mov ah, 0x0E
int 0x10
mov al, '-'
mov ah, 0x0E
int 0x10
mov al, '>'
mov ah, 0x0E
int 0x10
mov al, ' '
mov ah, 0x0E
int 0x10
; Convert LBA address to CHS floppy address
mov ax, [lba]
sub ax, 1
mov dx, 0
mov bx, 36
div bx
mov [cylinder], ax
mov ax, dx ; remainder from above div
mov dx, 0
mov bx, 18
div bx
mov [head], ax
mov ax, [lba]
sub ax, 1
mov dx, 0
mov bx, 18
div bx
add dx, 1
mov [sector], dx
; Write loaded sector to floppy
.write:
mov ch, [cylinder]
mov dh, [head]
mov cl, [sector]
mov dl, 1 ; floppy id
mov ah, 3 ; write
mov al, 1 ; number of sectors
mov bx, after_boot_loader ; buffer
int 0x13
cmp ah, 0
jne .write_error
; Print the (C:H:S) address of the written sector
mov al, '('
mov ah, 0x0E
int 0x10
mov ax, [cylinder]
call printi
mov al, ':'
mov ah, 0x0E
int 0x10
mov ax, [head]
call printi
mov al, ':'
mov ah, 0x0E
int 0x10
mov ax, [sector]
call printi
mov al, ')'
mov ah, 0x0E
int 0x10
mov al, ' '
mov ah, 0x0E
int 0x10
call printnl
; inc counter
mov cx, [lba]
add cx, 1
mov [lba], cx
jmp .loop
.read_error:
mov si, str_read_error
call println
jmp .end
.write_error:
mov si, str_write_error
call println
call printi
; reset floppy drive
mov ah, 0
mov dl, 1
int 0x13
; retry
mov ax, [write_retry]
sub ax, 1
mov [write_retry], ax
cmp ax, 0
jne .write
jmp .end
;.wrong_value:
;mov si, str_wrong_value
;call println
; End
.end:
cli ; Clear the Interrupt Flag (disable external interrupts)
hlt ; Halt the CPU (until the next external interrupt)
; Data
data:
str_start db '=', 0
str_read_error db 'XRE', 0
str_write_error db 'XWR', 0
str_wrong_value db 'XWV', 0
lba dw 1
cylinder dw 0
head dw 0
sector dw 0
disk_id dw 0
write_retry dw 4
; Procedures
print:
pusha
mov ah, 0x0E ; Specify 'int 10h' 'teletype output' function
; [AL = Character, BH = Page Number, BL = Colour (in graphics mode)]
.printchar:
lodsb ; Load byte at address SI into AL, and increment SI
cmp al, 0
je .done ; If the character is zero (NUL), stop writing the string
int 0x10 ; Otherwise, print the character via 'int 10h'
jmp .printchar ; Repeat for the next character
.done:
popa
ret
println:
call print
call printnl
ret
printnl:
pusha
mov ah, 0x0E
mov al, 0x0a ; newline char
int 0x10
mov al, 0x0d ; carriage return
int 0x10
popa
ret
printi:
pusha
mov cx, sp
.pushdigit:
mov dx, 0
mov bx, 10
div bx
push dx
cmp ax, 0
je .printdigit
jmp .pushdigit
.printdigit:
pop ax
add ax, 48
mov ah, 0x0E
int 0x10
cmp sp, cx
je .done
jmp .printdigit
.done:
popa
ret
; Pad to 510 bytes (boot sector size minus 2) with 0s, and finish with the two-byte standard boot signature
times 510-($-$$) db 0
dw 0xAA55 ; => 0x55 0xAA (little endian byte order)
after_boot_loader:
incbin "plpbt.img"
Things to keep in mind:
The bios read/write (int 13h) routines may act differently on a different machine, in the sense that disk ids could be different, and the actual CHS addressing scheme for the usb device could vary from bios to bios.
This is probably something that you'll want to test before attempting to do something like this.
Offline
There is an actively maintained version of Arch for 32-bit. https://archlinux32.org/
Offline