Cannot change disk mapping when auto installing debian - installation

I have 2 types of industrial computers, and I want to install debian automatically :
- 1 PC with ssd mapped on sda
- 1 PC with ssd mapped on sdb
I have a preseeded debian iso on usb drive for installations.
So, the problem is : when I configure my preseed file, I need to set what is the target disk (sda or sdb), so it cannot work for both, and I didn't find any solution to set "the biggest disk will be the target" (my ssd is 64 GB, my usb drive is 4 GB) or something like this.
I have tried to include udev rules in iso image to always map the ssd on sda, but it does not take in account...
udev rules included (000-install.rules), I have tried those 2 :
KERNEL=="sda*",ENV{ID_FS_LABEL}=="CDROM",NAME="sdb%n"
KERNEL=="sdb*",ENV{ID_FS_LABEL}!="CDROM",NAME="sda%n"
and :
KERNEL=="sda",ENV{DEVTYPE}=="disk",ENV{ID_FS_LABEL}=="CDROM",NAME="sdb"
KERNEL=="sdb",ENV{DEVTYPE}=="disk",ENV{ID_FS_LABEL}!="CDROM",NAME="sda"
My preseed conf file :
#### Contents of the preconfiguration file
### Localization
# Preseeding only locale sets language, country and locale.
# Debian 9 & 10
d-i debian-installer/locale string fr_FR
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string regular
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-auto/choose_recipe select multi
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
## Controlling how partitions are mounted
# The default is to mount by UUID, but you can also choose "traditional" to
# use traditional device names, or "label" to try filesystem labels before
# falling back to UUIDs.
d-i partman/mount_style select label
Result (the file above works when ssd is mapped as sda, but not when it is sdb): installer tell me there is no enough space on sda (so on usb drive...)

First of all i want to tell you "udev was created to respond to hotplug type of events"
for example if you want to trigger a specific script when a specific device is plugged you can use this daemon.
another example of using this daemon is when you want to refuse a specific device to insert to your target machine.
in the other hand the biggest problem for using this approach to solve your issue is this:
The times when udevd is active are:
1: at startup, it parses all the config files and rule files and
builds a rules database in memory.
2: When an event happens, it checks its rule database and performs the
appropriate actions.
please look at this reference
The system initialization
so when codes for partitioning of your device is executed by debien-installer your root filesystem already mounted. therefore you cant unmount a root deivce that was already mounted and simply mount it to another device.
if you want to find the biggest device I suggest you looking at "debian-installer" that can execute udeb packages ( this type of packages can only execute in debian-installer). if you can create a udeb package that can execute a script in which it can detect which disk must be mounted in root system, before mounting root system by partman package you can solve your problem.
look at this reference below in which you can see order of udeb package installation existed in debian installer.
https://d-i.debian.org/doc/internals/apa.html

Related

Samba 4.10 server config: using module "vfs_fruit" changes file creation mask for Mac clients, and I cannot control it

