~alpine/users

18 2

Install on single partition and without a bootloader

Details
Message ID
<d6a2c02f79277e9be40b53d460a470872ede1753.camel@riseup.net>
DKIM signature
missing
Download raw message
Hi,

I want to install Alpine Linux on a Linux multi-boot desktop PC, hence
the way to go seems to be

"System Disk Mode

This is a traditional hard-disk install.

If this mode is selected, the setup-alpine script creates three
partitions [...] For custom partitioning, see Setting up disks manually.

To install along side another operating systems, see Dualbooting." -
https://wiki.alpinelinux.org/wiki/Installation#Minimal_Hardware_Requirements

What I actually want to do is providing a partition that is already
formatted as ext4 and that should hold everything, including /boot in
the root directory (IOW /, not /root ;), excepted of a swap. A swap is
already available.

I don't want that the setup-script installs a bootloader.

If I click on "Setting up disks manually" the very next thing I need to
do is to click the next link and so on, without getting clear
information. If I click Dualbooting I get a lot of irrelevant
information, too.

I'm used to a user-centric approach. I know what BIOS I'm on, how to
format a SSD, how to setup syslinux or grub (grub without the auto-
crap). What I don't know is, how to use the Alpine Linux installer/setup
script.

There is https://wiki.alpinelinux.org/wiki/Alpine_setup_scripts , but
it's not clear to me. All the hints are too long too read and don't get
to the point.

Would

  BOOTLOADER=""

or

  Bootloader=flase

or else be for not installing a bootloader?

