Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-27 Thread Greg Wooledge
On Tue, Jul 27, 2021 at 09:23:22AM +0200, Stella Ashburne wrote:
> What commands shall I type to find out the location of the directory where 
> linux-image-5.10.0-7-amd64.deb is, given the fact that I'm using a 
> USB-installer?
> 

df
mount
cd
ls
more cd
more ls
maybe find . -name 'linux*.deb'

and so on, until you find the file.  The same way you'd find a file on
a real system, if the "locate" database is not available.

P.S. I'd avoid using mount --move.  Something may need the files to
appear in their current location, wherever that is, which is why they
were mounted there.  Use mount --bind, so the files appear in *both*
places, if that's what you need.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-27 Thread Reco
Hi.

On Tue, Jul 27, 2021 at 09:23:22AM +0200, Stella Ashburne wrote:
> What commands shall I type to find out the location of the directory
> where linux-image-5.10.0-7-amd64.deb is, given the fact that I'm using
> a USB-installer?

$ wget -q 
https://cdimage.debian.org/cdimage/weekly-builds/amd64/iso-cd/debian-testing-amd64-netinst.iso
$ 7z l /tmp/debian-testing-amd64-netinst.iso  | grep linux-image
2021-07-21 03:02:23 . 53566832 53566832 
pool/main/l/linux-signed-amd64/linux-image-5.10.0-8-amd64_5.10.46-2_amd64.deb
2021-07-21 03:02:23 . 1480 1480 
pool/main/l/linux-signed-amd64/linux-image-amd64_5.10.46-2_amd64.deb

Thus repository directory is /, and l-i directory is
/pool/main/l/linux-signed-amd64.


> Do I need to use the --bind argument like
> 
> mount --bind --move olddir newdir

No, you do not need that. A simple --bind will suffice.


> P.S.: I have never been a fan of using man pages because the commands
> contained therein don't provide examples of how to use them properly.

Some of them do, some of them do not. Manual pages are reference, not a 
tutorial.

Reco



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-27 Thread Stella Ashburne
I quote a section of the Debian's man page of mount:

The move operation
Move a mounted tree to another place (atomically). The call is:

mount --move olddir newdir

This will cause the contents which previously appeared under olddir to now be 
accessible under newdir. The physical location of the files is not changed. 
Note that olddir has to be a mountpoint.

What commands shall I type to find out the location of the directory where 
linux-image-5.10.0-7-amd64.deb is, given the fact that I'm using a 
USB-installer?

Do I need to use the --bind argument like

mount --bind --move olddir newdir



P.S.: I have never been a fan of using man pages because the commands contained 
therein don't provide examples of how to use them properly.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-21 Thread Richard Hector

On 21/07/21 11:39 pm, Greg Wooledge wrote:

No, a bind mount doesn't take a device name as an argument.  It takes
two directory names.  From the man page:

mount --bind|--rbind|--move olddir newdir

It's used when you've already got the device mounted somewhere (the first
directory), and you'd also like it to appear in a second place.


That could be interpreted to mean it still applies to a (mounted) 
device, but it doesn't - olddir can be anywhere, not just a mount point.


Richard



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-21 Thread Reco
On Wed, Jul 21, 2021 at 01:28:57PM +0200, Stella Ashburne wrote:
> Hi Reco
> 
> Thanks for your help.
> 
> > Sent: Friday, July 16, 2021 at 5:09 AM
> > From: "Reco" 
> > To: debian-user@lists.debian.org
> > Subject: Re: How do I mount the USB stick containing the installer in 
> > Rescue Mode?
> >
> > > > What you actually need is to bind mount the directory with packages into
> > > > the mounted /dev/perfect-vg/root, and just chroot into it. No need to
> > > > modify /etc/fstab at all.
> > > >
> > > Could you be so nice as to give me the command(s) to bind mount the 
> > > directory with packages? Thank you.
> >
> > mount --bind  \
> > /target/
> >
> 
> Sorry, what's source_dir_with_packages ? Were you referring to /dev/sdb1 ?

No, of course not.
The whole idea of bind-mount is that you do not mount a *device* on top
of directory, you mount a *directory* on top of another one.

You have an install media (USB stick).
That install media has a filesystem on it (/dev/sdb1), which contains
the usual Linux kernel, initrd, *and* the set of packages which
installer is supposed, well, to install for you.

That set of packages resides in a directory structure, which exact name
escapes me at this moment.
What's important is - the filesystem on /dev/sdb1 is already mounted by
installer, all you have to do is to locate that directory in the mounted
filesystem.


> By target_dir_where_packages_should_be, did you mean that I create a 
> directory called stella (for example)?

Whatever floats your boat.
Bind-mount a package directory somewhere in /target, and point apt to it.
Specific target directory name is not relevant, but you should create it
before the mounting.

Reco



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-21 Thread Greg Wooledge
On Wed, Jul 21, 2021 at 01:28:57PM +0200, Stella Ashburne wrote:
> Hi Reco
> 
> Thanks for your help.
> 
> > Sent: Friday, July 16, 2021 at 5:09 AM
> > From: "Reco" 
> > To: debian-user@lists.debian.org
> > Subject: Re: How do I mount the USB stick containing the installer in 
> > Rescue Mode?
> >
> > > > What you actually need is to bind mount the directory with packages into
> > > > the mounted /dev/perfect-vg/root, and just chroot into it. No need to
> > > > modify /etc/fstab at all.
> > > >
> > > Could you be so nice as to give me the command(s) to bind mount the 
> > > directory with packages? Thank you.
> >
> > mount --bind  \
> > /target/
> >
> 
> Sorry, what's source_dir_with_packages ? Were you referring to /dev/sdb1 ?

No, a bind mount doesn't take a device name as an argument.  It takes
two directory names.  From the man page:

   mount --bind|--rbind|--move olddir newdir

It's used when you've already got the device mounted somewhere (the first
directory), and you'd also like it to appear in a second place.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-21 Thread Stella Ashburne
Hi Reco

Thanks for your help.

> Sent: Friday, July 16, 2021 at 5:09 AM
> From: "Reco" 
> To: debian-user@lists.debian.org
> Subject: Re: How do I mount the USB stick containing the installer in Rescue 
> Mode?
>
> > > What you actually need is to bind mount the directory with packages into
> > > the mounted /dev/perfect-vg/root, and just chroot into it. No need to
> > > modify /etc/fstab at all.
> > >
> > Could you be so nice as to give me the command(s) to bind mount the 
> > directory with packages? Thank you.
>
> mount --bind  \
>   /target/
>

Sorry, what's source_dir_with_packages ? Were you referring to /dev/sdb1 ?

By target_dir_where_packages_should_be, did you mean that I create a directory 
called stella (for example)?



Re: [Misstänkt skräppost] Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-17 Thread xtra-...@telia.com
--- Begin Message ---
Hi.

On Thu, Jul 15, 2021 at 11:30:10AM -0400, Stefan Monnier wrote:
> Greg Wooledge [2021-07-15 07:00:40] wrote:
> > On Thu, Jul 15, 2021 at 12:55:11PM +0300, Reco wrote:
> >> "nofail" is really needed for removable devices, because whoever
> >> designed systemd made an "interesting" decision to halt the boot process
> >> (i.e. host is inaccessible by network, console access only) even if a
> >> single filesystem mentioned in fstab fails to mount.
> > This was the traditional behavior before systemd, so one can't really
> > fault systemd for continuing the practice.
> 
> That's not my recollection.  AFAIK before systemd, you'd just get an
> error message and the boot would just (try to) continue.