TLDR; With vfs objects = catia fruit streams_xattr in my smb.conf, files created on the shares using Macs do not inherit permissions and get extended ACLs.
Background
I'm setting up a NAS with a Samba share for our office, which is a 50/50 macOs/Windows 10 shop. Everyone should have access to the shares using dedicated user accounts.
I wanted to leverage the latest enhancements in Samba 4 when it comes to performance with Macs, and TimeMachine support, so I enabled the modules vfs objects = catia fruit streams_xattr
Problem
Permissions are not inherited, and masks are not respected with these vfs objects set. I've tried a number of combinations of force createand create masks, and also (as in the example below) inherit permissions
Without the vfs objects modules set, permissions are as expected.
My smb.conf (relevant excerpt):
[global]
server string = %h server (Samba, Ubuntu)
server role = standalone server
client signing = disabled
unix password sync = yes
vfs objects = catia fruit streams_xattr
fruit:aapl = yes
map to guest = bad user
spotlight = yes
unix extensions = no
browseable = yes
read only = no
inherit permissions = yes
[OurShare]
path = /storage/OurShare
valid users = #office
OurShare has 2770 permissions:
ls -al /storage/OurShare
drwxrws--- adminuser office 4096 Oct 22 03:56
From a Windows machine, any new directory created in OurShare gets drwxrws---, as expected.
However a directory created from a Mac gets drwxr-xr-x+, so they are not writable by the group and that is the main problem here.
$ getfacl on such a directory tells me
# file: OurShare/testfile
# owner: someuser
# group: office
user::rwx
user:someuser:rwx #effective:r-x
group::rwx #effective:r-x
group:office:rwx #effective:r-x
mask::r-x
other::r-x
If I remove the modules vfs objects = catia fruit streams_xattr from smb.conf, then the permissions of files/folders created from Macs match that of those created from Windows - ie. there is no problem.
But without these modules I loose support for fruit:time machine for Mac backup purposes, and fruit:aapl, an extension which "enhances several deficiencies when connecting from Macs" (man vfs fruit).
This is an Ubuntu 19.04 system, with Samba v4.10.0
My question
How can I retain these Mac optimizations in Samba, while still being able to control permissions of created files and folders from the server side?
Thanks for all advice! This is driving me nuts
Turns out this was (already answered)[https://unix.stackexchange.com/questions/486919/creating-a-directory-in-samba-share-from-osx-client-always-has-acl-maskr-x] in the Unix stackexchange.
Answer:
Setting the global option fruit:nfs_aces = no will prevent macOS clients from modifying the UNIX mode of directories using NFS ACEs. An Access Control Entry is part of the Access Control List (ACL). This option defaults to yes - see the vfs_fruit manpage.
I can confirm that disabling this option results in permission inheritance working as expected with Mac clients, as they already are with Windows clients.
Happy to have figured it out!

WoeUSB creating bootable USB not working

I am using Ubuntu 18.04, woeUsb, 15 GB usb3 Stick, windows 10 64Bit ISO to create bootable device. I found few tutorials how to do it, but I still get error.
Installation failed!
Exit code: 256
Log:
WoeUSB v##WOEUSB_VERSION##
============================== Mounting source filesystem... Wiping all existing partition table and filesystem signatures in /dev/sda...
wipefs: error: /dev/sda: probing initialization failed: No medium
found The command "wipefs --all "${target_device}"" failed with exit
status "1", program is prematurely aborted Unmounting and removing
"/media/woeusb_source_1532252869_8362"... You may now safely detach
the target device
I tried to format my USB several times but nothing worked. I used FAT32 format. Should I first convert it to NTFS?
I have the same issue and found the solution by unmounting USB drive in this way,
Go to the Disks and select your USB drive from the left side menu, and click on the icon shown in the below image to unmount USB.
The command line version of the tool works better in my experience:
woeusb --device Win10_1909_English_x64.iso /dev/sdX --target-filesystem NTFS
/dev/sdX might be different on your system such as sda sdb ..., make sure to check the device path using gparted or fdisk.
Make sure to set the filesystem to NTFS with --target-filesystem NTFS as FAT32 doesn't support large files.
I found that you have to run the software with sudo because it requires the use of gparted. If you don't do this it won't succeed and exit. I suspect this is your problem. I had a similar problem.
I had the same problem but after surfing internet I found something like this: **
sudo woeusb --device image.iso /dev/sdb --tgt-fs NTFS --verbose
**. So in the command image.iso is the OS you downloaded(or the path to it), while the /dev... is the USB device and type of format(NTFS). Just copy the command, change image.iso to the path of your image.iso and change the /dev/sdb to the name of your USB device and make sure you are connected to internet because when I ran the command it seems it communicated with GitHub. Good luck I hope this will help if you haven't found any answer.
There is no need to use any third party tool in the Windows operating system to create a bootable USB. Follow the below commands:
1. Plug your USB drive
2. Open Command Prompt
3. Type: diskpart .
4. Type list volume (this will show your drives)
5. Type sel vol h (h can be replaced with ur usb volume, can be anything g, h, i)
6. Type active
7. It will make your USB active, copy and paste windows files inside it.

Resize Virtualbox Ubuntu VM storage not taking effect

I followed these instructions to resize my VirtualBox Ubuntu VM on Mac:
http://osxdaily.com/2015/04/07/how-to-resize-a-virtualbox-vdi-or-vhd-file-on-mac-os-x/
This is after the change:
*****-M-D2KA:$ VBoxManage showhdinfo ~/VirtualBox\ VMs/P4_Runtime/P4_Runtime.vdi
UUID: ce0ccd77-f265-46cd-9679-e25e64f1c992
Parent UUID: base
State: locked read
Type: normal (base)
Location: /Users/*****/VirtualBox VMs/P4_Runtime/P4_Runtime.vdi
Storage format: VDI
Format variant: dynamic default
Capacity: 25000 MBytes
Size on disk: 9967 MBytes
Encryption: disabled
In use by VMs: P4_Runtime (UUID: 5ea52b11-997f-45d8-b7d6-effa37a3b649) [Snapshot 1 (UUID: 409c1035-2134-4532-a931-a29018d33dc6)]
Child UUIDs: 540ae750-5307-44ef-a313-95134ae353b7
165fe99e-490d-4dd9-9602-00e3aaa8f82c
But for some reason, it does not seem to take effect:
This is the "df -k" output in the VM, and I get "No space left on device" error:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda 10253588 9713020 0 100% /
What am I missing?
I found out what I missed. I used gparted to resize the partition.
Resizing the VHD doesn't change the size of the partition /dev/sda. You can run lsblk inside the guest to see the additional space. To get the extra space that is available in the guest OS, you may
Use something like gparted as mentioned here. Instructions to do that on VHD can be found here. Note that this might not be easiest, but you may be forced to if you plan to not move some of your mount points (Example if you're not ready to move /home/ to a new partition).
Or, create a new partition, again instructions on how to do is present here. I would prefer this option over the first.

custom Linux kernel build failure in vmware workstation

While trying to compile/build and boot custom kernel inside vmware workstation, while booting new kernel, it fails and falls to shell with error "failed to find disk by uuid".
I tried this with both ubuntu and centos.
Things I tried but didn't help
check mapping by uuid in boot entry and existence in directory.
initramfs-update
replaced root=uuid=<> with /dev/disk/sda3
is it issue with vmware workstation?
how can it be rectified..??
I had a similar fault with my own attempts to bootstrap Fedora 22 onto a blank partition using a Centos install on another partition. I never did solve it completely, but I did find the problem was in my initrd rather than the kernel.
The problem is the initrd isn't starting LVM because dracut didn't tell the initrd that it needs LVM. Therefore if you start LVM manually you should be able to boot into your system to fix it.
I believe this is the sequence of commands I ran from the emergency shell to start LVM:
vgscan
vgchange -ay
lvs
this link helped me remember
Followed by exit to resume normal boot.
You might have to mount your LVM /etc/fstab entries manually, I don't recall whether I did or not.
Try this:
sudo update-grub
Then:
mkinitcpio -p linux
It won't hurt to check your fstab file. There, you should find the UUID of your drive. Make sure you have the proper flags set in the fstab.
Also, there's a setting in the grub.cfg that has has GRUB use the old style of hexadecimal UUIDs. Check that out as well!
The issue is with creation of initramfs, after doing a
make oldconfig
and choosing default for new options, make sure the ENOUGH diskspace is available for the image to be created.
in my case the image created was not correct and hence it was failing to mount the image at boot time.
when compared; the image size was quite less than the existing image of lower version, so I added another disk with more than sufficient size and then
make bzImage
make modules
make modules_install
make install
starts working like a charm.
I wonder why the image creation got completed earlier and resulted in corrupt image (with less size) without throwing any error [every single time]

How to list AFP shares from command-line (MacOS)?

From the command-line, I need to list all the AFP shares available from a given server on a local network.
I can browse the available servers that provides AFP as follow:
iMac:bin me$ dns-sd -B _afpovertcp._tcp
Browsing for _afpovertcp._tcp
Timestamp A/R Flags if Domain Service Type Instance Name
10:36:36.531 Add 3 4 local. _afpovertcp._tcp. iMac
10:36:36.547 Add 3 5 local. _afpovertcp._tcp. iMac
10:36:36.547 Add 3 4 local. _afpovertcp._tcp. box
10:36:36.547 Add 2 5 local. _afpovertcp._tcp. box
^C
And now I want to know what shares are available from "iMac" for instance (the ones that are displayed by the Finder when you clic on the server icon in the "Shares" left-column view) ?
PS I already found many threads about this (here and here), but they are unanswered for this specific topic.
Have alook at this one:
https://nmap.org/nsedoc/scripts/afp-showmount.html
I could get the info about available afp-shares with nmap...
My command:
nmap -p 548 --script afp-showmount --script-args afp.username=yourusername,afp.password=yourpassword yourserveraddress
I ended up here looking for this answer:
sudo sharing -l
Well, either you want the list of the mounted afp shares, then you can issue a mount command and you will get something like:
//someUser#someServer._afpovertcp._tcp.local/path on /Volumes/path (afpfs, nodev, nosuid, mounted by someUser)
Or you want to know what shares could be available for mounting… and unfortunately that's not easy since you first need to log in as a user to list the available shares for you to mount. Different users may see different shares for the same server.

Resources