You are not logged in.

#1 2022-02-20 23:33:55

Simorgh
Member
From: Burlington, Ontario, Canada
Registered: 2016-12-20
Posts: 6

[SOLVED] mkswap cannot open /swap/swapefile No such file or directory

Hi all Arch-ers,

I am trying to install Arch for the first time with btrfs file system. The following is my step by step command that I have put together, following different guides online:

mkfs.vfat /dev/sda1
mkfs.btrfs /dev/sda2

mount /dev/sda2 /mnt
btrfs su cr /mnt/@root
btrfs su cr /mnt/@home
btrfs su cr /mnt/@var
btrfs su cr /mnt/@srv
btrfs su cr /mnt/@opt
btrfs su cr /mnt/@tmp
btrfs su cr /mnt/@swap
btrfs su cr /mnt/@.snapshots
umount /mnt
mount -o noatime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=@root /dev/sda2 /mnt
mkdir /mnt/{boot,home,var,srv,opt,tmp,swap,.snapshots}
mount -o noatime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=@home /dev/sda2 /mnt/home
mount -o noatime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=@srv /dev/sda2 /mnt/srv
mount -o noatime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=@tmp /dev/sda2 /mnt/tmp
mount -o noatime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=@opt /dev/sda2 /mnt/opt
mount -o noatime,compress=zstd,ssd,discard=async,space_cache=v2,subvol=@.snapshots /dev/sda2 /mnt/.snapshots
mount -o nodatacow,subvol=@swap /dev/sda2 /mnt/swap
mount -o nodatacow,subvol=@var /dev/sda2 /mnt/var
mount /dev/sda1 /mnt/boot

pacstrap /mnt base linux linux-firmware nano intel-ucode btrfs-progs
genfstab -U /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab

arch-chroot /mnt

truncate -s 0 /swap/swapfile
chattr +C /swap/swapfile
btrfs property set /swap/swapfile compression none
dd if=/dev/zero of=/swap/swapfile bs=1G count=2 status=progress
chmod 600 /swap/swapfile
lsattr /swap/swapfile
mkswap /swap/swapefile
swapon /swap/swapfile
cp /etc/fstab /etc/fstab.bak
echo '/swap/swapfile none swap defaults 0 0' | tee -a /etc/fstab

But when I try to do the ' mkswap /swap/swapfile ' I get the following:

[root@archiso /]# mkswap /swap/swapefile
mkswap: cannot open /swap/swapefile: No such file or directory

The /etc/fstab is:

# /dev/sda2
/dev/sda2           	/         	btrfs     	rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=256,subvol=/@root	0 0

# /dev/sda1
UUID=CCC8-095C      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/sda2
/dev/sda2           	/home     	btrfs     	rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=257,subvol=/@home	0 0

# /dev/sda2
/dev/sda2           	/srv      	btrfs     	rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=259,subvol=/@srv	0 0

# /dev/sda2
/dev/sda2           	/tmp      	btrfs     	rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=261,subvol=/@tmp	0 0

# /dev/sda2
/dev/sda2           	/opt      	btrfs     	rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=260,subvol=/@opt	0 0

# /dev/sda2
/dev/sda2           	/.snapshots	btrfs     	rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=263,subvol=/@.snapshots	0 0

# /dev/sda2
/dev/sda2           	/swap     	btrfs     	rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=262,subvol=/@swap	0 0

# /dev/sda2
/dev/sda2           	/var      	btrfs     	rw,relatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=258,subvol=/@var	0 0

Would greatly appreciate guidance.

Thanks.

[SOLVED] Unfortunately it was a pure typo. Thank you for your help @Trilby

Last edited by Simorgh (2022-02-21 03:44:20)

Offline

#2 2022-02-20 23:40:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] mkswap cannot open /swap/swapefile No such file or directory

My money is on the typo.  I'm pretty sure that'd be in the original command and output because if you had not copy-pasted them directly here, I'd find it quite odd for you to make the same typo twice in the post and once in the title.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2022-02-21 01:53:02

Simorgh
Member
From: Burlington, Ontario, Canada
Registered: 2016-12-20
Posts: 6

Re: [SOLVED] mkswap cannot open /swap/swapefile No such file or directory

Trilby wrote:

My money is on the typo.  I'm pretty sure that'd be in the original command and output because if you had not copy-pasted them directly here, I'd find it quite odd for you to make the same typo twice in the post and once in the title.

Thank you for pointing that out. *embarrassed*
I can't believe I have done a typo and spend ours of redoing the procedure over and over again.

Thanks.

I continued with the install and this is what I get now:

nano /etc/mkinitcpio.conf
> add ' btrfs ' to  MODULES()  ->  MODULES=(btrfs)
mkinitcpio -p linux
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  intel-ucode.img initramfs-linux-fallback.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
mount: /tmp/grub-btrfs.LGWTRW4mmz: special device /dev/disk/by-uuid/9369e485-0963-43ce-bfce-f885496712d0 does not exist.

I have commented out GRUB_DISABLE_OS_PROBER=false in /etc/default/grub

What other mistake have I done?

Appreciate any help.

Last edited by Simorgh (2022-02-21 01:55:23)

Offline

#4 2022-02-21 01:56:19

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [SOLVED] mkswap cannot open /swap/swapefile No such file or directory

That's a completely unrelated issue and should be in it's own thread.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2022-02-21 02:00:29

Simorgh
Member
From: Burlington, Ontario, Canada
Registered: 2016-12-20
Posts: 6

Re: [SOLVED] mkswap cannot open /swap/swapefile No such file or directory

Trilby wrote:

That's a completely unrelated issue and should be in it's own thread.

Thank you.
Noted.

Last edited by Simorgh (2022-02-21 03:44:56)

Offline

Board footer

Powered by FluxBB