I installed iSH [ https://github.com/ish-app/ish/ ] on an iPad, it's
based on Alpine Linux.

What I want to get, is something very close to the iPad's iSH Alpine
Linux on my desktop PC.

I want an Alpine install on bare metal, but the plan is to run it most
of the times from within an Arch Linux session, by
"systemd-nspawn --boot".

So let's assume I would have /dev/sda1 ext4 free for Alpine's /
including /boot. /dev/sda2 would provide a Linux swap and I don't want
to install a bootloader at all.

How can I achieve this by using the setup-scripts?

Regards,
Ralf
Konstantin Kulikov <k.kulikov2@gmail.com>
Details
Message ID
<CAD+eXGTg967wOWMCYg_gyjECqqut26Xk+2zEB1V7ah-2hOiR6w@mail.gmail.com>
In-Reply-To
<d6a2c02f79277e9be40b53d460a470872ede1753.camel@riseup.net> (view parent)
DKIM signature
missing
Download raw message
> Would
>
>   BOOTLOADER=""
>
> or
>
>   Bootloader=flase
>
> or else be for not installing a bootloader?

It's BOOTLOADER=none
https://git.alpinelinux.org/alpine-conf/tree/setup-disk.in#n697


> So let's assume I would have /dev/sda1 ext4 free for Alpine's /
> including /boot. /dev/sda2 would provide a Linux swap and I don't want
> to install a bootloader at all.
>
> How can I achieve this by using the setup-scripts?

I'd say it's easier to install manually using apk like this:
apk add --root /mnt --initdb --allow-untrusted --repository
https://mirror.yandex.ru/mirrors/alpine/edge/main alpine-base

Most distros ship apk-tools in their repos so you don't need to do it
from alpine.
This skips one important thing however - populating
/etc/runlevels/{sysinit,boot,shutdown}.
For bubblewrap/unshare/chroot purposes you don't need it.
But if you do, you can fill it manually from any working alpine installation.
Details
Message ID
<3405c3d90ea2b8ab5c6849f1ee17c87338e86348.camel@riseup.net>
In-Reply-To
<CAD+eXGTg967wOWMCYg_gyjECqqut26Xk+2zEB1V7ah-2hOiR6w@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On Fri, 2023-05-26 at 19:23 +0300, Konstantin Kulikov wrote:
> 
> I'd say it's easier to install manually using apk like this:
> apk add --root /mnt --initdb --allow-untrusted --repository
> https://mirror.yandex.ru/mirrors/alpine/edge/main alpine-base
> 
> Most distros ship apk-tools in their repos so you don't need to do it
> from alpine.

Thank You,

yes, it's in the Arch repos.

   $ pacman -Si apk-tools | head -5
   Repository      : extra
   Name            : apk-tools
   Version         : 2.12.11-1
   Description     : Alpine Package Keeper - package manager for alpine
   Architecture    : x86_64

> This skips one important thing however - populating
> /etc/runlevels/{sysinit,boot,shutdown}.
> For bubblewrap/unshare/chroot purposes you don't need it.
> But if you do, you can fill it manually from any working alpine
> installation.

I'm not sure if I understand you correctly.

After booting the ISO /etc/runlevels/ holds the empty directories
default/ and nonetwork/. The content of the directories boot/, shutdown/
and sysinit/ are symbolic links against scripts in /etc/init.d.

When booted into the ISO, should I copy the items to the Alpine PC
install?

Regards,
Ralf
Konstantin Kulikov <k.kulikov2@gmail.com>
Details
Message ID
<CAD+eXGTnbvQn-wSEvZ8Zpg32N_rBJBBmF+oufZjFdOY8k4_gzA@mail.gmail.com>
In-Reply-To
<3405c3d90ea2b8ab5c6849f1ee17c87338e86348.camel@riseup.net> (view parent)
DKIM signature
missing
Download raw message
> When booted into the ISO, should I copy the items to the Alpine PC
> install?

Yes, recreate them in the same way (using ln -s for example).

Also don't forget you'll need kernel, mkinitfs, firmware, maybe something else.
Details
Message ID
<0eab7313f6d23bf05d4e73e7db8aad05ac1bf265.camel@riseup.net>
In-Reply-To
<CAD+eXGTnbvQn-wSEvZ8Zpg32N_rBJBBmF+oufZjFdOY8k4_gzA@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On Sat, 2023-05-27 at 08:46 +0300, Konstantin Kulikov wrote:
> > When booted into the ISO, should I copy the items to the Alpine PC
> > install?
> 
> Yes, recreate them in the same way (using ln -s for example).
> 
> Also don't forget you'll need kernel, mkinitfs, firmware, maybe
> something else.

Hi,

thank you, but I'll probably do a traditional disk install using
BOOTLOADER=none setup-alpine and then copy the /boot partition to the
root directory afterward, followed by commenting out the /boot partition
entry in fstab and replacing swap. 

Regards,
Ralf

PS: I'm sorry I accidentally didn't send the answer via the mailing list
first.
Details
Message ID
<9fdb3d754556ebb18428904b6edc2b5ddf37d6fc.camel@riseup.net>
In-Reply-To
<0eab7313f6d23bf05d4e73e7db8aad05ac1bf265.camel@riseup.net> (view parent)
DKIM signature
missing
Download raw message
Hi,

I booted the alpine-standard-3.18.0-x86_64.iso to run

  # BOOTLOADER=none setup-alpine

The last steps were selecting the "sys" install and confirming the
erasing of an external USB HDD (instead of using the unallocated space
only).

setup-alpine generated an empty fat32 partition, a linux-swap and an
ext4 partition holding the root directory, including /boot.

I used   cp -Tai  to copy everything from the external USB HDD to an
internal NVMe SSD.

Then I edited fstab and grub.cfg, first using the labels and then using
the UUIDs of the root directory and another linux-swap.

If I try to boot it by grub Alpine Linux startup ends with

mount: mounting {LABEL,UUID} [...] on /sysroot failed: No such file or directory
Mounting root failed.
initramfs emergency recovery shell launched.

I wanted to run mkinitfs, but it's not available.

Trying to boot it from an Arch Linux session via systemd-nspawn results
in

   # systemd-nspawn -bqD /mnt/m1.alpine 
   
      OpenRC 0.47.1 is starting up Linux 6.3.4-arch1-1 (x86_64) [SYSTEMD-NSPAWN]
   
    * /proc is already mounted
    * /run/openrc: creating directory
    * /run/lock: creating directory
    * /run/lock: correcting owner
    * Caching service dependencies ...                                                                                                                                                      [ ok ]
    * Loading hardware drivers ...                                                                                                                                                          [ ok ]
    * Creating user login records ...                                                                                                                                                       [ ok ]
    * Setting hostname ...                                                                                                                                                                  [ ok ]
    * Setting keymap ...
   loadkmap: can't open console                                                                                                                                                             [ !! ]
    * ERROR: loadkmap failed to start
    * Loading modules ...                                                                                                                                                                   [ ok ]
    * Starting networking ...
    *   lo ...                                                                                                                                                                              [ ok ]
    *   eth0 ...
   ip: ioctl 0x8913 failed: No such device
   udhcpc: ioctl 0x8933 failed: No such device
   ifup: failed to change interface eth0 state to 'up'                                                                                                                                      [ !! ]
    * Starting busybox syslog ...                                                                                                                                                           [ ok ]
    * Setting keymap ...
   loadkmap: can't open console                                                                                                                                                             [ !! ]
    * ERROR: loadkmap failed to start
    * Starting busybox acpid ...                                                                                                                                                            [ ok ]
    * Starting busybox crond ...                                                                                                                                                            [ ok ]
   can't open /dev/tty1: No such file or directory
   can't open /dev/tty2: No such file or directory
   can't open /dev/tty3: No such file or directory
   can't open /dev/tty4: No such file or directory
   can't open /dev/tty5: No such file or directory
   can't open /dev/tty6: No such file or directory
   can't open /dev/tty1: No such file or directory
   can't open /dev/tty2: No such file or directory
      [...]

I booted again using grub. In the emergency shell I intended to run

  # apk fix linux-lts

Obviously this is not possible in the emergency shell.

Now I try to chroot from Arch Linux.

   • root@archlinux /mnt/m1.alpine 
   # mount -t proc none /mnt/m1.alpine/proc/ 
   • root@archlinux /mnt/m1.alpine 
   # mount -o bind /dev /mnt/m1.alpine/dev/
   • root@archlinux /mnt/m1.alpine 
   # mount -o bind /sys /mnt/m1.alpine/sys/
   • root@archlinux /mnt/m1.alpine 
   # mount -o bind /run /mnt/m1.alpine/run/
   • root@archlinux /mnt/m1.alpine 
   # chroot /mnt/m1.alpine/
   chroot: failed to run command ‘/bin/bash’: No such file or directory

This makes sense. On my iPad iSH's Alpine I explicitly installed bash.

   • root@archlinux /mnt/m1.alpine 
   # /usr/bin/ls -hl /mnt/m1.alpine/bin/*sh*
   lrwxrwxrwx 1 root root 12 May 27 13:56 /mnt/m1.alpine/bin/ash -> /bin/busybox
   lrwxrwxrwx 1 root root 12 May 27 13:56 /mnt/m1.alpine/bin/fdflush -> /bin/busybox
   lrwxrwxrwx 1 root root 12 May 27 13:56 /mnt/m1.alpine/bin/sh -> /bin/busybox

Regards,
Ralf
Konstantin Kulikov <k.kulikov2@gmail.com>
Details
Message ID
<CAD+eXGSO+50aGGs7-2nqfEMTirc9yY3Ku=HRP+62efPw7SWS3w@mail.gmail.com>
In-Reply-To
<9fdb3d754556ebb18428904b6edc2b5ddf37d6fc.camel@riseup.net> (view parent)
DKIM signature
missing
Download raw message
> mount: mounting {LABEL,UUID} [...] on /sysroot failed: No such file or directory
> Mounting root failed.
> initramfs emergency recovery shell launched.

Either you got wrong uuid or nvme/filesystem modules didn't get packed
into initramfs.
Try mounting manually in an emergency shell and see what happens.

mkinitfs can be run from chroot or from host system using -b flag,
similar to apk. That works even across architectures.



      [ ok ]
>    can't open /dev/tty1: No such file or directory
>    can't open /dev/tty2: No such file or directory
>    can't open /dev/tty3: No such file or directory
>    can't open /dev/tty4: No such file or directory
>    can't open /dev/tty5: No such file or directory
>    can't open /dev/tty6: No such file or directory
>    can't open /dev/tty1: No such file or directory
>    can't open /dev/tty2: No such file or directory
>       [...]

Looks like system starts, but init can't find console to spawn login(1) on.
I'm not familiar with systemd, but reading its manpage i think it sets
up /dev/console.
Try replacing tty1 with console in /etc/inittab


>    # chroot /mnt/m1.alpine/
>    chroot: failed to run command ‘/bin/bash’: No such file or directory

You need to specify command to run in chroot, in case of alpine it's /bin/sh.
Details
Message ID
<d51080bd6b8d4edf54b6bd342c33e1ad583c7bd2.camel@riseup.net>
In-Reply-To
<CAD+eXGSO+50aGGs7-2nqfEMTirc9yY3Ku=HRP+62efPw7SWS3w@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On Sun, 2023-05-28 at 11:40 +0300, Konstantin Kulikov wrote:
> 
> nvme/filesystem modules didn't get packed into initramfs.

Thank you,

nvme was missing.

   • rocketmouse@archlinux ~ 
   $ cat /mnt/m1.alpine/etc/mkinitfs/mkinitfs.conf
   features="ata base ide scsi usb virtio ext4"
   • rocketmouse@archlinux ~ 
   $ echo "features=\"ata base ext4 ide nvme scsi usb virtio\"" | sudo tee /mnt/m1.alpine/etc/mkinitfs/mkinitfs.conf 
   [sudo] password for rocketmouse: 
   features="ata base ext4 ide nvme scsi usb virtio"
   • rocketmouse@archlinux ~ 
   $ cat /mnt/m1.alpine/etc/mkinitfs/mkinitfs.conf
   features="ata base ext4 ide nvme scsi usb virtio"

> You need to specify command to run in chroot, in case of alpine it's
> /bin/sh.

   • root@archlinux /home/rocketmouse 
   # mount -t proc none /mnt/m1.alpine/proc/ 
   • root@archlinux /home/rocketmouse 
   # mount -o bind /dev /mnt/m1.alpine/dev/
   • root@archlinux /home/rocketmouse 
   # mount -o bind /sys /mnt/m1.alpine/sys/
   • root@archlinux /home/rocketmouse 
   # mount -o bind /run /mnt/m1.alpine/run/
   • root@archlinux /home/rocketmouse 
   # chroot /mnt/m1.alpine/ /bin/sh -i
   / # mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / $(ls /lib/modules/)
   /bin/sh: mkinitfs: not found
   / # /sbin/mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / $(ls /lib/modules/) 
   ==> initramfs: creating /boot/initramfs-lts
   /sbin/mkinitfs: line 132: depmod: not found
   / # exit
   • root@archlinux /home/rocketmouse 
   # /bin/ls -hdltr /mnt/m1.alpine/{,usr/}*bin/depmod 
   lrwxrwxrwx 1 root root 4 Nov  1  2022 /mnt/m1.alpine/usr/sbin/depmod -> kmod
   lrwxrwxrwx 1 root root 4 Nov  1  2022 /mnt/m1.alpine/usr/bin/depmod -> kmod
   lrwxrwxrwx 1 root root 4 Nov  1  2022 /mnt/m1.alpine/sbin/depmod -> kmod
   lrwxrwxrwx 1 root root 4 Nov  1  2022 /mnt/m1.alpine/bin/depmod -> kmod
   • root@archlinux /home/rocketmouse 
   # /bin/ls -hdltr /mnt/m1.alpine/{,usr/}*bin/kmod
   -rwxr-xr-x 1 root root 159K Nov  1  2022 /mnt/m1.alpine/usr/sbin/kmod
   -rwxr-xr-x 1 root root 159K Nov  1  2022 /mnt/m1.alpine/usr/bin/kmod
   -rwxr-xr-x 1 root root 159K Nov  1  2022 /mnt/m1.alpine/sbin/kmod
   -rwxr-xr-x 1 root root 159K Nov  1  2022 /mnt/m1.alpine/bin/kmod

Running chroot now returns
"chroot: failed to run command ‘/bin/sh’: No such file or directory"
I probably made a mistake, so the easiest thing to do is to reboot, but
I can't do it right now, since the machine is busy. I even can't start a
terminal at the moment, it results in "Error connecting to dbus: Failed
to connect to socket /run/user/1000/bus: Permission denied".

Regards,
Ralf
Details
Message ID
<7950a075f5329960548a2c8706df8bf3bda254a8.camel@riseup.net>
In-Reply-To
<d51080bd6b8d4edf54b6bd342c33e1ad583c7bd2.camel@riseup.net> (view parent)
DKIM signature
missing
Download raw message
On Sun, 2023-05-28 at 12:03 +0200, Ralf Mardorf wrote:
> # chroot /mnt/m1.alpine/ /bin/sh -i
>    / # mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / $(ls /lib/modules/)
>    /bin/sh: mkinitfs: not found
>    / # /sbin/mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / $(ls /lib/modules/) 
>    ==> initramfs: creating /boot/initramfs-lts
>    /sbin/mkinitfs: line 132: depmod: not found

Hi,

I was forced to push the reset button. I wonder what mistake I've done
and why the above happened, before I made it even more worse.

At the moment I can't risk to be forced to reset the machine again,
since I've got some work to do.

Any pointers to reduce the risk using a chroot are welcome.

What are the easiest steps to run

  mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / 6.1.30-0-lts

?

Keep in mind that when booting Alpine into the initramfs emergency
recovery shell it also doesn't find the command mkinitfs.

Regards,
Ralf
Details
Message ID
<83435b7879b0fd1bfbdb4d7f2737c5ad8aeead7d.camel@riseup.net>
In-Reply-To
<7950a075f5329960548a2c8706df8bf3bda254a8.camel@riseup.net> (view parent)
DKIM signature
missing
Download raw message
Hi,

by accident I first run

   • root@archlinux /home/rocketmouse 
   # apk add --root /mnt/m1.alpine/ fix linux-lts 
   fetch http://mirror.bahnhof.net/pub/alpinelinux/v3.18/main/x86_64/APKINDEX.tar.gz
   fetch http://mirror.bahnhof.net/pub/alpinelinux/edge/main/x86_64/APKINDEX.tar.gz
   ERROR: unable to select packages:
     fix (no such package):
       required by: world[fix]

then I run

   • root@archlinux /home/rocketmouse 
   # apk fix --root /mnt/m1.alpine/ linux-lts 
   (1/1) [APK unavailable, skipped] Reinstalling linux-lts (6.1.30-r0)
   OK: 452 MiB in 54 packages

If I try to boot Alpine Linux now nothing does happen at all. Neither a
grub error message, nor any startup message is shown.

   • root@archlinux /home/rocketmouse 
   # /bin/ls -l /mnt/m1.alpine/etc/mkinitfs/mkinitfs.conf /mnt/m1.alpine/boot/initramfs-lts 
   -rw------- 1 root root 16946027 May 28 11:40 /mnt/m1.alpine/boot/initramfs-lts
   -rw-r--r-- 1 root root       50 May 28 11:16 /mnt/m1.alpine/etc/mkinitfs/mkinitfs.conf

The timestamp shows that apk fix didn't rebuild initramfs, the timestamp
is from the build of initramfs-lts that failed, when I run
/sbin/mkinitfs in the chroot and depmod wasn't found.

   • root@archlinux /home/rocketmouse 
   # mv -i /mnt/m1.alpine/boot/initramfs-lts /mnt/m1.alpine/boot/broken_initramfs-lts
   • root@archlinux /home/rocketmouse 
   # /bin/ls -l /mnt/m1.alpine/boot/*nitramfs-lts 
   -rw------- 1 root root 16946027 May 28 11:40 /mnt/m1.alpine/boot/broken_initramfs-lts
   • root@archlinux /home/rocketmouse 
   # apk fix --root /mnt/m1.alpine/ linux-lts 
   (1/1) [APK unavailable, skipped] Reinstalling linux-lts (6.1.30-r0)
   OK: 452 MiB in 54 packages
   • root@archlinux /home/rocketmouse 
   # /bin/ls -l /mnt/m1.alpine/boot/*nitramfs-lts 
   -rw------- 1 root root 16946027 May 28 11:40 /mnt/m1.alpine/boot/broken_initramfs-lts

Have I damaged something by accidentally running

   apk add --root /mnt/m1.alpine/ fix linux-lts

? And/or is "APK unavailable" the culprit? Or else?

FWIW

   • root@archlinux /home/rocketmouse 
   # pacman -Qi apk-tools | head
   Name            : apk-tools
   Version         : 2.12.11-1
   Description     : Alpine Package Keeper - package manager for alpine
   Architecture    : x86_64
   URL             : https://gitlab.alpinelinux.org/alpine/apk-tools
   Licenses        : GPL2
   Groups          : None
   Provides        : None
   Depends On      : zlib  openssl
   Optional Deps   : None

Regards,
Ralf
Konstantin Kulikov <k.kulikov2@gmail.com>
Details
Message ID
<CAD+eXGQvVX6T4e5_tCBp+gu=2p26ye02anFD5AhbBBZ1ofH7Fw@mail.gmail.com>
In-Reply-To
<83435b7879b0fd1bfbdb4d7f2737c5ad8aeead7d.camel@riseup.net> (view parent)
DKIM signature
missing
Download raw message
> # chroot /mnt/m1.alpine/ /bin/sh -i
>    / # mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / $(ls /lib/modules/)
>    /bin/sh: mkinitfs: not found
>    / # /sbin/mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / $(ls /lib/modules/)
>    ==> initramfs: creating /boot/initramfs-lts
>    /sbin/mkinitfs: line 132: depmod: not found

Use /bin/sh -l.
/etc/profile does not get sources unless you're running a login shell
so PATH from your host system gets inherited and alpine expects a
different one.

>    • root@archlinux /home/rocketmouse
>    # apk add --root /mnt/m1.alpine/ fix linux-lts
>    fetch http://mirror.bahnhof.net/pub/alpinelinux/v3.18/main/x86_64/APKINDEX.tar.gz
>    fetch http://mirror.bahnhof.net/pub/alpinelinux/edge/main/x86_64/APKINDEX.tar.gz
>    ERROR: unable to select packages:
>      fix (no such package):
>        required by: world[fix]
>

Mixing release and edge repositories is not supported by alpine. Choose one.

>
>    • root@archlinux /home/rocketmouse
>    # apk fix --root /mnt/m1.alpine/ linux-lts
>    (1/1) [APK unavailable, skipped] Reinstalling linux-lts (6.1.30-r0)
>    OK: 452 MiB in 54 packages

Maybe caused by mixing repos. Fix your /etc/apk/repositories and
/etc/apk/world and run apk upgrade -a
Details
Message ID
<37693b5c20497122826b09493617276e08ffd007.camel@riseup.net>
In-Reply-To
<CAD+eXGQvVX6T4e5_tCBp+gu=2p26ye02anFD5AhbBBZ1ofH7Fw@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
Hi,

the good news:
   - the chroot's $PATH issue is solved
   - creating initramfs works
the bad news:
   - mounting on /sysroot still fails

On Mon, 2023-05-29 at 08:25 +0300, Konstantin Kulikov wrote:
> Maybe caused by mixing repos. Fix your /etc/apk/repositories and
> /etc/apk/world and run apk upgrade -a

The installer script enabled the repositories. I only choose the mirror.
However, I run the script two times. The first time I confirmed erasing
the disk with "no", after that I run it again and confirmed erasing the
disk with "yes". Some items were cached or already written to a config,
for other items I had to choose again, e.g. what mirror I want to use.

   • rocketmouse@archlinux ~ 
   $ cat /mnt/m1.alpine/etc/apk/repositories
   #/media/dm-0/apks
   http://mirror.bahnhof.net/pub/alpinelinux/v3.18/main
   #http://mirror.bahnhof.net/pub/alpinelinux/v3.18/community
   #http://mirror.bahnhof.net/pub/alpinelinux/edge/main
   #http://mirror.bahnhof.net/pub/alpinelinux/edge/community

I assume I can uncomment v3.18/community in addition to main, just
mixing v3.18 and edge doesn't work. Is this correct?

   • rocketmouse@archlinux ~ 
   $ cat /mnt/m1.alpine/etc/apk/world
   acct
   alpine-base
   busybox-mdev-openrc
   doas
   dosfstools
   e2fsprogs
   linux-firmware-i915
   linux-firmware-other
   linux-firmware-rtl_nic
   linux-lts
   openssl
   
I don't know what to do with /etc/apk/world. I suspect it's ok as is.

   • root@archlinux /home/rocketmouse 
   # apk update --root /mnt/m1.alpine/
   fetch http://mirror.bahnhof.net/pub/alpinelinux/v3.18/main/x86_64/APKINDEX.tar.gz
   v3.18.0-435-g1a184caca7f [http://mirror.bahnhof.net/pub/alpinelinux/v3.18/main]
   OK: 5187 distinct packages available
   • root@archlinux /home/rocketmouse 
   # apk upgrade -a --root /mnt/m1.alpine/
   (1/48) Replacing acct (6.6.4-r2 -> 6.6.4-r2)
   (2/48) Replacing alpine-baselayout-data (3.4.3-r1 -> 3.4.3-r1)
   (3/48) Downgrading busybox (1.36.1-r0 -> 1.36.0-r9)
   Executing busybox-1.36.0-r9.post-upgrade
   (4/48) Downgrading [snip]
   (48/48) Downgrading openssl (3.1.0-r5 -> 3.1.0-r4)
   Executing busybox-1.36.0-r9.trigger
   Executing kmod-30-r3.trigger
   Executing mkinitfs-3.8.0-r1.trigger
   ==> initramfs: creating /boot/initramfs-lts
   OK: 452 MiB in 54 packages
   • root@archlinux /home/rocketmouse 
   # /bin/ls -hl /mnt/m1.alpine/boot/initramfs-lts 
   -rw------- 1 root root 17M May 29 15:17 /mnt/m1.alpine/boot/initramfs-lts

A whole lotta downgrades and an initramfs rebuild :).

> 
> Use /bin/sh -l.
> /etc/profile does not get sources unless you're running a login shell
> so PATH from your host system gets inherited and alpine expects a
> different one.

Just for testing purpose, I rebuild initramfs in chroot.

   • root@archlinux /home/rocketmouse 
   # mount -t proc none /mnt/m1.alpine/proc/
   • root@archlinux /home/rocketmouse 
   # mount -o bind /dev /mnt/m1.alpine/dev/
   • root@archlinux /home/rocketmouse 
   # mount -o bind /sys /mnt/m1.alpine/sys/
   • root@archlinux /home/rocketmouse 
   # mount -o bind /run /mnt/m1.alpine/run/
   • root@archlinux /home/rocketmouse 
   # chroot /mnt/m1.alpine/ /bin/sh -l
   archlinux:/# mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / $(ls /lib/modules/)
   ==> initramfs: creating /boot/initramfs-lts
   archlinux:/# exit
   • root@archlinux /home/rocketmouse 
   # exit
   exit
   • rocketmouse@archlinux ~ 
   $ /bin/ls -hl /mnt/m1.alpine/boot/initramfs-lts 
   -rw------- 1 root root 17M May 29 15:25 /mnt/m1.alpine/boot/initramfs-lts


Booting Alpine still ends up with the initramfs emergency recovery
shell, due to

   mount: mounting [snip] on /sysroot failed: No such file or directory
   Mounting root failed.


Maybe I'm missing a typo in grub.cfg and/or fstab:

   • rocketmouse@archlinux ~ 
   $ sudo parted -l | grep m2a
    1      1049kB  4305MB  4304MB  fat32           m2a_cpu1.esp        boot, esp
    2      4305MB  964GB   959GB   ext4            m2a_cpu1.archlinux
    5      964GB   974GB   10.7GB  ext4            m2a_cpu1.alpine
    3      974GB   983GB   8705MB  ext4            m2a_cpu1.xubu20.04
    4      983GB   1000GB  17.2GB  linux-swap(v1)  m2a_cpu1.swap       swap
   • rocketmouse@archlinux ~ 
   $ sudo blkid /dev/nvme0n1p5
   /dev/nvme0n1p5: LABEL="m1.alpine" UUID="56c09975-fb36-42e7-b959-a2b64e6c9ebf" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="m2a_cpu1.alpine" PARTUUID="a53abd3c-28a6-4e27-9c99-7a4f5f85546c"
   • rocketmouse@archlinux ~ 
   $ cat /mnt/m1.alpine/etc/mkinitfs/mkinitfs.conf
   features="ata base ext4 ide nvme scsi usb virtio"
   • rocketmouse@archlinux ~ 
   $ cat /mnt/m1.alpine/etc/fstab
   UUID=56c09975-fb36-42e7-b959-a2b64e6c9ebf /            ext4    rw,relatime  0 1
   UUID=bc0419de-6a38-4907-bb46-d2e0398228f6 swap         swap    defaults     0 0
   /dev/cdrom                                /media/cdrom iso9660 noauto,ro    0 0
   /dev/usbdisk                              /media/usb   vfat    noauto       0 0
   tmpfs                                     /tmp         tmpfs   nosuid,nodev 0 0


To boot Alpine 3 different grub entries were tested.

This is one of the working grub entries for Arch:

   • rocketmouse@archlinux /boot/grub ✗  
   $ grep ux\ t grub.cfg -A4
   menuentry "    Arch Linux threadirqs" {
           search --no-floppy --set=root --label m1.archlinux
           linux /boot/vmlinuz-linux root=/dev/disk/by-label/m1.archlinux ro threadirqs ibt=off ipv6.disable=1
           initrd /boot/intel-ucode.img /boot/initramfs-linux.img
   }


Those are the grub entries for Alpine that I tested:
1.
   • rocketmouse@archlinux /boot/grub ✗  
   $ grep Alpine grub.cfg -A4
   menuentry "    Alpine Linux" {
           search --no-floppy --set=root --label m1.alpine
           linux	/boot/vmlinuz-lts root=/dev/disk/by-label/m1.alpine ro
           initrd	/boot/initramfs-lts
   }

2.
   • rocketmouse@archlinux /boot/grub ✗  
   $ grep Alpine grub.cfg-2023-05-27+29.2_alpine_uuid -A4
   menuentry "    Alpine Linux" {
           search --no-floppy --set=root --fs-uuid 56c09975-fb36-42e7-b959-a2b64e6c9ebf
           linux	/boot/vmlinuz-lts root=UUID=56c09975-fb36-42e7-b959-a2b64e6c9ebf ro
           initrd	/boot/initramfs-lts
   }

3.
   $ grep Alpine grub.cfg-2023-05-29.1_alpine_set_behind_fs-uuid -A4
   menuentry "    Alpine Linux" {
           search --no-floppy --fs-uuid --set=root 56c09975-fb36-42e7-b959-a2b64e6c9ebf
           linux	/boot/vmlinuz-lts root=UUID=56c09975-fb36-42e7-b959-a2b64e6c9ebf ro
           initrd	/boot/initramfs-lts
   }


More info:

   • rocketmouse@archlinux /boot/grub ✗  
   $ /bin/ls -hAl /mnt/m1.alpine{,/boot/{,efi/}}
   /mnt/m1.alpine:
   total 80K
   drwxr-xr-x  2 root root 4.0K May 29 15:17 bin
   drwxr-xr-x  3 root root 4.0K May 29 15:25 boot
   drwxr-xr-x  2 root root 4.0K May 29 15:16 dev
   drwxr-xr-x 26 root root 4.0K May 29 15:16 etc
   drwxr-xr-x  3 root root 4.0K May 27 13:56 home
   drwxr-xr-x 10 root root 4.0K May 29 15:16 lib
   drwxr-xr-x  5 root root 4.0K May 27 13:56 media
   drwxr-xr-x  2 root root 4.0K May 27 13:56 mnt
   drwxr-xr-x  2 root root 4.0K May 27 13:56 opt
   drwxr-xr-x  2 root root 4.0K May 27 13:56 proc
   drwx------  2 root root 4.0K May 28 11:32 root
   drwxr-xr-x  3 root root 4.0K May 29 15:16 run
   drwxr-xr-x  2 root root  12K May 29 15:16 sbin
   drwxr-xr-x  2 root root 4.0K May 27 13:56 srv
   drwxr-xr-x  2 root root 4.0K May 27 13:56 sys
   drwxrwxrwt  2 root root 4.0K May 29 15:25 tmp
   drwxr-xr-x  8 root root 4.0K May 27 13:56 usr
   drwxr-xr-x 11 root root 4.0K May 27 14:09 var
   
   /mnt/m1.alpine/boot/:
   total 47M
   -rw-r--r-- 1 root root 3.5M May 26 08:53 System.map-lts
   lrwxrwxrwx 1 root root    1 May 27 13:57 boot -> .
   -rw------- 1 root root  17M May 28 11:40 broken_initramfs-lts
   -rw-r--r-- 1 root root 246K May 26 08:53 config-lts
   drwxr-xr-x 2 root root 4.0K May 27 13:56 efi
   -rw------- 1 root root  17M May 29 15:25 initramfs-lts
   -rw-r--r-- 1 root root 9.9M May 26 08:53 vmlinuz-lts
   
   /mnt/m1.alpine/boot/efi/:
   total 0
   • rocketmouse@archlinux /boot/grub ✗  
   $ hwinfo --cpu | grep Model | sort -u
     Model: 6.191.5 "13th Gen Intel(R) Core(TM) i3-13100"
   • rocketmouse@archlinux /boot/grub ✗  
   $ hwinfo --memory | grep Size
     Memory Size: 32 GB
   $ sudo dmidecode -t2|grep Man -A1; printf "$(sudo dmidecode -s bios-version) "; sudo dmidecode -s bios-release-date
   	Manufacturer: Gigabyte Technology Co., Ltd.
   	Product Name: B760M DS3H DDR4
   F4a 04/14/2023
   • rocketmouse@archlinux /boot/grub ✗  
   $ cat /mnt/m1.alpine/etc/os-release 
   NAME="Alpine Linux"
   ID=alpine
   VERSION_ID=3.18.0
   PRETTY_NAME="Alpine Linux v3.18"
   HOME_URL="https://alpinelinux.org/"
   BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"

The ISO was checked against the signed checksum.

Regards,
Ralf
Konstantin Kulikov <k.kulikov2@gmail.com>
Details
Message ID
<CAD+eXGQZtAEBNBMsP0GUohjZk3JekSoKGpsg3iUnPmMiPoRpAQ@mail.gmail.com>
In-Reply-To
<37693b5c20497122826b09493617276e08ffd007.camel@riseup.net> (view parent)
DKIM signature
missing
Download raw message
> I assume I can uncomment v3.18/community in addition to main, just
> mixing v3.18 and edge doesn't work. Is this correct?

Yes. There is also testing repo with some more packages.


> I don't know what to do with /etc/apk/world. I suspect it's ok as is.

It is fine.

> Booting Alpine still ends up with the initramfs emergency recovery
> shell, due to
>
>    mount: mounting [snip] on /sysroot failed: No such file or directory
>    Mounting root failed.
>
>
You need to try and mount your root device initramfs shell by hand and
debug from there.
Possibly ext4 module is not loaded and you need to add modules=ext4 to
your bootloader.

[solved] Install on single partition and without a bootloader

Details
Message ID
<a3d96c5c8478287a8a7d4e7d53fac0140116c4be.camel@riseup.net>
In-Reply-To
<CAD+eXGQZtAEBNBMsP0GUohjZk3JekSoKGpsg3iUnPmMiPoRpAQ@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On Tue, 2023-05-30 at 11:05 +0300, Konstantin Kulikov wrote:
> > I assume I can uncomment v3.18/community in addition to main, just
> > mixing v3.18 and edge doesn't work. Is this correct?
> 
> Yes. There is also testing repo with some more packages.

Thank You,

at the moment my /etc/apk/repositories does look like this:

   • rocketmouse@archlinux ~ 
   $ cat /mnt/m1.alpine/etc/apk/repositories 
   # Warning: Changing the repositories to latest-stable may initiate unexpected release upgrades.
   #
   http://mirror.bahnhof.net/pub/alpinelinux/v3.18/main
   #http://mirror.bahnhof.net/pub/alpinelinux/latest-stable/main
   #
   http://mirror.bahnhof.net/pub/alpinelinux/v3.18/community
   #http://mirror.bahnhof.net/pub/alpinelinux/latest-stable/community
   #
   # Using the testing repository on stable branches
   # Warning: Only do this if you're 100% sure what you're doing!
   # Installing packages from edge that link to something in main or community usually will not work.
   # Alpine does not officially support mixing branches this way.
   #
   #http://mirror.bahnhof.net/pub/alpinelinux/edge/testing

> > Booting Alpine still ends up with the initramfs emergency recovery
> > shell
> You need to try and mount your root device initramfs shell by hand and
> debug from there.

It wasn't necessary. However, just in case I ever should need to do
this. If startup should end with the messages

   mount: mounting /dev/nvme0n1p5 on /sysroot failed: No such file or directory
   Mouting root failed
   initramfs emergency recovery shell launched.

then I need to run

   mount -t ext4 /dev/nvme0n1p5 /sysroot

Is this correct?

> Possibly ext4 module is not loaded and you need to add modules=ext4 to
> your bootloader.

This does the trick.

   • rocketmouse@archlinux ~ 
   $ grep Alpine /boot/grub/grub.cfg -A 4
   menuentry "    Alpine Linux" {
           search --no-floppy --set=root --label m1.alpine
           linux	/boot/vmlinuz-lts root=/dev/disk/by-label/m1.alpine ro modules=ext4
           initrd	/boot/initramfs-lts
   }

Regards,
Ralf

Booting Alpine by systemd-nspawn fails - Was: Install on single partition and without a bootloader

Details
Message ID
<8610b467593bd1fe5b7335242d83ce39640adc41.camel@riseup.net>
In-Reply-To
<CAD+eXGSO+50aGGs7-2nqfEMTirc9yY3Ku=HRP+62efPw7SWS3w@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On Sun, 2023-05-28 at 11:40 +0300, Konstantin Kulikov wrote:
> 
> >    can't open /dev/tty1: No such file or directory
> >    can't open /dev/tty2: No such file or directory
> >    can't open /dev/tty3: No such file or directory
> >    can't open /dev/tty4: No such file or directory
> >    can't open /dev/tty5: No such file or directory
> >    can't open /dev/tty6: No such file or directory
> >    can't open /dev/tty1: No such file or directory
> >    can't open /dev/tty2: No such file or directory
> >       [...]
> 
> Looks like system starts, but init can't find console to spawn
> login(1) on.
> I'm not familiar with systemd, but reading its manpage i think it sets
> up /dev/console.
> Try replacing tty1 with console in /etc/inittab

Hi,

I don't understand what I need to do. This doesn't work:

   • rocketmouse@archlinux ~ 
   $ diff /mnt/m1.alpine/etc/inittab /mnt/m1.alpine/etc/inittab_no_console 
   8c8
   < tty1::respawn:/sbin/getty 38400 console
   ---
   > tty1::respawn:/sbin/getty 38400 tty1

An Internet search returned:

   # /etc/inittab
   
   ::sysinit:/etc/rc.d/startup
   
   tty1::respawn:/sbin/getty 38400 tty1
   tty2::respawn:/sbin/getty 38400 tty2
   tty3::respawn:/sbin/getty 38400 tty3
   tty4::respawn:/sbin/getty 38400 tty4
   tty5::respawn:/sbin/getty 38400 tty5
   tty6::respawn:/sbin/getty 38400 tty6
   
   # Put a getty on the serial line (for a terminal).  Uncomment this line if
   # you're using a serial console on ttyS0, or uncomment and adjust it if using a
   # serial console on a different serial port.
   #::respawn:/sbin/getty -L ttyS0 115200 vt100
   
   ::shutdown:/etc/rc.d/shutdown
   ::ctrlaltdel:/sbin/reboot

[ http://clfs.org/view/clfs-embedded-0.0.1/mips/bootscripts/inittab.html ]

Oops, I missed that Alpine's inittab contains a similar line, too, but
uncommenting it doesn't help.

   • rocketmouse@archlinux ~ 
   $ diff /mnt/m1.alpine/etc/inittab /mnt/m1.alpine/etc/inittab_no_console 
   16c16
   < ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
   ---
   > #ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100

So I use the default inittab again and systemd-nspawn still fails.

Regards,
Ralf

Re: Booting Alpine by systemd-nspawn fails - Was: Install on single partition and without a bootloader

Details
Message ID
<396bb310723cfb5b4d1e4c5e8e6387f3cdea96cd.camel@riseup.net>
In-Reply-To
<8610b467593bd1fe5b7335242d83ce39640adc41.camel@riseup.net> (view parent)
DKIM signature
missing
Download raw message
PS:

Oops, I missed the "serial console" comment. Now I understand why it
won't work, but I still don't know what to do.

Re: Booting Alpine by systemd-nspawn fails - Was: Install on single partition and without a bootloader

Konstantin Kulikov <k.kulikov2@gmail.com>
Details
Message ID
<CAD+eXGTZPGRmwXDOH16ChFZaERDtuqcx5zBhRAXVkUFMRDQCCQ@mail.gmail.com>
In-Reply-To
<396bb310723cfb5b4d1e4c5e8e6387f3cdea96cd.camel@riseup.net> (view parent)
DKIM signature
missing
Download raw message
I'm not familiar with systemd, can't help with that.

Re: Booting Alpine by systemd-nspawn fails - Was: Install on single partition and without a bootloader

Details
Message ID
<de1259c6faefcec000948b199cf9169adeb7dc10.camel@riseup.net>
In-Reply-To
<CAD+eXGTZPGRmwXDOH16ChFZaERDtuqcx5zBhRAXVkUFMRDQCCQ@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
I opened a thread at https://bbs.archlinux.org/viewtopic.php?id=286164 .

Re: Booting Alpine by systemd-nspawn fails - Was: Install on single partition and without a bootloader

Details
Message ID
<8db9c97f9f17a2d1565cb7f31c4f7b6459212578.camel@riseup.net>
In-Reply-To
<de1259c6faefcec000948b199cf9169adeb7dc10.camel@riseup.net> (view parent)
DKIM signature
missing
Download raw message
Hi,

it's solved by gaining knowledge. Microsoft employee and Pwnie Award
winner Lennart Poettering once claimed that "Systemd-Nspawn is Chroot on
Steroids". He's probably right about the side effects of steroid abuse,
since systemd-nspawn only likes Linux that uses systemd, it's completely
intolerant of other init systems, and systemd-nspawn is impotent.

On my todo list is writing a chroot wrapper script, providing some
comfort. On the quick I wrote a "reminder" of what I want to do. The
"reminder" script is a ridiculous script, but it's just to remind me
what I want to get next should I have the time to write a wrapper.

Regards,
Ralf

;D

#! /bin/dash
# chroot-alpine
# v2023-05-31-1

CHROOT=m1.alpine

usage() {
cat<<EOF

Root privileges are mandatory
Usage:
  chroot-alpine       mount   Alpine chroot no X server
  chroot-alpine -u    unmount Alpine chroot no X server

EOF
exit
}

[ $(id -u) -eq 0 ] || usage

case $2 in
  "")  ;;
   *)  usage
       ;;