My words exactly.


> I don't think systemd's decision is bad.

You have a remote server.
You modify fstab on that server.
You reboot a server after that, and maybe a lot of time had passed since
fstab modification.

Now you have a system that's inaccessible via SSH/VNC/whatever network
protocol you're using for remote access. Good luck unbricking this
system, especially if it does require a road trip. Or paying for renting
KVM. Or soldering UART, because manufacturer haven't exposed it to the
end user.

I cannot call that an improvement, because I do remember how it used to
work in Debian before systemd. To systemd's defence - RedHat version of
sysvinit did exactly the same in this regard.


Could be worse, I guess. One can render modern AIX unbootable by simply
adding inaccessible NFS mount to /etc/filesystems (they call /etc/fstab
this way). At least systemd is "smart" enough to avoid such pitfall.


> But I think it's implementation is not good enough: it should offer
> some kind of simple "continue y/n?" prompt.
> [ "Simple" for the user: the implementation might be not so simple.  ]

That'd change nothing important, really.
You'd have to be at the console to answer such question, you cannot just
boot somehow and fix things after via SSH.


> To be honest, I've added the `nofail` pretty much everywhere and hence
> haven't faced this problem recently, so for all I know, the
> implementation has already been improved.

Nope, it did not. I've faced similar problem just two days ago.
>From the upstream POV the current behaviour is correct, so there's
nothing to improve.

Reco

--- End Message ---


Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-16 Thread Greg Wooledge
On Fri, Jul 16, 2021 at 10:17:45AM -0500, David Wright wrote:
> On Fri 16 Jul 2021 at 07:31:41 (-0400), Greg Wooledge wrote:
> > On Thu, Jul 15, 2021 at 11:43:15PM -0500, David Wright wrote:
> > > I presume you type /etc/fstab into your post, both because of the
> > > missing # for the comment, and because the /dev/sr0 line has too
> > > many fields. It should contain   udf,iso9660 user,noauto
> > > without spaces after the commas.
> > 
> > The space between iso9660 and user should *also* be a comma.
> 
> Eh? Attached is the virgin fstab from my experimental encrypted root
> installation. I think it's self-evident why there's a space separating
> the two alternative filesystem types from the mount options.

Ah.  My mistake.

Looking at my own (Debian generated) fstab file now, I see the same
thing on the /dev/sr0 line.  The type and options fields are separated
by only one space, and it looks really weird, especially when all the
lines before that have several spaces between those two fields.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-16 Thread David Wright
On Fri 16 Jul 2021 at 07:31:41 (-0400), Greg Wooledge wrote:
> On Thu, Jul 15, 2021 at 11:43:15PM -0500, David Wright wrote:
> > I presume you type /etc/fstab into your post, both because of the
> > missing # for the comment, and because the /dev/sr0 line has too
> > many fields. It should contain   udf,iso9660 user,noauto
> > without spaces after the commas.
> 
> The space between iso9660 and user should *also* be a comma.

Eh? Attached is the virgin fstab from my experimental encrypted root
installation. I think it's self-evident why there's a space separating
the two alternative filesystem types from the mount options.

> The
> original post was a mess, and I agree, she probably typed it by
> hand (with multiple errors -- *all* of the comments were missing their
> pound signs, for instance, not just the one you mentioned).

Yes, should have pointed it out. At first reading, I assumed they'd
missed the first character when dragging the mouse, but on rereading,
I saw the other errors, and corrected only those. Of course, there'd
be no mouse pointer to drag in Rescue, so you really can only
transcribe or photograph the text.

> Anyway, this thread has gone on for a ridiculously long time.  She
> just needs to identify the correct device name, and create a new
> directory in which to mount it.

AIUI the device /dev/sdb1 is already mounted. However, by selecting
"execute shell in /d/m/sda-whatsit", the /cdrom mountpoint gets
hidden in the Alt-F1 shell.

> It's sad that people always somehow think they need to use existing
> directories for their mount points.  You can just "mkdir /stella" and
> use that, and voila -- no conflicts.  It's an ephemeral system, so you
> aren't even "polluting" a "pristine" root file system with your new
> directory.  It's all temporary.

Been there, done that. Strictly, the answer to the Subject line is:
"You don't. It's already mounted. It's on /cdrom." Unfortunately,
the other two shells weren't obvious to the OP (or, perhaps, to
anyone else who replied).

Taking a step back, I would have wished that the OP could have booted
the installed system and fixed Grub from there, and never opened this
new topic at all.

Having taken this step back, I see that it hasn't been mentioned that
one of the menu alternatives to "execute shell in /d/m/sda-whatsit"
is "Reinstall Grub". I'm not inclined to go there, as I've been
learning about this Rescue business on a system with a perfectly good
Grub installation that I'm happy to copy bits out of but not change.

Taking two steps back, and looking at the thread "How do I get back
the GRUB menu with the blue background?", I'm at a loss to know why
nobody else has posted what the Grub commands are to boot a system
with encrypted root *and* LVM. (Actually I think it's an encrypted
partition with LVM inside it.) I've posted how to boot a system with
an encrypted root filesystem using raw Grub commands so they can fix
up Grub, but I can't help with their LVM, never having used it.

So many people here say, "Use LVM", "You should be using LVM", "LVM
should be the mainstream default". And yet, no replies are forthcoming.

Cheers,
David.
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
#
/dev/mapper/sda5_crypt /   ext4errors=remount-ro 0   1
# /boot was on /dev/sda2 during installation
UUID=700b607c-ffa6-4435-a4b6-10894928c764 /boot   ext2defaults  
  0   2
/dev/sr0/media/cdrom0   udf,iso9660 user,noauto 0   0


Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-16 Thread Greg Wooledge
On Thu, Jul 15, 2021 at 11:43:15PM -0500, David Wright wrote:
> I presume you type /etc/fstab into your post, both because of the
> missing # for the comment, and because the /dev/sr0 line has too
> many fields. It should contain   udf,iso9660 user,noauto
> without spaces after the commas.

The space between iso9660 and user should *also* be a comma.  The
original post was a mess, and I agree, she probably typed it by
hand (with multiple errors -- *all* of the comments were missing their
pound signs, for instance, not just the one you mentioned).

Anyway, this thread has gone on for a ridiculously long time.  She
just needs to identify the correct device name, and create a new
directory in which to mount it.

It's sad that people always somehow think they need to use existing
directories for their mount points.  You can just "mkdir /stella" and
use that, and voila -- no conflicts.  It's an ephemeral system, so you
aren't even "polluting" a "pristine" root file system with your new
directory.  It's all temporary.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread David
On Fri, 16 Jul 2021 at 05:00, Stella Ashburne  wrote:

I'm getting a sense of possible XY problem here.
https://en.wikipedia.org/wiki/XY_problem