esac

case $1 in
  -u)  printf "\n"                                      # umount --recursive "$(blkid -L$CHROOT)" doesn't work
       umount --recursive /mnt/$CHROOT/                 # workaround, running two times,
       umount --recursive /mnt/$CHROOT/ >/dev/null 2>&1 # if Alpine was already mounted before running this script
       rmdir  /mnt/$CHROOT/ && printf "[done]\n"        # doesn't work if mounted countless times
       printf "\n"                                      # at same or different mount points
       ;;
  "")  mkdir -p /mnt/$CHROOT
       mount -wL$CHROOT /mnt/$CHROOT/ -o noatime
       mount -t proc  /proc /mnt/$CHROOT/proc/
       mount -t sysfs /sys  /mnt/$CHROOT/sys/
       mount -o bind  /dev  /mnt/$CHROOT/dev/
       mount -o bind  /run  /mnt/$CHROOT/run/
       #printf "\nDISPLAY=$DISPLAY\n\n$CHROOT is mounted:\n$(mount | sort -u | grep $(blkid -L$CHROOT))\n\n"
       printf "\nDISPLAY=$DISPLAY\n\n$CHROOT is mounted:\n$(mount | grep $(blkid -L$CHROOT))\n\n" # better not hiding duplicates by sort -u
       chroot /mnt/$CHROOT/ /bin/sh -l
       ;;
   *)  usage
       ;;
esac

exit
Reply to thread Export thread (mbox)