> > Chicken and egg: I think the OP is trying to set up some sort of
> > repository to install packages from. (I can't be sure.

> Your guess is right. I wish to install linux-image-5.10.0-7-amd64.deb
> onto chroot /target after entering Rescue Mode.

I suspect that 'I want to use rescue mode to install a kernel' is
question "Y", whereas ...

> > I would
> > have preferred it if they'd continued to try and boot their
> > actual installed system,

> At this moment I don't have a GRUB menu.

... previously we have been told that a grub boot failure is the
*actual* problem "X", unless something has changed from what
we've been told so far.

In my opinion, this is what needs to be fixed before making the situation
more confusing by trying to add another kernel to a broken installation.

My guess is that the reinstallation failed because it was
done in such a way that /boot was not the mount point
of the unencrypted boot partition at the time that the
installer configured grub and generated the initrd.

After chroot succeeds, the first goal must be to fix what originally
caused the grub menu breakage during the reinstall attempt.
That requires to check that /boot is the mount point of the
unencrypted boot partition

After that, run 'grub-update' and 'grub-install' as I have
already advised in previous messages.

'grub-install --boot-directory=/mount/point/of/boot/partition
/dev/hdd/specified/here'

Note that these commands must be run in a *linux* *shell*
environment. And the grub> prompt is *not* one of those.
grub is not an entire linux system, it is just a boot loader.

I would also make a backup of all the initrd files and then run
'update-initramfs -u -k all' and fix any errors it gives.

And then reboot and see if it works.

The time to install a new kernel will be after that.

Also as previously advised, if asking for help in future please
show the output of 'lsblk -f' because it shows all devices, whereas
'mount' and 'df' only give information about filesystems that
are mounted.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Reco
On Thu, Jul 15, 2021 at 10:11:06PM +0200, Stella Ashburne wrote:
> Hi
> 
> > Sent: Thursday, July 15, 2021 at 7:07 PM
> > From: "Reco" 
> > To: debian-user@lists.debian.org
> > Subject: Re: How do I mount the USB stick containing the installer in 
> > Rescue Mode?
> 
> > Ok. Can you use this rescue mode to execute an ordinary shell, with full
> > access to all filesystems?
> 
> Before I proceed with your suggestion, while in Resuce Mode, do I
> enter the encryption passphrase or not? If I don't enter the password,
> /dev/perfect-vg/root won't be mounted.

You have to enter the encryption passphrase. It makes little sense to do
all this otherwise.


> Even after I've entered the encryption passphrase, there are two ways
> to execute a shell: one is to execute it in /dev/perfect-vg/root
> environment and the other is to execute it in the installer
> environment. Which environment do you want me to executve a shell in
> please?

First one definitely won't do it, so it's the "installer environment".


> What did you mean by "full access to all filesystems"? When I was
> installing Debian 11, I first encrypted a free space with LUKS and
> then created two logical volumes in it: one whose mount point is /
> (the root file system. Debian installer requires it; otherwise the
> installation can't and won't proceed.) while the other is "used as"
> swap area.

Compare the results of "mount" command from both shells. The difference
should be obvious.


> > If you're executing a shell in a
> > logical volume, you're chrooted into that filesystem.
> 
> I had to enter the encryption passphrase first, followed by mounting
> /dev/perfect-vg/root as a root file system temporarily. Then I chose
> 'Execute a shell in the installer environment' and only then would I
> be able to chroot /target

This. My suggestion is to use bind-mount before chrooting there.


> > What you actually need is to bind mount the directory with packages into
> > the mounted /dev/perfect-vg/root, and just chroot into it. No need to
> > modify /etc/fstab at all.
> >
> Could you be so nice as to give me the command(s) to bind mount the directory 
> with packages? Thank you.

mount --bind  \
/target/

Reco



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread David Wright
On Thu 15 Jul 2021 at 22:19:23 (+0200), Stella Ashburne wrote:
> > Sent: Thursday, July 15, 2021 at 7:30 PM
> > From: "Thomas Schmitt" 
> >
> > Well, since the case "already mounted" is quite outruled, it might be time
> > to explore "mount point busy".
> >
> >   
> > https://codesearch.debian.net/search?q=package%3Autil-linux+already+mounted+or+mount+point+busy
> > shows that mount(8) emits this message if it gets error code EBUSY.
> > It is not so clear from where this code comes, but mount(2) would be a
> > fine candidate (or placeholder).
> 
> In Rescue Mode, it's impossible for me to install packages such as the one 
> whose link you had provided.
> >
> > So does it work with some other, newly created directory instead of /mnt ?
> >
> 
> No, it doesn't work with other newly created directories in addition to /mnt.

I can tell you why you can't mount it, but you're swimming in waters
too deep for me, so I can't tell you the "proper" way¹ to circumvent
the problem. Others probably can. I'll just suggest a workaround
(untested).

OK, you've just asked for a shell on /dev/perfect-vg/root which is the
root filesystem on your new installation. But up until this point,
the rescue root filesystem was in memory, created when you booted from
the stick. The rescue stick itself (/dev/sdb1) was mounted on /cdrom.
Your problem is: all that is still true, and it's still mounted there.

If you press Alt-F2, or Alt-F3 (or use Alt-arrows to achieve the
same), you can run a shell in the original rescue environment.
(You could actually have started one much earlier after booting.)

Type:
# mount
in *this* shell and you will see   /dev/sdb1 on /cdrom   in the list,
and that is the installation/rescue stick's mountpoint.

If you list /cdrom, you'll see /dists/ and /pool/ in there, which is
how repositories normally present themselves. The symlink debian->.
enables "debian" to be used as the name of the $ARCHIVE_ROOT,
thereby containing debian/dists/.

You should also see   /dev/perfect-vg/root on /target   in the list,
and /target is where your new root filesystem resides (as seen from
the Alt-F1 point of view).

To summarise, Alt-F2 and Alt-F3 shells show you the root filesystem
of the rescue environment (all the time), whereas Alt-F1 shows you
a root filesystem rooted at whatever you chose in the dialogue box.
This Alt-F1 root sits under /target in the Alt-F2 and Alt-F3 shells.

In this situation, my workaround would be (in Alt-F1) to create a
directory called /home/debian/.² You can now (in Alt-F2or3) copy
/dists and /pool into /target/home/debian/ which will make the
repository on the stick available in Alt-F1: the $ARCHIVE_ROOT
will be just /home/debian/.

BTW If you're wondering what Alt-F4 is, it's the system log: the
tail of of the file /var/log/syslog (as seen from Alt-F2or3).

¹ Perhaps some sort of bind mount?

² I'm assuming your own username is not debian, so it won't collide
  with your own home directory.

Cheers,
David.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread David Wright
On Thu 15 Jul 2021 at 22:15:59 (+0200), Stella Ashburne wrote:
> > Sent: Thursday, July 15, 2021 at 7:08 PM
> > From: "David Wright" 
> >
> > Best I can do. (And I see that your kernel's naming of sda/sdb
> > is more stable than on at least a couple of my machines.)
> >
> What did you mean by "more stable"?

(Greg covered this.)

> > It might be worth posting a request for the stanza I asked for,
> > but as a new topic with a specific Subject line.
> 
> What "stanza" were you referring to? Was it Reco who posted it? And you wrote 
> that it was posted some time in June?

The /full/ stanza is next, but Grub probably makes this look more
complicated by adding more flexibility than any one user could
ever need. (It's GRand Unified …, after all.)

menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu 
--class os $menuentry_id_option 
'gnulinux-simple-80318fa0-5915-4cc3-bc7c-99af2cfbfda9' {
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 
--hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  
700b607c-ffa6-4435-a4b6-10894928c764
else
  search --no-floppy --fs-uuid --set=root 
700b607c-ffa6-4435-a4b6-10894928c764
fi
echo'Loading Linux 5.10.0-7-amd64 ...'
linux   /vmlinuz-5.10.0-7-amd64 
root=UUID=80318fa0-5915-4cc3-bc7c-99af2cfbfda9 ro  quiet
echo'Loading initial ramdisk ...'
initrd  /initrd.img-5.10.0-7-amd64
}

That boots the encrypted root installation that I made the other day,
but I can boot the system manually just by typing C at the grub menu,
and then:

Grub> set root='hd0,gpt2'
Grub> linux /vmlinuz-5.10.0-7-amd64 ro quiet 
root=UUID=80318fa0-5915-4cc3-bc7c-99af2cfbfda9
Grub> initrd /initrd.img-5.10.0-7-amd64

or the second line can be shortened to:

Grub> linux /vmlinuz-5.10.0-7-amd64 ro quiet root=LABEL=viva05

or even:

Grub> linux /vmlinuz-5.10.0-7-amd64 ro quiet root=/dev/dm-0

because, once the disk's 5th partition has been unlocked,¹ any of
these properties describes the filesystem inside².

> > I can't see
> > why you shouldn't be able to boot your system with manual Grub
> > commands.
> 
> I thought so too. GRUB developers would and should have built a "Rescue Mode" 
> by just entering the commands.

They have, and you're using it. No, what I meant was that you should
be able to boot it, just giving the correct raw commands. The problem
is knowing what those correct commands are.

¹ Skip this; it's just for the record. Before I made this encrypted
  installation, I posted that you might need to load Grub modules
  like crypto, cryptodisk and luks. However, I now think that these
  modules may exist for unlocking /boot (which would have to be done
  by Grub) rather than / (which can be left for initrd to do).

² root=UUID=80318fa0-5915-4cc3-bc7c-99af2cfbfda9 was copied from grub.cfg,
  root=LABEL=viva05 was a LABEL set in the screen dialogue already posted,
  root=/dev/dm-0 was the device mapper I observed when I first booted the
  system (using Grub's menu).

Cheers,
David.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread David Wright
On Thu 15 Jul 2021 at 20:52:34 (+0200), Stella Ashburne wrote:
> > Sent: Thursday, July 15, 2021 at 4:05 PM
> > From: "David Wright" 
> >
> > Presumably given as root.
> >
> A definite yes because I chose to mount /dev/perfect-vg/root as a root file 
> system in Rescue Mode.
> 
> > > The error message is:
> > >
> > > mount: /media/myusb: /dev/sdb1 already mounted or mount point busy
> >
> > Type:
> > $ ls -l /dev/disk/by-label/
> > to see what the kernel called your stick. Debian installers have LABELs.
> 
> root@perfect:/# ls -l /dev/disk/by-label/
> Total 0
> lrwxrwxrwx 1 root root 10 Jul 15 17:00 'Debian\x20testing\x20amd64\x201' --> 
> ../../sdb1
> root@perfect:/#
> 
> >
> > > Below are the results of cat /etc/fstab
> > >
> > >
> > >
> > > /dev/mapper/perfect--vg-root   /  ext4 errors-remount-ro  
> > >  0   1
> > > /boot/efi was on /dev/sda1 during installation
> >
> > There's a # before that line
> >
> Which line please?

The last line quoted, ie the line should read

# /boot/efi was on /dev/sda1 during installation

> > > UUID=A30E-2C33/boot/efi vfatumask=0077  0  1
> > > /dev/mapper/perfect--vg-swapnone   swapsw   0  0
> > > /dev/sr0  /media/cdrom0 udf, iso9660 user, noauto   0  0
> > > /media/myusb
> >
> > That line looks spurious. If you put it there, I would remove it for
> > the time being.
> >
> Did you mean /media/myusb ?

Yes, an entry in fstab needs at least four fields:
Device   Mountpoint   FStype   Options

I presume you type /etc/fstab into your post, both because of the
missing # for the comment, and because the /dev/sr0 line has too
many fields. It should contain   udf,iso9660 user,noauto
without spaces after the commas.

> > When you mount a USB stick as root, you don't need
> > an entry in fstab, but you do need to create a mount point first.
> 
> I didn't know that I didn't need to create an entry in fstab if I mount a USB 
> stick as root.
> 
> > Of course, this has been done for you as a convenience: there is
> > a /mnt directory specifically for temporarily mounting a device.
> >
> root@perfect:/# mount /dev/sdb1 /mnt
> mount: /mnt: /dev/sdb1 already mounted or mount point busy
> root@perfect:/#

The principal function of fstab is to describe filesystems that need
mounting by the OS for it to carry out its normal functions.
A second function is to hold information so that filesystems can be
mounted merely by mentioning only the device or the mountpoint.
A third is to make it possible for users to do the same, but without
require root privilege.

But if you're prepared to type the whole mount command, root can mount
"any" device on "any" mountpoint (when sensible). And that's obviously
more flexible when you're trying things out. You don't want to have to
keep going back to fstab to tweak it all the time.

Cheers,
David.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Greg Wooledge
On Thu, Jul 15, 2021 at 10:15:59PM +0200, Stella Ashburne wrote:
> > From: "David Wright" 

> > Best I can do. (And I see that your kernel's naming of sda/sdb
> > is more stable than on at least a couple of my machines.)
> >
> What did you mean by "more stable"?

The reason we strongly discourage the use of /dev/sda1 (and similar
device names) in the /etc/fstab file is because those device names
are not stable.  This means they are not guaranteed to remain the same
each time you boot.  The disk that is called "sda" right now might be
called "sdb" next time you boot.

This can happen due to kernel changes, hardware changes, or simply race
conditions even if *nothing* has changed.

Because of this unreliable naming, various alternatives are suggested.
On most Debian installs, the fstab file is populated using the UUID of
each file system that's known at installation time.  That looks something
like this:

#
# / was on /dev/sda7 during installation
UUID=c4691ccb-2090-491e-8e82-d7cc822db04a /   ext4
errors=remount-ro 0   1
# /boot/efi was on /dev/sda1 during installation
UUID=4C30-7972  /boot/efi   vfatumask=0077  0   1
# /home was on /dev/sda8 during installation
UUID=19fb397b-a113-4536-a03d-d60e176cbfdf /home   ext4defaults  
  0   2
# /stuff was on /dev/sda9 during installation
UUID=95058c4a-44e2-4a90-87b5-2a5fe40d3cdb /stuff  ext4defaults  
  0   2
# swap was on /dev/sda6 during installation
UUID=08c87bdb-17f4-40ab-9b2f-5cb2f29149fb noneswapsw
  0   0
/dev/sr0/media/cdrom0   udf,iso9660 user,noauto 0   0


Another method is to put "labels" on each file system, and then use those
labels in the fstab file.  That works great for some people, especially
people who are very organized, and like to take charge of the details
themselves.

Another method is to identify some unique device that will always refer to
the device in question, and use that in the fstab file.  For example, you
might decide that on your particular system,

/dev/disk/by-path/pci-:00:17.0-ata-1-part9

is a reliable name, and will always refer to the partition that you want to
mount, and you may choose to use that in your fstab file.  (This is a
device that I pulled at random from my desktop PC, and it's referring to
a partition by referencing the PCI ID of the disk controller.  This is
actually *not* a stable name.  It's a very bad name.  PCI IDs change all
the time, and should not be relied upon.  *cough* network interface naming.)

Anyway, that's what "stable" means in this context.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Stella Ashburne
Hello Thomas

> Sent: Thursday, July 15, 2021 at 7:30 PM
> From: "Thomas Schmitt" 
> To: debian-user@lists.debian.org
> Subject: Re: How do I mount the USB stick containing the installer in Rescue 
> Mode?
>
> Well, since the case "already mounted" is quite outruled, it might be time
> to explore "mount point busy".
>
>   
> https://codesearch.debian.net/search?q=package%3Autil-linux+already+mounted+or+mount+point+busy
> shows that mount(8) emits this message if it gets error code EBUSY.
> It is not so clear from where this code comes, but mount(2) would be a
> fine candidate (or placeholder).

In Rescue Mode, it's impossible for me to install packages such as the one 
whose link you had provided.

>
> So does it work with some other, newly created directory instead of /mnt ?
>

No, it doesn't work with other newly created directories in addition to /mnt.

> Have a nice day :)
>
You too.
> Thomas
>
Stella



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Stella Ashburne
Hello David

> Sent: Thursday, July 15, 2021 at 7:08 PM
> From: "David Wright" 
> To: debian-user@lists.debian.org
> Subject: Re: How do I mount the USB stick containing the installer in Rescue 
> Mode?
>
>
> Best I can do. (And I see that your kernel's naming of sda/sdb
> is more stable than on at least a couple of my machines.)
>
What did you mean by "more stable"?

> It might be worth posting a request for the stanza I asked for,
> but as a new topic with a specific Subject line.

What "stanza" were you referring to? Was it Reco who posted it? And you wrote 
that it was posted some time in June?

> I can't see
> why you shouldn't be able to boot your system with manual Grub
> commands.

I thought so too. GRUB developers would and should have built a "Rescue Mode" 
by just entering the commands.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Reco
Hi.

On Thu, Jul 15, 2021 at 11:30:10AM -0400, Stefan Monnier wrote:
> Greg Wooledge [2021-07-15 07:00:40] wrote:
> > On Thu, Jul 15, 2021 at 12:55:11PM +0300, Reco wrote:
> >> "nofail" is really needed for removable devices, because whoever
> >> designed systemd made an "interesting" decision to halt the boot process
> >> (i.e. host is inaccessible by network, console access only) even if a
> >> single filesystem mentioned in fstab fails to mount.
> > This was the traditional behavior before systemd, so one can't really
> > fault systemd for continuing the practice.
> 
> That's not my recollection.  AFAIK before systemd, you'd just get an
> error message and the boot would just (try to) continue.

My words exactly.


> I don't think systemd's decision is bad.

You have a remote server.
You modify fstab on that server.
You reboot a server after that, and maybe a lot of time had passed since
fstab modification.

Now you have a system that's inaccessible via SSH/VNC/whatever network
protocol you're using for remote access. Good luck unbricking this
system, especially if it does require a road trip. Or paying for renting
KVM. Or soldering UART, because manufacturer haven't exposed it to the
end user.

I cannot call that an improvement, because I do remember how it used to
work in Debian before systemd. To systemd's defence - RedHat version of
sysvinit did exactly the same in this regard.


Could be worse, I guess. One can render modern AIX unbootable by simply
adding inaccessible NFS mount to /etc/filesystems (they call /etc/fstab
this way). At least systemd is "smart" enough to avoid such pitfall.


> But I think it's implementation is not good enough: it should offer
> some kind of simple "continue y/n?" prompt.
> [ "Simple" for the user: the implementation might be not so simple.  ]

That'd change nothing important, really.
You'd have to be at the console to answer such question, you cannot just
boot somehow and fix things after via SSH.


> To be honest, I've added the `nofail` pretty much everywhere and hence
> haven't faced this problem recently, so for all I know, the
> implementation has already been improved.

Nope, it did not. I've faced similar problem just two days ago.
>From the upstream POV the current behaviour is correct, so there's
nothing to improve.

Reco



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Stella Ashburne
Hi

> Sent: Thursday, July 15, 2021 at 7:07 PM
> From: "Reco" 
> To: debian-user@lists.debian.org
> Subject: Re: How do I mount the USB stick containing the installer in Rescue 
> Mode?

> Ok. Can you use this rescue mode to execute an ordinary shell, with full
> access to all filesystems?

Before I proceed with your suggestion, while in Resuce Mode, do I enter the 
encryption passphrase or not? If I don't enter the password, 
/dev/perfect-vg/root won't be mounted.

Even after I've entered the encryption passphrase, there are two ways to 
execute a shell: one is to execute it in /dev/perfect-vg/root environment and 
the other is to execute it in the installer environment. Which environment do 
you want me to executve a shell in please?

What did you mean by "full access to all filesystems"? When I was installing 
Debian 11, I first encrypted a free space with LUKS and then created two 
logical volumes in it: one whose mount point is / (the root file system. Debian 
installer requires it; otherwise the installation can't and won't proceed.) 
while the other is "used as" swap area.

> If you're using your USB stick to boot, you have its file system
> (/dev/sdb1 in this case) mounted.

That's a logical assumption because I needed the USB-installer to boot into 
Rescue Mode.

> If you're executing a shell in a
> logical volume, you're chrooted into that filesystem.

I had to enter the encryption passphrase first, followed by mounting 
/dev/perfect-vg/root as a root file system temporarily. Then I chose 'Execute a 
shell in the installer environment' and only then would I be able to chroot 
/target

> But it does not change that the filesystem from /dev/sdb1 is mounted
> already, it's just inaccessible from the chroot.
>
That's why I asked for help here.

> What you actually need is to bind mount the directory with packages into
> the mounted /dev/perfect-vg/root, and just chroot into it. No need to
> modify /etc/fstab at all.
>
Could you be so nice as to give me the command(s) to bind mount the directory 
with packages? Thank you.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Stefan Monnier
Greg Wooledge [2021-07-15 07:00:40] wrote:
> On Thu, Jul 15, 2021 at 12:55:11PM +0300, Reco wrote:
>> "nofail" is really needed for removable devices, because whoever
>> designed systemd made an "interesting" decision to halt the boot process
>> (i.e. host is inaccessible by network, console access only) even if a
>> single filesystem mentioned in fstab fails to mount.
> This was the traditional behavior before systemd, so one can't really
> fault systemd for continuing the practice.

That's not my recollection.  AFAIK before systemd, you'd just get an
error message and the boot would just (try to) continue.

I don't think systemd's decision is bad.  But I think it's implementation is
not good enough: it should offer some kind of simple "continue
y/n?" prompt.
[ "Simple" for the user: the implementation might be not so simple.  ]

To be honest, I've added the `nofail` pretty much everywhere and hence
haven't faced this problem recently, so for all I know, the
implementation has already been improved.  But the behavior I saw back
when moving to systemd was definitely not pleasant.


Stefan



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Thomas Schmitt
Hi,

Stella Ashburne wrote:
> root@perfect:/# mount /dev/sdb1 /mnt
> mount: /mnt: /dev/sdb1 already mounted or mount point busy

Well, since the case "already mounted" is quite outruled, it might be time
to explore "mount point busy".

  
https://codesearch.debian.net/search?q=package%3Autil-linux+already+mounted+or+mount+point+busy
shows that mount(8) emits this message if it gets error code EBUSY.
It is not so clear from where this code comes, but mount(2) would be a
fine candidate (or placeholder).

  EBUSY  [...]   Or,  it
 cannot  be mounted on target because target is still busy (it is
 the working directory of some thread, the mount point of another
 device, has open files, etc.).

So does it work with some other, newly created directory instead of /mnt ?


Have a nice day :)

Thomas



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread David Wright
On Thu 15 Jul 2021 at 20:29:53 (+0200), Stella Ashburne wrote:
> > Sent: Thursday, July 15, 2021 at 3:49 PM
> > From: "David Wright" 
> > To: debian-user@lists.debian.org
> > Subject: Re: How do I mount the USB stick containing the installer in 
> > Rescue Mode?
> >
> > This
> > might help the OP boot the system manually and recover the blue
> > Grub menu.
> >
> That's very nice of you, David.

Best I can do. (And I see that your kernel's naming of sda/sdb
is more stable than on at least a couple of my machines.)

It might be worth posting a request for the stanza I asked for,
but as a new topic with a specific Subject line. I can't see
why you shouldn't be able to boot your system with manual Grub
commands. I was surprised how easy it was with an encrypted root
filesystem, needing no more than just the usual three lines:
set root=, linux and initrd. The only unusual thing was that
the foo in linux root=foo … is not visible with Grub>
commands (because it's still locked inside the encryption).

Cheers,
David.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Reco
Hi.

On Thu, Jul 15, 2021 at 08:38:59PM +0200, Stella Ashburne wrote:
> > Sent: Thursday, July 15, 2021 at 6:26 PM
> > From: "Brian" 
> > To: debian-user@lists.debian.org
> > Subject: Re: How do I mount the USB stick containing the installer in 
> > Rescue Mode?
> >
> > On Thu 15 Jul 2021 at 20:01:05 +0200, Stella Ashburne wrote:
> >
> > > root@perfect:/# file -sL /dev/sdb1
> > > bash: file: command not found
> > > root@perfect:/#
> >
> Nope, apparently it isn't available in Rescue Mode.
> 
> Entered encryption passphrase -> Choose a device to use as root file system 
> -> /dev/perfect-vg/root -> Execute a shell in /dev/perfect-vg/root

Ok. Can you use this rescue mode to execute an ordinary shell, with full
access to all filesystems?
I've been thinking about it, and it makes some sense.

If you're using your USB stick to boot, you have its file system
(/dev/sdb1 in this case) mounted. If you're executing a shell in a
logical volume, you're chrooted into that filesystem.

But it does not change that the filesystem from /dev/sdb1 is mounted
already, it's just inaccessible from the chroot.


What you actually need is to bind mount the directory with packages into
the mounted /dev/perfect-vg/root, and just chroot into it. No need to
modify /etc/fstab at all.

Reco



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Stella Ashburne
Hi David

> Sent: Thursday, July 15, 2021 at 6:42 PM
> From: "David Wright" 
> To: debian-user@lists.debian.org
> Subject: Re: How do I mount the USB stick containing the installer in Rescue 
> Mode?
>
> That's right, it's the 16th deb to be installed at the main
> installation stage, but if you use the installer stick for
> rescue, I don't think it's installed early enough.
>
Based on the result of typing the 'file' command, it's appears that the package 
'file' isn't installed when one is using Rescue Mode.


> Chicken and egg: I think the OP is trying to set up some sort of
> repository to install packages from. (I can't be sure.

Your guess is right. I wish to install linux-image-5.10.0-7-amd64.deb onto 
chroot /target after entering Rescue Mode.

> I would
> have preferred it if they'd continued to try and boot their
> actual installed system,

At this moment I don't have a GRUB menu.

> but any help I might have given
> fell short because I have no experience with LVM.)

Oh..but you've helped me in other ways and for which I appreciate it very much.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Stella Ashburne
Hello David,

Nice to hear from you again.

> Sent: Thursday, July 15, 2021 at 4:05 PM
> From: "David Wright" 
> To: debian-user@lists.debian.org
> Subject: Re: How do I mount the USB stick containing the installer in Rescue 
> Mode?
>
> Presumably given as root.
>
A definite yes because I chose to mount /dev/perfect-vg/root as a root file 
system in Rescue Mode.

> > The error message is:
> >
> > mount: /media/myusb: /dev/sdb1 already mounted or mount point busy
>
> Type:
> $ ls -l /dev/disk/by-label/
> to see what the kernel called your stick. Debian installers have LABELs.

root@perfect:/# ls -l /dev/disk/by-label/
Total 0
lrwxrwxrwx 1 root root 10 Jul 15 17:00 'Debian\x20testing\x20amd64\x201' --> 
../../sdb1
root@perfect:/#

>
> > Below are the results of cat /etc/fstab
> >
> >  
> >  
> > /dev/mapper/perfect--vg-root   /  ext4 errors-remount-ro   
> > 0   1
> > /boot/efi was on /dev/sda1 during installation
>
> There's a # before that line
>
Which line please?

> > UUID=A30E-2C33/boot/efi vfatumask=0077  0  1
> > /dev/mapper/perfect--vg-swapnone   swapsw   0  0
> > /dev/sr0  /media/cdrom0 udf, iso9660 user, noauto   0  0
> > /media/myusb
>
> That line looks spurious. If you put it there, I would remove it for
> the time being.
>
Did you mean /media/myusb ?

> When you mount a USB stick as root, you don't need
> an entry in fstab, but you do need to create a mount point first.

I didn't know that I didn't need to create an entry in fstab if I mount a USB 
stick as root.

> Of course, this has been done for you as a convenience: there is
> a /mnt directory specifically for temporarily mounting a device.
>
root@perfect:/# mount /dev/sdb1 /mnt
mount: /mnt: /dev/sdb1 already mounted or mount point busy
root@perfect:/#





Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread David Wright
On Thu 15 Jul 2021 at 19:26:43 (+0100), Brian wrote:
> On Thu 15 Jul 2021 at 20:01:05 +0200, Stella Ashburne wrote:
> 
> > root@perfect:/# file -sL /dev/sdb1
> > bash: file: command not found
> > root@perfect:/#
> 
> File is a standard utilty. It should be on your system.

That's right, it's the 16th deb to be installed at the main
installation stage, but if you use the installer stick for
rescue, I don't think it's installed early enough.

>  apt install file

Chicken and egg: I think the OP is trying to set up some sort of
repository to install packages from. (I can't be sure. I would
have preferred it if they'd continued to try and boot their
actual installed system, but any help I might have given
fell short because I have no experience with LVM.)

Cheers,
David.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Stella Ashburne
> Sent: Thursday, July 15, 2021 at 6:26 PM
> From: "Brian" 
> To: debian-user@lists.debian.org
> Subject: Re: How do I mount the USB stick containing the installer in Rescue 
> Mode?
>
> On Thu 15 Jul 2021 at 20:01:05 +0200, Stella Ashburne wrote:
>
> > root@perfect:/# file -sL /dev/sdb1
> > bash: file: command not found
> > root@perfect:/#
>
Nope, apparently it isn't available in Rescue Mode.

Entered encryption passphrase -> Choose a device to use as root file system -> 
/dev/perfect-vg/root -> Execute a shell in /dev/perfect-vg/root


> File is a standard utilty. It should be on your system.

It isn't available in Rescue Mode.
>
>  apt install file
>
Unable to install now as I'm in Rescue Mode without an internet connection. The 
only way for me to install packages is to use the USB-installer (Debian 11) and 
I can't mount it.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Stella Ashburne
> Sent: Thursday, July 15, 2021 at 3:49 PM
> From: "David Wright" 
> To: debian-user@lists.debian.org
> Subject: Re: How do I mount the USB stick containing the installer in Rescue 
> Mode?
>
> This
> might help the OP boot the system manually and recover the blue
> Grub menu.
>
That's very nice of you, David.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Brian
On Thu 15 Jul 2021 at 20:01:05 +0200, Stella Ashburne wrote:

> root@perfect:/# file -sL /dev/sdb1
> bash: file: command not found
> root@perfect:/#

File is a standard utilty. It should be on your system.

 apt install file

-- 
Brian.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Stella Ashburne
> Sent: Thursday, July 15, 2021 at 11:59 AM
> From: "Reco" 
> To: debian-user@lists.debian.org
> Subject: Re: How do I mount the USB stick containing the installer in Rescue 
> Mode?
>
> > Output of mount is
> >
> > root@perfect:/# mount
> > /dev/mapper/perfect--vg-root on / type ext4 (rw,relatime)
> > devtmpfs on /dev type devtmpfs 
> > (rw,relatime,size=8137669k,nr_inodes=2034417,mode=755)
> > proc on /proc type proc (rw,relatime)
> > sysfs on /sys type sysfs (rw,relatime)
> > tmpfs on /run type tmpfs (rw,nosuid,relatime,size=1629756k,mode=755)
> > root@perfect:/#
>
> And yet it fails to mount /dev/sdb1. Interesting.
>
I suppose the reason is that the USB stick is already mounted for booting into 
Rescue Mode.

> Ok, how about this (I'm assuming that the USB stick in question is
> plugged in):
>
Yes, it's always plugged in because I need it in Rescue Mode.

> lsblk
>
root@perfect:/# lsblk

NAME MAJ:MIN  RM   ROTYPEMOUNTPOINT
sda  8:0  00 disk
  sda1   8.1  00 part
  sda2   8:2  00 part
  sda3   8:3  00 part
sda3_crypt   253:000 crypt
  perfect--vg-swap   253:100 lvm
  perfect--vg-root   253:200 lvm /
sdb  8:16 10 disk
  sdb1   8:17 10 part
  sdb2   8:18 10 part
sr0  11:0 10 rom
root@perfect:/#

> fdisk -l /dev/sdb
>
root@perfect:/# fdisk -l /dev/sdb
Disk /dev/sdb

Device   BootStart End  SectorsSize  IdType
/dev/sdb1*   0 7677919  76779203.7G  0 Empty
/dev/sdb224260 294435184   2.5M  efEFI 
(FAT-12/16/32)
root@perfect:/#

> file -sL /dev/sdb1
>
root@perfect:/# file -sL /dev/sdb1
bash: file: command not found
root@perfect:/#


> ls -al /media/usbdisk
>
root@perfect:/# ls -al /media/usbdisk
ls: cannot access '/media/usbdisk' : No such file or directory

> mountpoint /media/usbdisk
>
root@perfect:/# mountpoint /media/usbdisk
mountpoint: /media/usbdisk : No such file or directory
root@perfect:/#



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread David Wright
On Thu 15 Jul 2021 at 11:43:26 (+0200), Stella Ashburne wrote:
> Debian Bullseye's installer is on a USB stick and I used it to boot into 
> Rescue Mode. If it's of any relevance, the partition table type is GPT, with 
> UEFI+Secure Boot enabled.
> 
> After booting into Rescue Mode and filling out the required details onscreen, 
> I chose /dev/perfect-vg/root as the device to use as root file system. If you 
> may recall, the volume group perfect-vg is LUKS-encrypted.
> 
> When asked if I wanted to mount the separate /boot/efi partition, I entered 
> No.
> 
> Next, I entered Executive a shell in /dev/perfect-vg/root
> 
> I typed the command nano /etc/apt/sources.list and commented out all the 
> lines therein.
> 
> I added the the following line:
> 
> deb [trusted=yes] file:/media/myusb bullseye main
> 
> I saved the sources.list file.
> 
> I created a directory called /media/myusb and issued the following command to 
> mount the USB stick to it:
> 
> mount /dev/sdb1 /media/myusb

Presumably given as root.

> The error message is:
> 
> mount: /media/myusb: /dev/sdb1 already mounted or mount point busy

Type:
$ ls -l /dev/disk/by-label/
to see what the kernel called your stick. Debian installers have LABELs.

> Below are the results of cat /etc/fstab
> 
>   
> 
> /dev/mapper/perfect--vg-root   /  ext4 errors-remount-ro   0  
>  1
> /boot/efi was on /dev/sda1 during installation

There's a # before that line

> UUID=A30E-2C33/boot/efi vfatumask=0077  0  1
> /dev/mapper/perfect--vg-swapnone   swapsw   0  0
> /dev/sr0  /media/cdrom0 udf, iso9660 user, noauto   0  0
> /media/myusb

That line looks spurious. If you put it there, I would remove it for
the time being. When you mount a USB stick as root, you don't need
an entry in fstab, but you do need to create a mount point first.
Of course, this has been done for you as a convenience: there is
a /mnt directory specifically for temporarily mounting a device.

Cheers,
David.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread David Wright
On Thu 15 Jul 2021 at 14:59:36 (+0300), Reco wrote:
> On Thu, Jul 15, 2021 at 01:52:12PM +0200, Stella Ashburne wrote:
> > > A usual thing with the modern desktop environments.
> > > Check the output of "mount" and "df -Th" and /dev/sdb1 will probably be
> > > there. I'd like to see the output of these commands too, btw.
> > >
> > Output of mount is
> > 
> > root@perfect:/# mount
> > /dev/mapper/perfect--vg-root on / type ext4 (rw,relatime)
> > devtmpfs on /dev type devtmpfs 
> > (rw,relatime,size=8137669k,nr_inodes=2034417,mode=755)
> > proc on /proc type proc (rw,relatime)
> > sysfs on /sys type sysfs (rw,relatime)
> > tmpfs on /run type tmpfs (rw,nosuid,relatime,size=1629756k,mode=755)
> > root@perfect:/#
> 
> And yet it fails to mount /dev/sdb1. Interesting.
> 
> Ok, how about this (I'm assuming that the USB stick in question is
> plugged in):

It was probably plugged in for booting, and so it's likely /dev/sda,
demoting the system drive to /dev/sdb.

> lsblk
> 
> fdisk -l /dev/sdb
> 
> file -sL /dev/sdb1
> 
> ls -al /media/usbdisk
> 
> mountpoint /media/usbdisk

I think I saw in a previous post of yours in June that you have not
only an encrypted system but also physical volumes and that lvm stuff.
Perhaps you might post the contents of the first menuentry stanza in
your grub.cfg, and confirm that your volumes are contained in an
outer encrypted partition (if I expressed that correctly). This
might help the OP boot the system manually and recover the blue
Grub menu.

Cheers,
David.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Joe
On Thu, 15 Jul 2021 07:00:40 -0400
Greg Wooledge  wrote:

> On Thu, Jul 15, 2021 at 12:55:11PM +0300, Reco wrote:


> >  halt the boot
> > process (i.e. host is inaccessible by network, console access only)
> > even if a single filesystem mentioned in fstab fails to mount.  
> 
> This was the traditional behavior before systemd, so one can't really
> fault systemd for continuing the practice.
> 
> It's assumed that all file systems mentioned in /etc/fstab are
> essential to the correct operation of the system (unless otherwise
> specified).  If one of them doesn't mount, it means a disk is broken
> to the point where human intervention is required, so the operating
> system decides to play it safe and not continue.
> 

So when I switched my unstable installation from sysvinit to systemd and
it subsequently failed to boot because of a missing drive, that was just
coincidence, was it? My system had never been booting and for some
reason I'd never noticed?

OK, naming removable drives in /etc/fstab may not have been best
practice, but it never held up booting before systemd arrived. But to
be fair, consistent mounting of USB media was a shambles before
systemd, and naming USB drives in fstab was the only way to ensure that
it happened reliably. Remember usbmount and other bodges?

-- 
Joe



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Reco
Hi.

On Thu, Jul 15, 2021 at 01:52:12PM +0200, Stella Ashburne wrote:
> > A usual thing with the modern desktop environments.
> > Check the output of "mount" and "df -Th" and /dev/sdb1 will probably be
> > there. I'd like to see the output of these commands too, btw.
> >
> Output of mount is
> 
> root@perfect:/# mount
> /dev/mapper/perfect--vg-root on / type ext4 (rw,relatime)
> devtmpfs on /dev type devtmpfs 
> (rw,relatime,size=8137669k,nr_inodes=2034417,mode=755)
> proc on /proc type proc (rw,relatime)
> sysfs on /sys type sysfs (rw,relatime)
> tmpfs on /run type tmpfs (rw,nosuid,relatime,size=1629756k,mode=755)
> root@perfect:/#

And yet it fails to mount /dev/sdb1. Interesting.

Ok, how about this (I'm assuming that the USB stick in question is
plugged in):

lsblk

fdisk -l /dev/sdb

file -sL /dev/sdb1

ls -al /media/usbdisk

mountpoint /media/usbdisk

Reco



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Stella Ashburne
Hi

> Sent: Thursday, July 15, 2021 at 9:55 AM
> From: "Reco" 
> To: debian-user@lists.debian.org
> Subject: Re: How do I mount the USB stick containing the installer in Rescue 
> Mode?
>
>   Hi.
>
> On Thu, Jul 15, 2021 at 11:43:26AM +0200, Stella Ashburne wrote:
> > Next, I entered Executive a shell in /dev/perfect-vg/root
>
> It's Superuser shell actually, not Supervisor/Executive one.
>
Thanks for pointing out my typo.
>
> Something has mounted your device elsewhere already.

I guess that when I used the USB-installer to boot my machine into Rescue Mode, 
the USB stick is mounted, yes?

> A usual thing with the modern desktop environments.
> Check the output of "mount" and "df -Th" and /dev/sdb1 will probably be
> there. I'd like to see the output of these commands too, btw.
>
Output of mount is

root@perfect:/# mount
/dev/mapper/perfect--vg-root on / type ext4 (rw,relatime)
devtmpfs on /dev type devtmpfs 
(rw,relatime,size=8137669k,nr_inodes=2034417,mode=755)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /run type tmpfs (rw,nosuid,relatime,size=1629756k,mode=755)
root@perfect:/#

Output of dh -Th is

root@perfect:/# df -Th
FilesystemTypeSizeUsedAvailUse%   Mounted on
/dev/perfect-vg/root  ext436G 773M33G  3% /
devtmpfs  devtmpfs   7.8G0   7.8G  0% /dev
tmpfs tmpfs  1.6G  96K   1.6G  1% /run
root@perfect:/#

> If these are the full contents of /etc/fstab, it's incorrect.
> In addition to the mountpoint you should specify a block device (or its
> equivalent), filesystem type, mount points, dump/pass and that's the
> least.

Thanks for the mini instruction. I really appreciate it.

> I.e. this line is wrong:
>
> /media/myusb
>
> This line is correct:
>
> /dev/sdb1 /media/usb auto defaults,nofail 0 0
>
> "nofail" is really needed for removable devices, because whoever
> designed systemd made an "interesting" decision to halt the boot process
> (i.e. host is inaccessible by network, console access only) even if a
> single filesystem mentioned in fstab fails to mount.
> You may want to add "noauto" as well, see fstab(5).
>
I read fstab(5). Unfortunately such man pages don't contain examples to 
illustrate the arguments and options.
>
>



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Stella Ashburne
Hi guys,

There's a typo in my original post. Thanks to Reco for pointing it out to me.

> Sent: Thursday, July 15, 2021 at 9:43 AM
> From: "Stella Ashburne" 
> To: "debian-user mailing list" 
> Subject: How do I mount the USB stick containing the installer in Rescue Mode?
>
>
> When asked if I wanted to mount the separate /boot/efi partition, I entered 
> No.
>
> Next, I entered Executive a shell in /dev/perfect-vg/root
>

CORRECTION: Execute a shell in /dev/perfect-vg/root



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread The Wanderer
On 2021-07-15 at 07:00, Greg Wooledge wrote:

> On Thu, Jul 15, 2021 at 12:55:11PM +0300, Reco wrote:
> 
>> "nofail" is really needed for removable devices, because whoever 
>> designed systemd made an "interesting" decision to halt the boot
>> process (i.e. host is inaccessible by network, console access only)
>> even if a single filesystem mentioned in fstab fails to mount.
> 
> This was the traditional behavior before systemd, so one can't
> really fault systemd for continuing the practice.
> 
> It's assumed that all file systems mentioned in /etc/fstab are
> essential to the correct operation of the system (unless otherwise
> specified).  If one of them doesn't mount, it means a disk is broken
> to the point where human intervention is required, so the operating
> system decides to play it safe and not continue.

Given the number of complaints I remember reading about cases where a
computer which had been working fine before failed to boot under
systemd, because there was a fstab entry which didn't have "nofail" set
where systemd needed it to be, I find the assertion that this was the
traditional behavior before systemd to be implausible.

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man. -- George Bernard Shaw



signature.asc
Description: OpenPGP digital signature


Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Reco
On Thu, Jul 15, 2021 at 07:00:40AM -0400, Greg Wooledge wrote:
> On Thu, Jul 15, 2021 at 12:55:11PM +0300, Reco wrote:
> > "nofail" is really needed for removable devices, because whoever
> > designed systemd made an "interesting" decision to halt the boot process
> > (i.e. host is inaccessible by network, console access only) even if a
> > single filesystem mentioned in fstab fails to mount.
> 
> This was the traditional behavior before systemd, so one can't really
> fault systemd for continuing the practice.

Not in Debian (sysvinit, upstart). RHEL, SuSE behaved exactly this way
indeed.

Reco



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Greg Wooledge
On Thu, Jul 15, 2021 at 12:55:11PM +0300, Reco wrote:
> "nofail" is really needed for removable devices, because whoever
> designed systemd made an "interesting" decision to halt the boot process
> (i.e. host is inaccessible by network, console access only) even if a
> single filesystem mentioned in fstab fails to mount.

This was the traditional behavior before systemd, so one can't really
fault systemd for continuing the practice.

It's assumed that all file systems mentioned in /etc/fstab are essential
to the correct operation of the system (unless otherwise specified).  If
one of them doesn't mount, it means a disk is broken to the point where
human intervention is required, so the operating system decides to play
it safe and not continue.



Re: How do I mount the USB stick containing the installer in Rescue Mode?

2021-07-15 Thread Reco
Hi.

On Thu, Jul 15, 2021 at 11:43:26AM +0200, Stella Ashburne wrote:
> Next, I entered Executive a shell in /dev/perfect-vg/root

It's Superuser shell actually, not Supervisor/Executive one.


> I created a directory called /media/myusb and issued the following command to 
> mount the USB stick to it:
> mount /dev/sdb1 /media/myusb
> 
> The error message is:
> mount: /media/myusb: /dev/sdb1 already mounted or mount point busy

Something has mounted your device elsewhere already.
A usual thing with the modern desktop environments.
Check the output of "mount" and "df -Th" and /dev/sdb1 will probably be
there. I'd like to see the output of these commands too, btw.


> Below are the results of cat /etc/fstab

If these are the full contents of /etc/fstab, it's incorrect.
In addition to the mountpoint you should specify a block device (or its
equivalent), filesystem type, mount points, dump/pass and that's the
least.

I.e. this line is wrong:

/media/myusb

This line is correct:

/dev/sdb1 /media/usb auto defaults,nofail 0 0

"nofail" is really needed for removable devices, because whoever
designed systemd made an "interesting" decision to halt the boot process
(i.e. host is inaccessible by network, console access only) even if a
single filesystem mentioned in fstab fails to mount.
You may want to add "noauto" as well, see fstab(5).

Reco